API

xarray_pickler.xarray_pickler.open_dset(dpath, force_repickle=False, **kwargs)[source]

Open xarray.Dataset object. If previously pickled, it will be opened from the pickle file stored in the cache. Otherwise, it will be pickled and stored in the cache, if a cache is specified, after it is opened using xarray.open_mfdataset() with any extra keyword arguments specified. If there is no writeable pickle directory specified in the config, and the pickle does not already exist, the dataset will just be opened using xarray and returned.

Parameters
  • (str) (dpath) – Directory path to netCDF files to generate dataset from e.g. “/badc/cmip6/data/CMIP6/CMIP/IPSL/IPSL-CM6A-LR/historical/r1i1p1f1/Amon/rlds/gr/v20180803”

  • force_repickle – If True, the xarray.Dataset object will be repickled, if a writeable pickle directory is specified in the config. Default is False.

  • **kwargs

    Other keyword arguments that can be used in xarray.open_mfdataset(). Used only the first time a dataset is pickled or if force_repickle=True.

Returns

xarray.Dataset object