Skip to content

Commit 7b6c565

Browse files
committed
Add real thumbnails for Finland sensors
1 parent 1be1290 commit 7b6c565

4 files changed

Lines changed: 22 additions & 8 deletions

File tree

publishers/digitraffic_road_weather/bootstrap_digitraffic_road_weather.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
DIGITRAFFIC_LICENSE = "https://www.digitraffic.fi/en/terms-of-use/"
2727
DIGITRAFFIC_STATIONS = "https://tie.digitraffic.fi/api/weather/v1/stations"
2828
DIGITRAFFIC_LATEST = "https://tie.digitraffic.fi/api/weather/v1/stations/data"
29+
DIGITRAFFIC_ROAD_WEATHER_STATION_IMAGE = "https://upload.wikimedia.org/wikipedia/commons/9/94/Traffic_weather_station_general_view.jpg"
2930

3031

3132
def _load_stations() -> list[dict]:
@@ -138,6 +139,7 @@ def _system_sml(station: dict) -> dict:
138139
],
139140
"contacts": [{"role": "operator", "organisationName": "Fintraffic / Digitraffic", "contactInfo": {"onlineResource": {"linkage": DIGITRAFFIC_HOME}}}],
140141
"documents": [
142+
{"role": "http://dbpedia.org/resource/Photograph", "name": "Actual traffic weather station hardware", "description": "Photograph of real road-weather station sensor hardware used as the representative hardware image for Digitraffic road-weather station cards. Source: Wikimedia Commons.", "link": {"href": DIGITRAFFIC_ROAD_WEATHER_STATION_IMAGE, "type": "image/jpeg"}},
141143
{"role": "http://dbpedia.org/resource/Web_page", "name": "Digitraffic Road Weather Station Data", "link": {"href": _station_data_url(station_id), "type": "application/json"}},
142144
{"role": "http://dbpedia.org/resource/Web_page", "name": "Digitraffic Terms of Use", "link": {"href": DIGITRAFFIC_LICENSE, "type": "text/html"}},
143145
],

publishers/fmi_air_quality/bootstrap_fmi_air_quality.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def _datastream_uid(station: dict) -> str:
4747
return f"urn:os4csapi:datastream:fmi-air-quality:{_uid_token(station['stationId'])}:{DS_OUTPUT_NAME}:v1"
4848

4949

50+
def _image_docs(station: dict) -> list[dict]:
51+
image_url = station.get("imageUrl")
52+
if not image_url:
53+
return []
54+
return [{"role": "http://dbpedia.org/resource/Photograph", "name": station.get("imageName") or "Actual atmospheric monitoring station image", "description": f"{station.get('imageDescription') or 'Public photograph of real atmospheric monitoring sensor or station infrastructure.'} Source: Wikimedia Commons.", "link": {"href": image_url, "type": "image/jpeg"}}]
55+
56+
5057
PROCEDURE_STUB = {"type": "Feature", "geometry": None, "properties": {"uid": PROC_UID, "featureType": "sosa:ObservingProcedure", "name": "FMI Air Quality Observation v1", "description": "Publishes curated Finnish Meteorological Institute air-quality observations from FMI Open Data WFS.", "validTime": [VALID_TIME_START, ".."]}}
5158
PROCEDURE_SML = {"type": "SimpleProcess", "id": PROC_UID, "uniqueId": PROC_UID, "definition": "sosa:ObservingProcedure", "label": "FMI Air Quality Observation v1", "description": "Fetches recent FMI Open Data hourly simple air-quality observations and publishes one combined observation per curated Finnish monitoring location.", "keywords": ["FMI", "Finnish Meteorological Institute", "Finland", "air quality", "NO2", "O3", "PM10", "PM2.5", "WFS"], "documents": [{"role": "http://dbpedia.org/resource/Web_page", "name": "FMI Open Data", "link": {"href": FMI_HOME, "type": "text/html"}}, {"role": "http://dbpedia.org/resource/Web_page", "name": "FMI WFS", "link": {"href": FMI_WFS, "type": "text/xml"}}], "contacts": [{"role": "operator", "organisationName": "Finnish Meteorological Institute", "contactInfo": {"onlineResource": {"linkage": FMI_HOME}}}, {"role": "publisher", "organisationName": "OS4CSAPI", "contactInfo": {"onlineResource": {"linkage": "https://github.com/OS4CSAPI/OSHConnect-Python"}}}]}
5259

