uxarray.open_mfdataset

Contents

uxarray.open_mfdataset#

uxarray.open_mfdataset(grid_filename_or_obj, paths, latlon=False, use_dual=False, grid_kwargs={}, **kwargs)#

Wraps xarray.open_mfdataset() and creates a uxarray.UxDataset object, given a single grid topology file with multiple dataset paths with corresponding data.

Parameters:
  • grid_filename_or_obj (string, required) – String or Path object as a path to a netCDF file or an OpenDAP URL that stores the unstructured grid definition that the dataset belongs to. It is read similar to filename_or_obj in xarray.open_dataset.

  • paths (string, required) – Either a string glob in the form “path/to/my/files/*.nc” or an explicit list of files to open. It is the same paths in xarray.open_mfdataset.

  • latlon (bool, optional) – Specify if the grid is lat/lon based

  • use_dual (bool, optional) – Specify whether to use the primal (use_dual=False) or dual (use_dual=True) mesh if the file type is mpas

  • grid_kwargs (Dict[str, Any], optional) – Additional arguments passed on to xarray.open_dataset when opening up a Grid File. Refer to the [xarray docs](https://xarray.pydata.org/en/stable/generated/xarray.open_dataset.html) for accepted keyword arguments.

  • **kwargs (Dict[str, Any]) – Additional arguments passed on to xarray.open_mfdataset. Refer to the [xarray docs](https://xarray.pydata.org/en/stable/generated/xarray.open_mfdataset.html) for accepted keyword arguments.

Returns:

object – Dataset with the unstructured grid.

Return type:

uxarray.UxDataset

Examples

Open grid file along with multiple data files (two or more)

>>> import uxarray as ux
  1. Open from an explicit list of dataset files

>>> ux_ds = ux.open_mfdataset("grid_filename.g", "grid_filename_vortex_1.nc", "grid_filename_vortex_2.nc")
  1. Open from a string glob

>>> ux_ds = ux.open_mfdataset("grid_filename.g", "grid_filename_vortex_*.nc")