Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for model to set GRIB edition #67

Merged
merged 1 commit into from
Dec 9, 2024
Merged
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
5 changes: 3 additions & 2 deletions src/ai_models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Model:
assets_extra_dir = None
retrieve = {} # Extra parameters for retrieve
version = 1 # To be overriden in subclasses
grib_edition = 2 # Default GRIB edition
grib_extra_metadata = {} # Extra metadata for grib files

param_level_ml = ([], []) # param, level
Expand Down Expand Up @@ -260,7 +261,7 @@ def _datetimes(self, dates):
assert isinstance(time, int)
if time < 100:
time *= 100
assert time in (0, 600, 1200, 1800), time
# assert time in (0, 600, 1200, 1800), time

lagged = self.lagged
if not lagged:
Expand Down Expand Up @@ -300,7 +301,7 @@ def datetimes(self, step=0):
if time < 100:
time *= 100

assert time in (0, 600, 1200, 1800), time
# assert time in (0, 600, 1200, 1800), time

full = datetime.datetime(
date // 10000,
Expand Down
2 changes: 1 addition & 1 deletion src/ai_models/outputs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, owner, path, metadata, **kwargs):

@cached_property
def grib_keys(self):
edition = self.metadata.pop("edition", 2)
edition = self.metadata.pop("edition", self.owner.grib_edition)

_grib_keys = dict(
edition=edition,
Expand Down
Loading