uxarray.open_grid#

uxarray.open_grid(grid_filename_or_obj, gridspec=None, vertices=None, islatlon=False, isconcave=False, use_dual=False, **kwargs)#

Creates a uxarray.Grid object from a grid topology definition.

Parameters
  • grid_filename_or_obj (string, xarray.Dataset, ndarray, list, tuple, required) – String or Path object as a path to a netCDF file or an OpenDAP URL that stores the unstructured grid topology/definition. It is read similar to filename_or_obj in xarray.open_dataset. Otherwise, either xr.DataArray, np.ndarray, list, or tuple as a vertices object to define the grid.

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

  • isconcave (bool, optional) – Specify if this grid has concave elements (internal checks for this are possible)

  • gridspec (str, optional) – Specifies gridspec

  • vertices (bool, optional) – Whether to create grid from vertices

  • source_grid (str, optional) – Path or URL to the source grid file. For diagnostic/reporting purposes only.

  • 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

  • **kwargs (Dict[str, Any]) – 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

uxgrid – Initialized Grid Object from Input Grid File

Return type

uxarray.Grid

Examples

Open dataset with a grid topology file

>>> import uxarray as ux
>>> uxgrid = ux.open_grid("grid_filename.g")