Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion fmiopendata/multipoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def _parse_names_and_units(xml):
try:
url = field.attrib[wfs.LINK]
root = ET.fromstring(read_url(url))
name = root.findtext(wfs.OMOP_LABEL)
# fallback to something if OMOP label is not found
# this happens when FMI has not provided proper metadata for a field
name = root.findtext(wfs.OMOP_LABEL) or typ
try:
units = root.find(wfs.OMOP_UOM).attrib["uom"]
except AttributeError:
Expand Down
25 changes: 25 additions & 0 deletions fmiopendata/tests/test_multipoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@
"endtime=" + END_TIME_OLD.isoformat(timespec="seconds") + "Z"]
ARGS_TIMESERIES = ["bbox=24,59,26,61", "timeseries=True"]

forecast_start = dt.datetime.now()
forecast_end = forecast_start + dt.timedelta(hours=1)

ARGS_FORECAST = [
"bbox=24,59,26,61",
"starttime=" + forecast_start.isoformat(timespec="seconds") + "Z",
"endtime=" + forecast_end.isoformat(timespec="seconds") + "Z",
"place=Helsinki",
"parameters=PoP", # PoP is missing metadata as of September 2025
]


def test_multipoint_mareograph_default():
"""Test multipoint coverage parser for default query of mareograph data."""
Expand Down Expand Up @@ -124,3 +135,17 @@ def test_multipoint_radionuclide():
res = download_and_parse("stuk::observations::air::radionuclide-activity-concentration::latest::multipointcoverage",
args=ARGS)
_verify_multipoint_common(res)


def test_multipoint_missing_metadata_for_field():
from fmiopendata.multipoint import download_and_parse

res = download_and_parse(
"fmi::forecast::edited::weather::scandinavia::point::multipointcoverage",
args=ARGS_FORECAST,
)

for step, step_data in res.data.items():
for loc, data in step_data.items():
keys = data.keys()
assert None not in keys, f"None in parsed keys {keys} for {step} and {loc}"