@@ -56,7 +63,7 @@ def _system_stub(station: dict) -> dict:
5663

5764

5865
def _system_sml(station: dict) -> dict:
59-
return {"type": "PhysicalSystem", "id": _system_uid(station["stationId"]), "uniqueId": _system_uid(station["stationId"]), "definition": "sosa:System", "label": f"FMI Air Quality {station['name']}", "description": f"Finnish Meteorological Institute Open Data air-quality monitoring location for {station['name']} ({station.get('region', 'Finland')}).", "keywords": ["FMI", "Finland", "air quality", "air pollution", station["name"], station["stationId"]], "identifiers": [{"definition": "http://sensorml.com/ont/swe/property/ShortName", "label": "Short Name", "value": f"FMI AQ {station['name']}"}, {"definition": "http://sensorml.com/ont/swe/property/StationID", "label": "Curated Station ID", "value": station["stationId"]}, {"definition": "http://sensorml.com/ont/swe/property/UniqueID", "label": "OS4CSAPI UID", "value": _system_uid(station["stationId"])}], "classifiers": [{"definition": "http://sensorml.com/ont/swe/property/SensorType", "label": "Source Type", "value": "FMI air-quality monitoring station"}, {"definition": "http://sensorml.com/ont/swe/property/IntendedApplication", "label": "Intended Application", "value": "Air-quality monitoring and environmental situational awareness"}], "contacts": [{"role": "operator", "organisationName": "Finnish Meteorological Institute", "contactInfo": {"onlineResource": {"linkage": FMI_HOME}}}], "documents": [{"role": "http://dbpedia.org/resource/Web_page", "name": "FMI Open Data", "link": {"href": FMI_HOME, "type": "text/html"}}, {"role": "http://dbpedia.org/resource/Web_page", "name": "FMI WFS", "link": {"href": FMI_WFS, "type": "text/xml"}}], "characteristics": [{"label": "Station Properties", "characteristics": [{"type": "Text", "name": "bbox", "label": "FMI BBox Query", "value": station.get("bbox", "")}, {"type": "Text", "name": "region", "label": "Region", "value": station.get("region", "")}, {"type": "Text", "name": "selection_reason", "label": "Selection Reason", "value": station.get("selectionReason", "Curated FMI air-quality station")}, {"type": "Text", "name": "license", "label": "License", "value": "FMI Open Data terms and attribution"}]}], "capabilities": [{"definition": "http://www.w3.org/ns/ssn/systems/SystemCapability", "label": "Publisher Capabilities", "capabilities": [{"type": "Quantity", "name": "publish_interval", "definition": "http://qudt.org/vocab/quantitykind/Period", "label": "Publish Interval", "uom": {"code": "s"}, "value": PUBLISH_INTERVAL_SECONDS}]}], "position": {"type": "Point", "coordinates": [station["lon"], station["lat"]], "srsName": "http://www.opengis.net/def/crs/EPSG/0/4326"}}
66+
return {"type": "PhysicalSystem", "id": _system_uid(station["stationId"]), "uniqueId": _system_uid(station["stationId"]), "definition": "sosa:System", "label": f"FMI Air Quality {station['name']}", "description": f"Finnish Meteorological Institute Open Data air-quality monitoring location for {station['name']} ({station.get('region', 'Finland')}).", "keywords": ["FMI", "Finland", "air quality", "air pollution", station["name"], station["stationId"]], "identifiers": [{"definition": "http://sensorml.com/ont/swe/property/ShortName", "label": "Short Name", "value": f"FMI AQ {station['name']}"}, {"definition": "http://sensorml.com/ont/swe/property/StationID", "label": "Curated Station ID", "value": station["stationId"]}, {"definition": "http://sensorml.com/ont/swe/property/UniqueID", "label": "OS4CSAPI UID", "value": _system_uid(station["stationId"])}], "classifiers": [{"definition": "http://sensorml.com/ont/swe/property/SensorType", "label": "Source Type", "value": "FMI air-quality monitoring station"}, {"definition": "http://sensorml.com/ont/swe/property/IntendedApplication", "label": "Intended Application", "value": "Air-quality monitoring and environmental situational awareness"}], "contacts": [{"role": "operator", "organisationName": "Finnish Meteorological Institute", "contactInfo": {"onlineResource": {"linkage": FMI_HOME}}}], "documents": _image_docs(station) + [{"role": "http://dbpedia.org/resource/Web_page", "name": "FMI Open Data", "link": {"href": FMI_HOME, "type": "text/html"}}, {"role": "http://dbpedia.org/resource/Web_page", "name": "FMI WFS", "link": {"href": FMI_WFS, "type": "text/xml"}}], "characteristics": [{"label": "Station Properties", "characteristics": [{"type": "Text", "name": "bbox", "label": "FMI BBox Query", "value": station.get("bbox", "")}, {"type": "Text", "name": "region", "label": "Region", "value": station.get("region", "")}, {"type": "Text", "name": "selection_reason", "label": "Selection Reason", "value": station.get("selectionReason", "Curated FMI air-quality station")}, {"type": "Text", "name": "license", "label": "License", "value": "FMI Open Data terms and attribution"}]}], "capabilities": [{"definition": "http://www.w3.org/ns/ssn/systems/SystemCapability", "label": "Publisher Capabilities", "capabilities": [{"type": "Quantity", "name": "publish_interval", "definition": "http://qudt.org/vocab/quantitykind/Period", "label": "Publish Interval", "uom": {"code": "s"}, "value": PUBLISH_INTERVAL_SECONDS}]}], "position": {"type": "Point", "coordinates": [station["lon"], station["lat"]], "srsName": "http://www.opengis.net/def/crs/EPSG/0/4326"}}
6067

