Skip to content

Commit 95c23ae

Browse files
authored
fix: netcdf incorrect shape when using extract post-processors (#346)
## Description Ensure data is post processed before open. ## What problem does this change solve? Closes #341
1 parent 8078a89 commit 95c23ae

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

src/anemoi/inference/outputs/netcdf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ def open(self, state: State) -> None:
112112
with LOCK:
113113
self.ncfile = Dataset(self.path, "w", format="NETCDF4")
114114

115+
state = self.post_process(state)
116+
115117
compression = {} # dict(zlib=False, complevel=0)
116118

117119
values = len(state["latitudes"])

src/anemoi/inference/outputs/plot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def write_step(self, state: State) -> None:
144144
ekd.ArrayField(
145145
values,
146146
{
147+
"param": param,
147148
"shortName": param,
148149
"variable_name": param,
149150
"step": state["step"],

src/anemoi/inference/outputs/tee.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def open(self, state: State) -> None:
103103
state : State
104104
The state dictionary.
105105
"""
106+
state = self.post_process(state)
107+
106108
for output in self.outputs:
107109
output.open(state)
108110

src/anemoi/inference/outputs/zarr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def open(self, state: State) -> None:
160160
else:
161161
self.zarr_group = zarr.open_group(self.zarr_store, mode="w")
162162

163+
state = self.post_process(state) # make sure state is post-processed
163164
values = len(state["latitudes"])
164165

165166
time = 0

0 commit comments

Comments
 (0)