roms_tools.tiling.partition.partition_netcdf

roms_tools.tiling.partition.partition_netcdf#

roms_tools.tiling.partition.partition_netcdf(filepath: str | Path | Sequence[str | Path], np_eta: int = 1, np_xi: int = 1, output_dir: str | Path | None = None, include_coarse_dims: bool = True, format: Literal['NETCDF4', 'NETCDF3_CLASSIC', 'NETCDF3_64BIT_OFFSET', 'NETCDF3_64BIT_DATA'] = 'NETCDF4') list[Path]#

Partition one or more ROMS NetCDF files into smaller spatial tiles and save them to disk.

This function divides each dataset into np_eta by np_xi tiles. Each tile is saved as a separate NetCDF file.

Parameters:
  • filepath (str | Path | Sequence[str | Path]) – A path or list of paths to input NetCDF files.

  • np_eta (int, optional) – The number of partitions along the eta direction. Must be a positive integer. Default is 1.

  • np_xi (int, optional) – The number of partitions along the xi direction. Must be a positive integer. Default is 1.

  • output_dir (str | Path | None, optional) – Directory or base path to save partitioned files. If None, files are saved alongside the input file.

  • include_coarse_dims (bool, optional) – Whether to include coarse grid dimensions (eta_coarse, xi_coarse) in the partitioning. If False, these dimensions will not be split. Relevant if none of the coarse resolution variables are actually used by ROMS. Default is True.

  • format ({"NETCDF4", "NETCDF3_CLASSIC", "NETCDF3_64BIT_OFFSET", "NETCDF3_64BIT_DATA"}, optional) – NetCDF file format. Defaults to "NETCDF4".

Returns:

list[Path] – A list of Path objects for the filenames that were saved.