geoutils.Raster.astype

Contents

geoutils.Raster.astype#

Raster.astype(dtype, convert_nodata=True, inplace=False)[source]#
Overloads:
  • self (RasterType), dtype (DTypeLike), convert_nodata (bool), inplace (Literal[False]) → RasterType

  • self (RasterType), dtype (DTypeLike), convert_nodata (bool), inplace (Literal[True]) → None

  • self (RasterType), dtype (DTypeLike), convert_nodata (bool), inplace (bool) → RasterType | None

Convert data type of the raster.

By default, converts the nodata value to the default of the new data type.

Parameters:
  • dtype (DTypeLike) – Any numpy dtype or string accepted by numpy.astype.

  • convert_nodata (bool) – Whether to convert the nodata value to the default of the new dtype.

  • inplace (bool) – Whether to modify the raster in-place.

Returns:

Raster with updated dtype (or None if inplace).