Skip to content

Commit

Permalink
adapt forcings
Browse files Browse the repository at this point in the history
  • Loading branch information
dietervdb-meteo committed Jan 3, 2025
1 parent 66ed6f1 commit 22d0d33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/anemoi/inference/forcings.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ def __init__(self, context, input, variables, variables_mask):
self.variables_mask = variables_mask
assert isinstance(input, DatasetInput), "Currently only boundary forcings from dataset supported."
self.input = input
num_lam, num_other = input.ds.grids
self.spatial_mask = np.array([False] * num_lam + [True] * num_other, dtype=bool)
if "output_mask" in context.checkpoint._supporting_arrays:
self.spatial_mask= ~context.checkpoint.load_supporting_array("output_mask")
else:
self.spatial_mask=np.array([False] * len(input["latitudes"]) , dtype=bool)
self.kinds = dict(retrieved=True) # Used for debugging

def __repr__(self):
Expand Down
2 changes: 2 additions & 0 deletions src/anemoi/inference/inputs/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def load_forcings(self, *, variables, dates):
data = np.squeeze(data, axis=2)
# Reorder the dimensions to (variable, date, values)
data = np.swapaxes(data, 0, 1)
# apply reduction to `grid_indices`
data=data[...,self.grid_indices]
return data

def _load_dates(self, dates):
Expand Down

0 comments on commit 22d0d33

Please sign in to comment.