roms_tools.BoundaryForcingSource.save

roms_tools.BoundaryForcingSource.save#

BoundaryForcingSource.save(filepath: str | Path, group: bool = True, format: Literal['NETCDF4', 'NETCDF3_CLASSIC', 'NETCDF3_64BIT_OFFSET', 'NETCDF3_64BIT_DATA'] = 'NETCDF4', serialize_dask: bool | None = None) list[Path]#

Save the boundary forcing fields to one or more NetCDF files.

This method saves the dataset to disk as either a single NetCDF file or multiple files, depending on the group parameter. If group is True, the dataset is divided into subsets (e.g., monthly or yearly) based on the temporal frequency of the data, and each subset is saved to a separate file.

Parameters:
  • filepath (Union[str, Path]) – The base path and filename for the output file(s). If group is True, the filenames will include additional time-based information (e.g., year or month) to distinguish the subsets.

  • group (bool, optional) – Whether to divide the dataset into multiple files based on temporal frequency. Defaults to True.

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

  • serialize_dask (bool, optional) – See roms_tools.utils.save_datasets(). Defaults to None, which resolves to False – the ordinary concurrent write under the ambient dask scheduler. Pass True to force the serialized, one-task-at-a-time write instead: a manual tool for low-memory machines (it bounds peak memory to a single chunk’s footprint, which plain dask’s threaded scheduler cannot guarantee) and for troubleshooting scheduler-dependent failures.

Returns:

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