uxarray.open_dataset#
- uxarray.open_dataset(grid_filename_or_obj, filename_or_obj, chunks=None, chunk_grid=True, use_dual=False, grid_kwargs=None, **kwargs)#
Wraps
xarray.open_dataset()
for loading in a dataset paired with a grid file.- Parameters:
grid_filename_or_obj (str | os.PathLike[Any] | dict | xr.dataset) – Strings and Path objects are interpreted as a path to a grid file. Xarray Datasets assume that each member variable is in the UGRID conventions and will be used to create a
ux.Grid
. Simiarly, a dictionary containing UGRID variables can be used to create aux.Grid
filename_or_obj (str | os.PathLike[Any]) – String or Path object as a path to a netCDF file or an OpenDAP URL that stores the actual data set. It is the same
filename_or_obj
inxarray.open_dataset
.chunks (int, dict, 'auto' or None, default: None) –
If provided, used to load the grid into dask arrays. -
chunks="auto"
will use daskauto
chunking taking into account theengine preferred chunks.
chunks=None
skips using dask, which is generally faster for small arrays.chunks=-1
loads the data with dask using a single chunk for all arrays.chunks={}
loads the data with dask using the engine’s preferred chunk size, generally identical to the format’s chunk size. If not available, a single chunk for all arrays.
chunk_grid (bool, default: True) – If valid chunks are passed in, determines whether to also apply the same chunks to the attached
Grid
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, optional) – Additional arguments passed on to
ux.open_grid
when opening up a Grid File.**kwargs – Additional arguments passed on to
xarray.open_dataset
. Refer to the [xarray docs](https://xarray.pydata.org/en/stable/generated/xarray.open_dataset.html) for accepted keyword arguments.
- Returns:
uxds – Dataset with linked uxgrid property of type Grid.
- Return type:
Examples
Open a dataset with a grid file and data file >>> import uxarray as ux >>> ux_ds = ux.open_dataset(“grid_file.nc”, “data_file.nc”)