Skip to content

Commit fe6523c

Browse files
committed
fix: allow no forecast variable
1 parent ca3cb5c commit fe6523c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/stactools/met_office_deterministic/href.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def duration(self) -> str | None:
119119
return None
120120

121121
@property
122-
def variable(self) -> str:
122+
def variable(self) -> str | None:
123123
"""The CF-standard name for this parameter."""
124124
match self.parameter:
125125
case "cloud_amount_of_total_cloud":
@@ -274,7 +274,7 @@ def variable(self) -> str:
274274
case "landsea_mask":
275275
return "land_binary_mask"
276276
case _:
277-
raise ValueError(f"Unknown parameter: {self.parameter}")
277+
return None
278278

279279
def __str__(self) -> str:
280280
"""Returns the href as a string.

src/stactools/met_office_deterministic/stac.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ def _create_item(
152152

153153

154154
def _create_asset(href: Href) -> tuple[str, Asset]:
155-
extra_fields = {
156-
"forecast:variable": href.variable,
157-
}
155+
extra_fields = {}
156+
if variable := href.variable:
157+
extra_fields["forecast:variable"] = variable
158158
if href.duration:
159159
extra_fields["forecast:duration"] = href.duration
160160
item_assets = _get_item_assets(href.model, href.theme)

0 commit comments

Comments
 (0)