Skip to content

Commit

Permalink
relax checks
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Apr 16, 2024
1 parent 8496e4c commit 1e87ea9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
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.5.1"
__version__ = "0.5.2"
18 changes: 15 additions & 3 deletions ai_models/outputs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import itertools
import logging
import warnings
from functools import cached_property

import climetlab as cml
Expand Down Expand Up @@ -85,8 +86,17 @@ def __init__(self, owner, output, hindcast_reference_year, **kwargs):
self.hindcast_reference_year = int(hindcast_reference_year)

def write(self, *args, **kwargs):
assert "hdate" not in kwargs, kwargs
assert "date" not in kwargs, kwargs
if "hdate" in kwargs:
warnings.warn(
f"Ignoring hdate='{kwargs['hdate']}' in write call", stacklevel=3
)
kwargs.pop("hdate")

if "date" in kwargs:
warnings.warn(
f"Ignoring date='{kwargs['date']}' in write call", stacklevel=3
)
kwargs.pop("date")

date = kwargs["template"]["date"]
hdate = kwargs["template"]["hdate"]
Expand All @@ -107,7 +117,9 @@ def write(self, *args, **kwargs):
kwargs["referenceDate"] = referenceDate
kwargs["hdate"] = date

return self.output.write(*args, check=True, **kwargs)
kwargs.setdefault("check", True)

return self.output.write(*args, **kwargs)


class NoneOutput:
Expand Down

0 comments on commit 1e87ea9

Please sign in to comment.