exactextract.raster
Classes
Source from which raster data can be read. |
|
RasterSource backed by GDAL |
|
RasterSource backed by a NumPy array |
|
RasterSource backed by rasterio |
|
RasterSource backed by xarray |
Module Contents
- class exactextract.raster.RasterSource[source]
Source from which raster data can be read.
A RasterSource provides the ability to read subsets of a single band of raster data. Several implementations are included in exactextract:
- class exactextract.raster.GDALRasterSource(ds, band_idx: int = 1, *, name=None)[source]
RasterSource backed by GDAL
- Parameters:
ds – A
gdal.Dataset
or path from which one can be openedband_idx – 1-based numerical index of band to read
name – source name, to be used in generating field names for results
- class exactextract.raster.NumPyRasterSource(mat, xmin=None, ymin=None, xmax=None, ymax=None, *, nodata=None, name=None, srs_wkt=None)[source]
RasterSource backed by a NumPy array
Create a RasterSource that references a NumPy array.
If spatial extent arguments are not provided, the extent will be assumed to be from (0,0) to (nx,ny).
- Parameters:
mat – a two-dimensional NumPy array. Masked arrays are supported.
xmin – x coordinate of left edge
ymin – y coordinate of bottom edge
xmax – x coordinate of right edge
ymax – y coordinate of top edge
nodata – Optional value used to indicate missing data.
name – source name, to be used in generating field names for results
srs_wkt – WKT string indicating the spatial reference system.
- class exactextract.raster.RasterioRasterSource(ds, band_idx=1, *, name=None)[source]
RasterSource backed by rasterio
- Parameters:
ds – A
rasterio.DatasetReader
or path from which one can be openedband_idx – 1-based numerical index of band to read
name – source name, to be used in generating field names for results
- class exactextract.raster.XArrayRasterSource(ds, band_idx=1, *, name=None)[source]
RasterSource backed by xarray
The rio-xarray extension is used to retrieve metadata such as the array extent, resolution, and spatial reference system.
- Parameters:
ds – An xarray
DataArray
or a path from which one can be read.band_idx – 1-based numerical index of band to read
name – source name, to be used in generating field names for results