Skip to content

Commit d7fb04d

Browse files
Station now have a proper description in CZML
1 parent f9917de commit d7fb04d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

server/app/czml.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11

22
from poliastro.czml.extract_czml import CZMLExtractor
33
from poliastro.twobody import Orbit
4-
from app.repository import ObservationId, Repository, Observation, Satellite
4+
from app.repository import ObservationId, Repository, Observation, Satellite, Station
55
from tletools import TLE
66
from astropy.time import Time
77
from astropy import units as u
88
from pprint import pprint
9+
from app.utils import coords
910

1011
def get_obs_czml(id):
1112
"""Generates CZML file that describe the observation, specified by id. ID must be an integer.
@@ -57,7 +58,7 @@ def get_obs_czml(id):
5758
if station is not None:
5859
extractor.add_ground_station([ station['lat'] * u.degree, station['lon'] * u.degree ],
5960
label_text = station['name'],
60-
id_description= station['descr'])
61+
id_description= get_station_descr(station))
6162

6263
# I'm sure there's much easier way to do the conversion, but all the examples
6364
# for czml3 only show how to convert a single packet. For pass visualization, we will
@@ -102,4 +103,13 @@ def get_obs_descr(start_epoch: Time, end_epoch: Time, orb: Orbit, obs: Observati
102103
descr = descr + "Period = <b>{period:.1f}</b><br/>".format(period = orb.period)
103104
descr = descr + "Epoch = %s<br/></p>" % str(orb.epoch)[:16]
104105

106+
return descr
107+
108+
def get_station_descr(station: Station) -> str:
109+
"""Generates a description of the ground station"""
110+
descr = "<p><b>Description:</b><br/>" + station['descr'] + "</p>\n"
111+
112+
descr += "<p><b>Coordinates</b>: " + coords(station['lon'], station['lat']) + "</p>\n"
113+
descr += "<p><b>Configuration</b>:<br/>" + station['config'] + "</p>"
114+
105115
return descr

0 commit comments

Comments
 (0)