Вот программа для Google Colab, которая отображает видимые участки орбит спутников:
python Copy code
# Установка необходимых библиотек
!pip install skyfield folium pytz
import folium
from skyfield.api import load, EarthSatellite, wgs84
from skyfield.timelib import Time
from datetime import datetime, timedelta
import pytz
import numpy as np
# Параметры наблюдения
satellites_norad = [57181, 61782, 61749]
observer_lat = 55.7000 # широта обсерватории
observer_lon = 36.7596 # долгота обсерватории
observer_elevation = 0 # высота над уровнем моря в метрах
# Временной интервал наблюдения
moscow_tz = pytz.timezone('Europe/Moscow')
start_time_local = moscow_tz.localize(datetime(2025, 5, 29, 18, 0, 0))
end_time_local = moscow_tz.localize(datetime(2025, 5, 29, 23, 0, 0))
# Преобразование в UTC
start_time_utc = start_time_local.astimezone(pytz.UTC)
end_time_utc = end_time_local.astimezone(pytz.UTC)
# Загрузка данных
ts = load.timescale()
stations_url = 'https://celestrak.org/NORAD/elements/stations.txt'
satellites_data = load.tle_file(stations_url)
# Создание словаря спутников по NORAD ID
satellites_by_norad = {sat.model.satnum: sat for sat in satellites_data}
# Создание карты
m = folium.Map(location=[observer_lat, observer_lon], zoom_start=6)
folium.Marker([observer_lat, observer_lon],
popup='Звенигород обсерватория, 0m',
icon=folium.Icon(color='red', icon='star')).add_to(m)
# Позиция наблюдателя
observer = wgs84.latlon(observer_lat, observer_lon, observer_elevation)
# Функция для расчета видимости
def calculate_visibility_passes(satellite, observer, start_time, end_time, min_elevation=10):
"""Находит все периоды видимости спутника"""
passes = []
# Создаем временную сетку с шагом 30 секунд
time_step = 30 # секунд
num_steps = int((end_time - start_time).total_seconds() / time_step)
times = []
for i in range(num_steps + 1):
t = start_time + timedelta(seconds=i * time_step)
times.append(ts.from_datetime(t))
# Вычисляем позиции для всех моментов времени
visible_segments = []
current_segment = []
for t in times:
difference = satellite - observer
topocentric = difference.at(t)
alt, az, distance = topocentric.altaz()
if alt.degrees > min_elevation:
# Получаем позицию спутника
geocentric = satellite.at(t)
lat, lon = wgs84.latlon_of(geocentric)
current_segment.append({
'time': t.utc_datetime(),
'lat': lat.degrees,
'lon': lon.degrees,
'alt': alt.degrees,
'az': az.degrees
})
else:
if current_segment:
visible_segments.append(current_segment)
current_segment = []
# Добавляем последний сегмент, если он есть
if current_segment:
visible_segments.append(current_segment)
return visible_segments
# Цвета для разных спутников
colors = ['blue', 'green', 'purple', 'orange', 'darkred', 'lightblue']
# Обработка каждого спутника
for idx, norad_id in enumerate(satellites_norad):
if norad_id not in satellites_by_norad:
print(f"Спутник с NORAD ID {norad_id} не найден в базе данных")
continue
satellite = satellites_by_norad[norad_id]
satellite_name = satellite.name
color = colors[idx % len(colors)]
print(f"Обработка спутника: {satellite_name} (NORAD: {norad_id})")
# Находим все видимые проходы
visible_segments = calculate_visibility_passes(
satellite, observer, start_time_utc, end_time_utc
)
# Отображаем каждый видимый сегмент
for segment_idx, segment in enumerate(visible_segments):
if len(segment) < 2:
continue
# Координаты для линии
coordinates = [[point['lat'], point['lon']] for point in segment]
# Время начала и конца в местном времени
start_local = segment[0]['time'].replace(tzinfo=pytz.UTC).astimezone(moscow_tz)
end_local = segment[-1]['time'].replace(tzinfo=pytz.UTC).astimezone(moscow_tz)
# Рисуем траекторию
folium.PolyLine(
coordinates,
color=color,
weight=3,
opacity=0.8,
popup=f"{satellite_name} (NORAD: {norad_id})"
).add_to(m)
# Маркер начала пролета
folium.CircleMarker(
location=coordinates[0],
radius=5,
popup=f"Начало: {start_local.strftime('%H:%M:%S')}<br>"
f"{satellite_name}<br>NORAD: {norad_id}",
color=color,
fill=True,
fillColor=color
).add_to(m)
# Маркер конца пролета
folium.CircleMarker(
location=coordinates[-1],
radius=5,
popup=f"Конец: {end_local.strftime('%H:%M:%S')}<br>"
f"{satellite_name}<br>NORAD: {norad_id}",
color=color,
fill=True,
fillColor='white'
).add_to(m)
# Добавляем подписи времени
folium.Marker(
location=coordinates[0],
icon=folium.DivIcon(
html=f'<div style="font-size: 10pt; color: {color}; font-weight: bold;">'
f'{start_local.strftime("%H:%M")}</div>'
)
).add_to(m)
folium.Marker(
location=coordinates[-1],
icon=folium.DivIcon(
html=f'<div style="font-size: 10pt; color: {color}; font-weight: bold;">'
f'{end_local.strftime("%H:%M")}</div>'
)
).add_to(m)
print(f" Пролет {segment_idx + 1}: {start_local.strftime('%H:%M:%S')} - "
f"{end_local.strftime('%H:%M:%S')} (макс. высота: {max(p['alt'] for p in segment):.1f}°)")
# Добавляем легенду
legend_html = '''
<div style="position: fixed;
top: 10px; right: 10px; width: 200px; height: auto;
background-color: white; border:2px solid grey; z-index:9999;
font-size:14px; padding: 10px">
<p style="margin: 0;"><b>Легенда:</b></p>
<p style="margin: 5px 0;">🔴 - Обсерватория</p>
<p style="margin: 5px 0;">● - Начало пролета</p>
<p style="margin: 5px 0;">○ - Конец пролета</p>
<p style="margin: 5px 0;">Время указано по МСК</p>
</div>
'''
m.get_root().html.add_child(folium.Element(legend_html))
# Отображение карты
m
Программа автоматически учитывает московское время и преобразует его в UTC для расчетов, а затем обратно для отображения.
Если какой-то спутник не найден в базе stations.txt, попробуйте использовать другие источники TLE данных, например: