def build_site(station: parsers.inspire.Station) -> assets.Site: """ Map an Air quality monitoring Station to an Urban Flows Site https://uk-air.defra.gov.uk/data/so/stations/ """ site_id = station.id site = assets.Site( site_id=site_id, latitude=station.coordinates[0], longitude=station.coordinates[1], altitude=station.altitude['value'], address=None, city=station.name, country='United Kingdom', postcode=None, first_date=station.start_time.date(), operator=dict( email='*****@*****.**', contact='https://www.gov.uk/government/organisations/department-for-environment-food-rural-affairs', address='Atmosphere and Noise, Resource Atmosphere and Sustainability, ' 'Area 2C Nobel House, 17 Smith Square, London, SW1P 2AL', ), desc_url=station.info, ) return site
def instrument_to_site(instrument: Mapping) -> assets.Site: """ Map an Aeroqual instrument to an Urban Flows site (location) asset. """ return assets.Site( site_id=instrument['serial'], operator=instrument['organisation'], desc_url=settings.DESC_URL, )
def device_to_site(device: dict) -> assets.Site: LOGGER.debug(device) return assets.Site( site_id=device['zNumber'], latitude=device['location']['lat'], longitude=device['location']['lng'], first_date=device['location']['since'][:10], country='United Kingdom', )
def station_to_site(station: dict) -> assets.Site: """Map station data to Urban Flows station metadata""" return assets.Site( site_id=station['stationReference'], latitude=station['lat'], longitude=station['long'], address=station.get('riverName'), desc_url=station['@id'], first_date=station.get('dateOpened'), city=station.get('town'), country='United Kingdom', )
def build_site(station: parsers.Station) -> assets.Site: return assets.Site( site_id=clean_station_id(station.id), latitude=station.coordinates[0], longitude=station.coordinates[1], altitude=station.coordinates[2], address=station.name, city=station.name, desc_url=station.info, country=settings.COUNTRY, postcode=None, first_date=station.start_time, operator=dict(url=station.belongs_to), )