Skip to content

Commit

Permalink
Add more keys to maybe missing mars keys
Browse files Browse the repository at this point in the history
  • Loading branch information
gmertes committed Jan 8, 2025
1 parent 6c0e49a commit c2c2a1a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/anemoi/inference/outputs/gribfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@

LOG = logging.getLogger(__name__)

# There is a bug with hindcasts, where these keys are not added to the 'mars' namespace
MARS_MAYBE_MISSING_KEYS = (
"number",
"step",
"time",
"date",
"hdate",
"type",
"stream",
"expver",
"class",
"levtype",
"levelist",
"param",
)


class ArchiveCollector:
"""Collects archive requests"""
Expand Down Expand Up @@ -129,7 +145,7 @@ def collect_archive_requests(self, written, template, **keys):
mars = handle.as_namespace("mars")

# There is a bug with hincasts, where the 'number' is not added to the 'mars' namespace
for key in ("number",):
for key in MARS_MAYBE_MISSING_KEYS:
if key in keys and key not in mars:
mars[key] = keys[key]
warnings.warn(f"collect_archive_requests: missing key {key} in 'mars' namespace, using {keys[key]}")
Expand Down

0 comments on commit c2c2a1a

Please sign in to comment.