6168

6269
def _datastream_schema(station: dict) -> dict:
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"stations": [
3-
{"stationId": "uto-baltic-background", "name": "Uto Baltic Background", "bbox": "21.35479,59.75909,21.39479,59.79909", "lat": 59.77909, "lon": 21.37479, "region": "Archipelago Sea", "selectionReason": "Fresh FMI background air-quality observations with NO2, O3, PM10, and PM2.5."},
4-
{"stationId": "hyytiala-forest-background", "name": "Hyytiala Forest Background", "bbox": "24.26696,61.82591,24.30696,61.86591", "lat": 61.84591, "lon": 24.28696, "region": "Pirkanmaa", "selectionReason": "Fresh inland background air-quality observations with NO2 and O3."},
5-
{"stationId": "oulanka-background", "name": "Oulanka Background", "bbox": "29.37967,66.30027,29.41967,66.34027", "lat": 66.32027, "lon": 29.39967, "region": "North Ostrobothnia / Kuusamo", "selectionReason": "Fresh northern background air-quality observations."},
6-
{"stationId": "sodankyla-arctic", "name": "Sodankyla Arctic Research", "bbox": "26.61834,67.34247,26.65834,67.38247", "lat": 67.36247, "lon": 26.63834, "region": "Lapland", "selectionReason": "Fresh Arctic-region ozone and air-quality index observations."},
7-
{"stationId": "pallas-background", "name": "Pallas Background", "bbox": "24.09559,67.95328,24.13559,67.99328", "lat": 67.97328, "lon": 24.11559, "region": "Lapland", "selectionReason": "Fresh northern background observations with O3 and particulates."},
8-
{"stationId": "virolahti-background", "name": "Virolahti Background", "bbox": "27.53873,60.51774,27.57873,60.55774", "lat": 60.53774, "lon": 27.55873, "region": "Southeast Finland", "selectionReason": "Fresh southeastern Finland background air-quality observations."}
3+
{"stationId": "uto-baltic-background", "name": "Uto Baltic Background", "bbox": "21.35479,59.75909,21.39479,59.79909", "lat": 59.77909, "lon": 21.37479, "region": "Archipelago Sea", "selectionReason": "Fresh FMI background air-quality observations with NO2, O3, PM10, and PM2.5.", "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/b/bd/Oksakyvetti_-_Smear_II_-asema_-_Hyyti%C3%A4l%C3%A4%2C_Juupajoki.jpg", "imageName": "Actual SMEAR II atmospheric monitoring instrumentation", "imageDescription": "Representative photograph of real Finnish atmospheric monitoring instrumentation. Exact Uto station photo was not found in the first public-source pass."},
4+
{"stationId": "hyytiala-forest-background", "name": "Hyytiala Forest Background", "bbox": "24.26696,61.82591,24.30696,61.86591", "lat": 61.84591, "lon": 24.28696, "region": "Pirkanmaa", "selectionReason": "Fresh inland background air-quality observations with NO2 and O3.", "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/b/bd/Oksakyvetti_-_Smear_II_-asema_-_Hyyti%C3%A4l%C3%A4%2C_Juupajoki.jpg", "imageName": "Actual Hyytiälä SMEAR II atmospheric monitoring instrumentation", "imageDescription": "Exact public photograph of real SMEAR II atmospheric monitoring instrumentation at Hyytiälä, Juupajoki."},
5+
{"stationId": "oulanka-background", "name": "Oulanka Background", "bbox": "29.37967,66.30027,29.41967,66.34027", "lat": 66.32027, "lon": 29.39967, "region": "North Ostrobothnia / Kuusamo", "selectionReason": "Fresh northern background air-quality observations.", "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/6/67/Oulanka_research_station.JPG", "imageName": "Oulanka Research Station", "imageDescription": "Public photograph of the actual Oulanka research station site."},
6+
{"stationId": "sodankyla-arctic", "name": "Sodankyla Arctic Research", "bbox": "26.61834,67.34247,26.65834,67.38247", "lat": 67.36247, "lon": 26.63834, "region": "Lapland", "selectionReason": "Fresh Arctic-region ozone and air-quality index observations.", "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/b/bf/Main_building_of_SGO_and_FMI_ARC.JPG", "imageName": "Sodankylä FMI Arctic Research Centre", "imageDescription": "Public photograph of the actual FMI Arctic Research Centre / Sodankylä Geophysical Observatory site."},
7+
{"stationId": "pallas-background", "name": "Pallas Background", "bbox": "24.09559,67.95328,24.13559,67.99328", "lat": 67.97328, "lon": 24.11559, "region": "Lapland", "selectionReason": "Fresh northern background observations with O3 and particulates.", "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/b/bd/Oksakyvetti_-_Smear_II_-asema_-_Hyyti%C3%A4l%C3%A4%2C_Juupajoki.jpg", "imageName": "Actual SMEAR II atmospheric monitoring instrumentation", "imageDescription": "Representative photograph of real Finnish atmospheric monitoring instrumentation. Exact Pallas station photo was not found in the first public-source pass."},
8+
{"stationId": "virolahti-background", "name": "Virolahti Background", "bbox": "27.53873,60.51774,27.57873,60.55774", "lat": 60.53774, "lon": 27.55873, "region": "Southeast Finland", "selectionReason": "Fresh southeastern Finland background air-quality observations.", "imageUrl": "https://upload.wikimedia.org/wikipedia/commons/b/bd/Oksakyvetti_-_Smear_II_-asema_-_Hyyti%C3%A4l%C3%A4%2C_Juupajoki.jpg", "imageName": "Actual SMEAR II atmospheric monitoring instrumentation", "imageDescription": "Representative photograph of real Finnish atmospheric monitoring instrumentation. Exact Virolahti station photo was not found in the first public-source pass."}
99
]
1010
}

