- class Raster(dtcc_model.model.Model)[source]
A georeferenced n-dimensional raster of values.
This class represents a georeferenced n-dimensional raster of values, where data is a NumPy array of shape (height, width, channels) or (height, width) if channels is 1.
Public members¶
-
nodata : float =
nan
-
crs : str =
''
- property shape
Get the shape of the raster data.
- property height
Get the height (number of rows) of the raster data.
- property width
Get the width (number of columns) of the raster data.
- property channels
Get the number of channels in the raster data.
- property bounds
Get the spatial bounds of the raster.
- calculate_bounds()[source]
Calculate the spatial bounds of the raster.
- property cell_size
Get the cell size (pixel size) of the raster.
- property min
Get the minimum value of the raster.
- property max
Get the maximum value of the raster.
- from_proto(pb: Raster | bytes)[source]
Initialize the Raster object from a protobuf representation.
- Raster(data: ~numpy.ndarray = <factory>, ...)
Initialize self. See help(type(self)) for accurate signature.
- __repr__()
Return repr(self).
- __eq__(other)
Return self==value.
- fill_holes()
Fill nodata holes in a Raster object using the nearest neighbour.
-
resample(cell_size=
None
, scale=None
, method='bilinear'
) Resample a Raster object to a new cell size or scale.
-
stats(polygons: Polygon | list[Polygon], stats=
['mean']
) Compute statistics for a raster within a polygon.
- burn_polygons(poly_values: tuple, ...) Raster
Burn polygons into a raster.
- slope_aspect() tuple[Raster, Raster]
-
TPI(window_size=
3
) Compute the Topographic Position Index (TPI) of a DEM.
-
VRM(window_size=
3
) Compute the Vector Ruggedness Measure (VRM) of a DEM.
- to_pointcloud() PointCloud
Convert a raster to a point cloud. The points will be in the center of each cell.
- view()
View a raster in 3D with a GLFW window.
- data : ndarray
- georef : Affine
- to_json() str
Return a JSON representation of the object.
-
classmethod add_methods(module, name=
None
) Adds methods from a module or function to the class.
-
classmethod print_methods(verbose=
False
) Print the methods that have been added to the class.
-
nodata : float =