mpas_tools.io.open_mfdataset

mpas_tools.io.open_mfdataset(paths, engine=None, logger=None, **kwargs)[source]

Open a multi-file xarray.Dataset from NetCDF files, accounting for quirks specific to MPAS components. This is a thin wrapper around xarray.open_mfdataset() that selects the NetCDF engine from mpas_tools.io.default_engine when engine is not given.

See mpas_tools.io.open_dataset() for why specifying an engine explicitly (via mpas_tools.io.default_engine) is useful for NETCDF3_64BIT_DATA (CDF5) files.

Parameters:
  • paths (str or sequence of str or path-like) – The paths to the NetCDF files to open, passed on to xarray.open_mfdataset()

  • engine ({'netcdf4', 'scipy', 'h5netcdf'}, optional) – The library to use for reading the NetCDF files. The default is mpas_tools.io.default_engine, which can be modified but which defaults to None (xarray auto-selects the backend)

  • logger (logging.Logger, optional) – A logger to write messages to. Reserved for future diagnostics; no error recovery is performed because the CDF5 backend-sniffing failure is a hard crash that cannot be caught.

  • **kwargs – Additional keyword arguments passed on to xarray.open_mfdataset() (e.g. combine, concat_dim, decode_times)

Returns:

ds (xarray.Dataset) – The opened dataset