wradlib.zonalstats.ZonalDataBase#
- class wradlib.zonalstats.ZonalDataBase(src, *, trg=None, buf=0.0, crs=None, **kwargs)[source]#
Bases:
object
Base class for managing 2-dimensional zonal data.
For target polygons from either source points or source polygons. Provides the basic design for all other classes.
If no source points or polygons can be associated to a target polygon (e.g. no intersection), the created destination layer will be empty.
Data Model is built upon OGR Implementation of ESRI Shapefile
one src DataSource (named ‘src’) holding source polygons or points
one trg DataSource (named ‘trg’) holding target polygons
one dst DataSource (named ‘dst’) holding intersection polygons/points related to target polygons with attached index and weights fields
By using OGR there are no restrictions for the used source grids.
Warning
Writing shapefiles with the wrong locale settings can have impact on the type of the decimal. If problem arise use LC_NUMERIC=C in your environment.
- Parameters:
src (sequence or
str
) – sequence of source points (shape Nx2) or polygons (shape NxMx2) or ESRI Shapefile filename containing source points/polygons or DataSource objecttrg (sequence or
str
) – sequence of target polygons (shape Nx2, num vertices x 2) or ESRI Shapefile filename containing target polygons or DataSource object
- Keyword Arguments:
buf (
float
) – (same unit as coordinates) Points/Polygons will be considered inside the target if they are contained in the buffer.crs (
osgeo.osr.SpatialReference
) – OGR.SpatialReference will be used for DataSource object. src and trg data have to be in the same crs-formatsilent (
bool
) – If True no ProgressBar is shown. Defaults to False.
Examples
See ZonalData.
- property count_intersections#
Returns number of intersections
- property crs#
Returns SpatialReferenceSystem object
- property isecs#
Returns intersections
- Returns:
array (
numpy.ndarray
) – Array of Nx2 point coordinate arrays
- get_isec(idx)[source]#
Returns intersections
- Parameters:
idx (
int
) – index of target polygon- Returns:
array (
numpy.ndarray
) – Array of Nx2 point coordinate arrays
- get_source_index(idx)[source]#
Returns source indices referring to target polygon idx
- Parameters:
idx (
int
) – index of target polygon- Returns:
array (
numpy.ndarray
) – indices
|
Output source/target grid points/polygons to ESRI_Shapefile |
|
Returns intersections |
|
Returns source indices referring to target polygon idx |
|
Load source/target grid points/polygons into in-memory Shapefile |
Returns number of intersections |
|
Returns SpatialReferenceSystem object |
|
Returns intersections |