From 0333dff59883342a7cb027de87d3b55eceeb7029 Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Thu, 5 Dec 2024 14:29:09 +0100 Subject: [PATCH] Update default value of particlefile chunks to length of pset This fixes a bug where zarr output file writing can be _very_ slow when only one particle is released on the first day of simulation (since the default chunksize was set to the number of particles to write the first time, instead of the length of the ParticleSet) --- parcels/particlefile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parcels/particlefile.py b/parcels/particlefile.py index 4ab406b4a..993fd448c 100644 --- a/parcels/particlefile.py +++ b/parcels/particlefile.py @@ -304,7 +304,7 @@ def write(self, pset, time: float | timedelta | np.timedelta64 | None, indices=N if self.create_new_zarrfile: if self.chunks is None: - self._chunks = (len(ids), 1) + self._chunks = (len(pset), 1) if pset._repeatpclass is not None and self.chunks[0] < 1e4: # type: ignore[index] warnings.warn( f"ParticleFile chunks are set to {self.chunks}, but this may lead to "