Skip to content
Snippets Groups Projects
Commit 622ceff2 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-2856: extended endpoint with station version property

parent 0190e88b
No related branches found
No related tags found
No related merge requests found
......@@ -254,12 +254,17 @@ def stations(request):
from lofar.sas.tmss.tmss.tmssapp.models import CommonSchemaTemplate
stations_template = CommonSchemaTemplate.get_latest(name="stations")
stations = stations_template.schema['definitions']['station']['enum']
lofar2_station_group = next(sg for sg in stations_template.schema['definitions']['station_group']['anyOf'] if sg['title'] == 'LOFAR2')
lofar2_stations = lofar2_station_group['properties']['stations']['enum'][0]
result = {}
for station in stations:
# for now, we just add the location as lat/lon in deg.
loc = create_location_for_station(station)
result[station] = {'latitude': loc.lat.deg, 'longitude': loc.lon.deg}
# and the station version.
version = 2 if station in lofar2_stations else 1
result[station] = {'latitude': loc.lat.deg, 'longitude': loc.lon.deg, 'version': version }
return JsonResponse(result)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment