uxarray.open_grid#
- uxarray.open_grid(grid_filename_or_obj, latlon=False, use_dual=False, **kwargs)#
Constructs and returns an
uxarray.Grid
object from a grid topology definition.- Parameters:
grid_filename_or_obj (string, xarray.Dataset, ndarray, list, tuple, dict, 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
inxarray.open_dataset
. Otherwise, eitherxr.DataArray
,np.ndarray
,list
, ortuple
as a vertices object to define the grid.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
**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:
Examples
Open dataset with a grid topology file
>>> Import uxarray as ux >>> uxgrid = ux.open_grid("grid_filename.g")