Repository URL to install this package:
|
Version:
0.17.0 ▾
|
gmr-ingest
/
fixed_point_observatories.py
|
|---|
"""This module is datasource for positions for fixed point observatories.
This probably should be in a separate package altogether since it is a data sink like e.g. hzg_sos_connector.
However, as of now there are only two relevant observatories and creating an own package with repo and ci pipeline
seems to be a bit too much right now.
TODO: Move to seperate repo once number of observatories and number of sources for data grows
"""
import pandas as pd
import datetime
class FixedPointObservatory:
def __init__(self, shortname, latitude, longitude):
"""Simple class that holds shortname and position of an unmoving observatory.
:param shortname: shortname e.g. from OceanEddiesGeoserverPostgis DB
:param latitude
:param longitude
"""
self.shortname = shortname
self.lat = latitude
self.lon = longitude
@property
def longitude(self):
return self.lon
@property
def latitude(self):
return self.lat
# 'data source': a simple list edited by hand, add a new entry when needed
observatories = [FixedPointObservatory('ground_station_sal', 16.600338889, -22.898072222)]
def get_fixed_point_onservatories_data():
"""Returns data frame suitable for data ingest containing positions of all known fixed point onbservatories.
The current time is set as timestamp for the returned positions.
"""
obs = []
for ob in observatories:
obs.append({'platform_shortname': ob.shortname,
'obs_timestamp': datetime.datetime.utcnow(),
'lat': ob.lat,
'lon': ob.lon})
return pd.DataFrame(obs)