Export one SLURM-array chunk of a multi-temporal patch cube to Zarr, resumable across restarts.
Parameters
Name
Type
Description
Default
patches
Full list of patch descriptors (dicts). Each dict must contain a unique, stable "id" key (used for checkpointing) plus whatever fetch_fn needs to locate the patch (an ROI, a tile id, …). The same list should be passed unchanged on every array task and on resume – array_idx/array_size slice it deterministically.
required
fetch_fn
Called as fetch_fn(patch) for each patch not yet checkpointed. Must return a list of 0..max_timesteps dicts, most-recent (or highest-quality) first, each with: * "array" – array of shape (n_bands, patch_size, patch_size). * any other JSON-serializable scalar fields (item id, acquisition time, cloud cover, …) – these are merged into the per-patch meta JSON verbatim. An empty list means “no usable scenes for this patch”; it is logged and skipped (not treated as an error). An exception stops the task; re-running it resumes after the last logged patch.
required
out_dir
Output directory (created if missing).
required
split_name
e.g. "train" / "val" / "test". Used in output filenames.
required
n_bands
Fixed cube geometry – must be the same across all array tasks for a given split so the merge step can concatenate cleanly.
required
max_timesteps
Fixed cube geometry – must be the same across all array tasks for a given split so the merge step can concatenate cleanly.
required
patch_size
Fixed cube geometry – must be the same across all array tasks for a given split so the merge step can concatenate cleanly.
required
dtype
Storage dtype for images. The default "float32" matches the GeoTIFFs written by the fetch step and keeps NaN no-data. Integer dtypes (e.g. "uint16" for raw digital numbers) halve the size but cannot hold NaN, so a scene containing NaN raises.
'float32'
array_idx
SLURM-array partitioning. With array_size > 1 this task only processes its contiguous np.array_split share of patches and writes to {split}_chunk{array_idx:04d}.zarr. With the default array_size=1 it writes directly to {split}.zarr.
0
array_size
SLURM-array partitioning. With array_size > 1 this task only processes its contiguous np.array_split share of patches and writes to {split}_chunk{array_idx:04d}.zarr. With the default array_size=1 it writes directly to {split}.zarr.
0
grow_by
Zarr array pre-allocation grows in blocks of this many patches to avoid a resize on every single write.
500
per_step_meta_bytes
Passed through to the meta-array sizing helper; raise this if your per-timestep metadata fields are unusually large.