suxarray.grid package

Submodules

suxarray.grid.area module

suxarray.grid.grid module

class suxarray.grid.grid.Grid(grid_obj: Dataset | Grid, ds_sgrid_info: Dataset | None = None, source_grid_spec: str = 'UGRID', source_dims_dict: dict | None = {}, **kwargs)[source]

Bases: Grid

uxarray Grid class for SCHISM See uxarray Grid documentation for the details of the methods and properties

Examples

TBD

classmethod from_dataset(ds_out2d: Dataset, ds_zcoords: Dataset, **kwargs)[source]

Create a Grid object from a SCHISM output 2D dataset and a z-coordinate dataset

Parameters

ds_out2dxr.Dataset

SCHISM output 2D dataset

ds_sgrid_infoxr.Dataset, optional

Extra SCHISM grid information

Returns

Grid

get_strtree(elements: str | None = 'nodes')[source]
intersect(geometry: shapely.geometry.BaseGeometry, element: str | None = 'faces', **kwargs)[source]

Find intersecting elements with a Shapely geometry

Parameters

geometry: shapely.geometry.Geometry element: str, optional

Returns

int

Indices of intersecting elements

isel(**dim_kwargs)[source]

Indexes an unstructured grid along a given dimension (n_node, n_edge, or n_face) and returns a new grid.

Currently only supports inclusive selection, meaning that for cases where node or edge indices are provided, any face that contains that element is included in the resulting subset. This means that additional elements beyond those that were initially provided in the indices will be included. Support for more methods, such as exclusive and clipped indexing is in the works.

Parameters inverse_indices : Union[List[str], Set[str], bool], default=False

Indicates whether to store the original grids indices. Passing True stores the original face indices, other reverse indices can be stored by passing any or all of the following: ([“face”, “edge”, “node”], True)

**dims_kwargs: kwargs

Dimension to index, one of [‘n_node’, ‘n_edge’, ‘n_face’]

Example ——-` >> grid = ux.open_grid(grid_path) >> grid.isel(n_face = [1,2,3,4])

property sgrid_info: Dataset
sgrid_isel(**kwargs)[source]
subset

alias of GridSubsetAccessor

suxarray.grid.neighbors module

class suxarray.grid.neighbors.STRTree(grid, elements: str | None = 'nodes')[source]

Bases: object

property faces
nearest(geometry)[source]
property points
query(geometry, predicate=None, distance=None)[source]

Module contents

class suxarray.grid.Grid(grid_obj: Dataset | Grid, ds_sgrid_info: Dataset | None = None, source_grid_spec: str = 'UGRID', source_dims_dict: dict | None = {}, **kwargs)[source]

Bases: Grid

uxarray Grid class for SCHISM See uxarray Grid documentation for the details of the methods and properties

Examples

TBD

classmethod from_dataset(ds_out2d: Dataset, ds_zcoords: Dataset, **kwargs)[source]

Create a Grid object from a SCHISM output 2D dataset and a z-coordinate dataset

Parameters

ds_out2dxr.Dataset

SCHISM output 2D dataset

ds_sgrid_infoxr.Dataset, optional

Extra SCHISM grid information

Returns

Grid

get_strtree(elements: str | None = 'nodes')[source]
intersect(geometry: shapely.geometry.BaseGeometry, element: str | None = 'faces', **kwargs)[source]

Find intersecting elements with a Shapely geometry

Parameters

geometry: shapely.geometry.Geometry element: str, optional

Returns

int

Indices of intersecting elements

isel(**dim_kwargs)[source]

Indexes an unstructured grid along a given dimension (n_node, n_edge, or n_face) and returns a new grid.

Currently only supports inclusive selection, meaning that for cases where node or edge indices are provided, any face that contains that element is included in the resulting subset. This means that additional elements beyond those that were initially provided in the indices will be included. Support for more methods, such as exclusive and clipped indexing is in the works.

Parameters inverse_indices : Union[List[str], Set[str], bool], default=False

Indicates whether to store the original grids indices. Passing True stores the original face indices, other reverse indices can be stored by passing any or all of the following: ([“face”, “edge”, “node”], True)

**dims_kwargs: kwargs

Dimension to index, one of [‘n_node’, ‘n_edge’, ‘n_face’]

Example ——-` >> grid = ux.open_grid(grid_path) >> grid.isel(n_face = [1,2,3,4])

property sgrid_info: Dataset
sgrid_isel(**kwargs)[source]
subset

alias of GridSubsetAccessor