def save_dataset(ds: xr.Dataset, file: str, format: str = None): """ Save a dataset to NetCDF file. :param ds: The dataset :param file: File path :param format: NetCDF format flavour, one of 'NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'. """ ds.to_netcdf(file, format=format)
def save_dataset(ds: xr.Dataset, file: str, format: str = None, monitor: Monitor = Monitor.NONE): """ Save a dataset to NetCDF file. :param ds: The dataset :param file: File path :param format: NetCDF format flavour, one of 'NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'. :param monitor: a progress monitor. """ with monitor.observing("save_dataset"): ds.to_netcdf(file, format=format)