Skip to content

Commit

Permalink
fix/Issues identified when running with cascade (#59)
Browse files Browse the repository at this point in the history
* Add prognostic_variables to checkpoint

* Add default device in line with config

* Add deepcopy to frozendict
  • Loading branch information
HCookie authored Nov 28, 2024
1 parent 30b9c1f commit dd86f49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/anemoi/inference/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def typed_variables(self):
def diagnostic_variables(self):
return self._metadata.diagnostic_variables

@property
def prognostic_variables(self):
return self._metadata.prognostic_variables

@property
def prognostic_output_mask(self):
return self._metadata.prognostic_output_mask
Expand Down
4 changes: 4 additions & 0 deletions src/anemoi/inference/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def _remove_full_paths(x):


class frozendict(dict):
def __deepcopy__(self, memo):
# As this is a frozendict, we can return the same object
return self

def __setitem__(self, key, value):
raise TypeError("frozendict is immutable")

Expand Down
4 changes: 2 additions & 2 deletions src/anemoi/inference/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(
checkpoint,
*,
accumulations=True,
device: str,
device: str = "cuda",
precision: str = None,
report_error=False,
allow_nans=None, # can be True of False
Expand Down Expand Up @@ -116,7 +116,7 @@ def run(self, *, input_state, lead_time):

lead_time = to_timedelta(lead_time)

# This may be used but Ouput objects to compute the step
# This may be used but Output objects to compute the step
self.lead_time = lead_time
self.time_step = self.checkpoint.timestep

Expand Down

0 comments on commit dd86f49

Please sign in to comment.