suxarray.subset package
Submodules
suxarray.subset.dataarray_accessor module
- class suxarray.subset.dataarray_accessor.DataArraySubsetAccessor(sxda)[source]
Bases:
DataArraySubsetAccessor- bounding_box_xy(x_bounds: Tuple | List | ndarray, y_bounds: Tuple | List | ndarray, element: str | None = 'nodes', predicate: str | None = 'intersects', **kwargs)[source]
- bounding_polygon(polygon: Polygon, element: str | None = 'nodes', predicate: str | None = 'intersects', use_xy: bool | None = False, **kwargs)[source]
Subsets the data array using a Shapely polygon
With a given polygon, the data array is subset. The grid indices will be reindexed.
Parameters
- polygon: shapely.geometry.Polygon
Polygon to subset the data
- element: str
Element type to subset
- predicate: str
Predicate for use with ‘intersects’, ‘within’, ‘contains’, ‘overlaps’, ‘crosses’,’touches’, ‘covers’, ‘covered_by’, ‘contains_properly’, ‘dwithin’ form Shapely STRTree.query.
- use_xy: bool
If True, the polygon is assumed to be in the x-y plane. Default is False.
Returns
- SxDataArray
Subsetted suxarray data array
- property sxda: SxDataArray
suxarray.subset.grid_accessor module
- class suxarray.subset.grid_accessor.GridSubsetAccessor(sxgrid: Grid)[source]
Bases:
GridSubsetAccessor- bounding_polygon(polygon: Polygon, element: str | None = 'nodes', predicate: str | None = None, **kwargs)[source]
Subsets an unstructured grid between two latitude and longitude points which form a bounding box.
Parameters
- polygon: shapely.geometry.Polygon
Polygon for use with coords comparison
- element: str
Element for use with coords comparison, one of nodes, face, or edge
- predicate: str
Predicate for use with ‘intersects’, ‘within’, ‘contains’, ‘overlaps’, ‘crosses’,’touches’, ‘covers’, ‘covered_by’, ‘contains_properly’, ‘dwithin’ form Shapely STRTree.query.
Module contents
- class suxarray.subset.DataArraySubsetAccessor(sxda)[source]
Bases:
DataArraySubsetAccessor- bounding_box_xy(x_bounds: Tuple | List | ndarray, y_bounds: Tuple | List | ndarray, element: str | None = 'nodes', predicate: str | None = 'intersects', **kwargs)[source]
- bounding_polygon(polygon: Polygon, element: str | None = 'nodes', predicate: str | None = 'intersects', use_xy: bool | None = False, **kwargs)[source]
Subsets the data array using a Shapely polygon
With a given polygon, the data array is subset. The grid indices will be reindexed.
Parameters
- polygon: shapely.geometry.Polygon
Polygon to subset the data
- element: str
Element type to subset
- predicate: str
Predicate for use with ‘intersects’, ‘within’, ‘contains’, ‘overlaps’, ‘crosses’,’touches’, ‘covers’, ‘covered_by’, ‘contains_properly’, ‘dwithin’ form Shapely STRTree.query.
- use_xy: bool
If True, the polygon is assumed to be in the x-y plane. Default is False.
Returns
- SxDataArray
Subsetted suxarray data array
- property sxda: SxDataArray
- class suxarray.subset.GridSubsetAccessor(sxgrid: Grid)[source]
Bases:
GridSubsetAccessor- bounding_polygon(polygon: Polygon, element: str | None = 'nodes', predicate: str | None = None, **kwargs)[source]
Subsets an unstructured grid between two latitude and longitude points which form a bounding box.
Parameters
- polygon: shapely.geometry.Polygon
Polygon for use with coords comparison
- element: str
Element for use with coords comparison, one of nodes, face, or edge
- predicate: str
Predicate for use with ‘intersects’, ‘within’, ‘contains’, ‘overlaps’, ‘crosses’,’touches’, ‘covers’, ‘covered_by’, ‘contains_properly’, ‘dwithin’ form Shapely STRTree.query.