netcdf

Reads netcdf files into an xarray.Dataset

Source code

General Attributes and Methods

IceAdvect.io.netcdf.open_mfdataset(filenames: list[str] | list[Path], parallel: bool = False, **kwargs)[source]

Open multiple netCDF4 files

Parameters:
filenames: list of str or pathlib.Path

list of files

parallel: bool, default False

Open files in parallel using dask.delayed

kwargs: dict

additional keyword arguments for opening files

Returns
——-
ds: xarray.Dataset

xarray Dataset

IceAdvect.io.netcdf.open_dataset(filename: str, mapping: dict | None = None, chunks: int | dict | str | None = None, **kwargs) Dataset[source]

Open a netCDF4 file as an xarray Dataset and remap variables

Parameters:
filename: str

Path to netCDF4 file

mapping: dict or None, default None

Dictionary mapping standard variable names to those in the file

chunks: int, dict, str, or None, default None

variable chunk sizes for dask (see xarray.open_dataset)

Returns:
ds: xr.Dataset

xarray Dataset