xdem.DEM.from_array

Contents

xdem.DEM.from_array#

classmethod DEM.from_array(data, transform, crs, nodata=None, area_or_point=None, tags=None, cast_nodata=True, vcrs=None)[source]#

Create a DEM from a numpy array and the georeferencing information.

Parameters:
  • data (ndarray[Any, dtype[floating[Any]]] | MaskedArray[Any, dtype[floating[Any]]]) – Input array.

  • transform (tuple[float, ...] | Affine) – Affine 2D transform. Either a tuple(x_res, 0.0, top_left_x, 0.0, y_res, top_left_y) or an affine.Affine object.

  • crs (CRS | int | None) – Coordinate reference system. Either a rasterio CRS, or an EPSG integer.

  • nodata (int | float | None) – Nodata value.

  • area_or_point (Optional[Literal['Area', 'Point']]) – Pixel interpretation of the raster, will be stored in AREA_OR_POINT metadata.

  • tags (dict[str, Any]) – Metadata stored in a dictionary.

  • cast_nodata (bool) – Automatically cast nodata value to the default nodata for the new array type if not compatible. If False, will raise an error when incompatible.

  • vcrs (Union[Literal['Ellipsoid'], Literal['EGM08'], Literal['EGM96'], VerticalCRS, str, Path, int, None]) – Vertical coordinate reference system.

Return type:

DEM

Returns:

DEM created from the provided array and georeferencing.