Skip to content

Commit

Permalink
Fixing chunk sizes in zarr output
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvansebille committed Dec 22, 2023
1 parent ab4dde1 commit 0f4c31d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parcels/particlefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _extend_zarr_dims(self, Z, store, dtype, axis):
if len(obs) == Z.shape[1]:
obs.append(np.arange(self.chunks[1])+obs[-1]+1)
else:
extra_trajs = max(self.maxids - Z.shape[0], self.chunks[0])
extra_trajs = self.maxids - Z.shape[0]
if len(Z.shape) == 2:
a = np.full((extra_trajs, Z.shape[1]), self.fill_value_map[dtype], dtype=dtype)
else:
Expand Down Expand Up @@ -233,7 +233,7 @@ def write(self, pset, time, indices=None):
if (self.maxids > len(ids)) or (self.maxids > self.chunks[0]):
arrsize = (self.maxids, self.chunks[1])
else:
arrsize = (len(ids), 1)
arrsize = (len(ids), self.chunks[1])
ds = xr.Dataset(attrs=self.metadata, coords={"trajectory": ("trajectory", pids),
"obs": ("obs", np.arange(arrsize[1], dtype=np.int32))})
attrs = self._create_variables_attribute_dict()
Expand Down

0 comments on commit 0f4c31d

Please sign in to comment.