Skip to content

Commit

Permalink
relax check of grib encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Jan 16, 2024
1 parent d454420 commit c81b56c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ai_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

__version__ = "0.3.1"
__version__ = "0.3.2"
9 changes: 9 additions & 0 deletions ai_models/outputs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,20 @@ def write(self, *args, **kwargs):

handle, path = self.output.write(*args, **kwargs)

# Check that the GRIB keys are as expected
for key, value in itertools.chain(
self.output.grib_keys.items(), kwargs.items()
):
if key in ("template",):
continue

# If "param" is a string, we what to compare it to the shortName
if key == "param":
try:
float(value)
except ValueError:
key = "shortName"

assert str(handle.get(key)) == str(value), (key, handle.get(key), value)

return handle, path
Expand Down

0 comments on commit c81b56c

Please sign in to comment.