chunk_dataset_space_only#

mhm_tools.common.file_handler.chunk_dataset_space_only(ds: Dataset, available_mem_gib: float, var_name: str | None = None) Dict[str, int][source]#

Chunk only in space (lat/lon), leaving time whole, sized to available memory.

  • Uses 80% of available_mem_gib for a single chunk.

  • Computes how many total cells (t * y * x) fit, then allocates all t, and splits y/x so that t·y·x·bytes_per_cell ≤ work_bytes.

  • If no time dimension, behaves similarly with t=1.