publishers/fmi_weather/bootstrap_fmi_weather.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
DS_OUTPUT_NAME = "fmiWeatherObs"
2424
FMI_HOME = "https://en.ilmatieteenlaitos.fi/open-data"
2525
FMI_WFS = "https://opendata.fmi.fi/wfs"
26+
FMI_WEATHER_STATION_IMAGE = "https://upload.wikimedia.org/wikipedia/commons/2/21/S%C3%A4%C3%A4asema_Kylm%C3%A4pihlaja.jpg"
2627

2728

2829
def _load_stations() -> list[dict]:
@@ -47,6 +48,10 @@ def _datastream_uid(station: dict) -> str:
4748
return f"urn:os4csapi:datastream:fmi-weather:{_uid_token(station['stationId'])}:{DS_OUTPUT_NAME}:v1"
4849

4950

51+
def _image_docs(station: dict) -> list[dict]:
52+
return [{"role": "http://dbpedia.org/resource/Photograph", "name": "Actual Finnish weather station instrumentation", "description": f"Photograph of real Finnish weather-station instrumentation used as the representative sensor image for FMI weather station {station['name']}. Source: Wikimedia Commons.", "link": {"href": FMI_WEATHER_STATION_IMAGE, "type": "image/jpeg"}}]
53+
54+
5055
PROCEDURE_STUB = {"type": "Feature", "geometry": None, "properties": {"uid": PROC_UID, "featureType": "sosa:ObservingProcedure", "name": "FMI Weather Observation v1", "description": "Publishes curated Finnish Meteorological Institute weather observations from FMI Open Data WFS.", "validTime": [VALID_TIME_START, ".."]}}
5156
PROCEDURE_SML = {
5257
"type": "SimpleProcess",
@@ -77,7 +82,7 @@ def _system_sml(station: dict) -> dict:
7782
"identifiers": [{"definition": "http://sensorml.com/ont/swe/property/ShortName", "label": "Short Name", "value": f"FMI Wx {station['name']}"}, {"definition": "http://sensorml.com/ont/swe/property/StationID", "label": "Curated Station ID", "value": station["stationId"]}, {"definition": "http://sensorml.com/ont/swe/property/UniqueID", "label": "OS4CSAPI UID", "value": _system_uid(station["stationId"])}],
7883
"classifiers": [{"definition": "http://sensorml.com/ont/swe/property/SensorType", "label": "Source Type", "value": "FMI weather observation station"}, {"definition": "http://sensorml.com/ont/swe/property/IntendedApplication", "label": "Intended Application", "value": "Weather monitoring and environmental situational awareness"}],
7984
"contacts": [{"role": "operator", "organisationName": "Finnish Meteorological Institute", "contactInfo": {"onlineResource": {"linkage": FMI_HOME}}}],
80-
"documents": [{"role": "http://dbpedia.org/resource/Web_page", "name": "FMI Open Data", "link": {"href": FMI_HOME, "type": "text/html"}}, {"role": "http://dbpedia.org/resource/Web_page", "name": "FMI WFS", "link": {"href": FMI_WFS, "type": "text/xml"}}],
85+
"documents": _image_docs(station) + [{"role": "http://dbpedia.org/resource/Web_page", "name": "FMI Open Data", "link": {"href": FMI_HOME, "type": "text/html"}}, {"role": "http://dbpedia.org/resource/Web_page", "name": "FMI WFS", "link": {"href": FMI_WFS, "type": "text/xml"}}],
8186
"characteristics": [{"label": "Station Properties", "characteristics": [{"type": "Text", "name": "place", "label": "FMI Place Query", "value": station.get("place", station["name"])}, {"type": "Text", "name": "region", "label": "Region", "value": station.get("region", "")}, {"type": "Text", "name": "selection_reason", "label": "Selection Reason", "value": station.get("selectionReason", "Curated FMI weather station")}, {"type": "Text", "name": "license", "label": "License", "value": "FMI Open Data terms and attribution"}]}],
8287
"capabilities": [{"definition": "http://www.w3.org/ns/ssn/systems/SystemCapability", "label": "Publisher Capabilities", "capabilities": [{"type": "Quantity", "name": "publish_interval", "definition": "http://qudt.org/vocab/quantitykind/Period", "label": "Publish Interval", "uom": {"code": "s"}, "value": PUBLISH_INTERVAL_SECONDS}]}],
8388
"position": {"type": "Point", "coordinates": [station["lon"], station["lat"]], "srsName": "http://www.opengis.net/def/crs/EPSG/0/4326"},

0 commit comments

Comments
 (0)