geoutils.Raster.astype#
- Raster.astype(dtype, convert_nodata=True, inplace=False)[source]#
Convert data type of the raster.
By default, converts the nodata value to the default of the new data type.
- Parameters:
dtype (
Union
[dtype
[Any
],None
,type
[Any
],_SupportsDType
[dtype
[Any
]],str
,tuple
[Any
,int
],tuple
[Any
,Union
[SupportsIndex
,Sequence
[SupportsIndex
]]],list
[Any
],_DTypeDict
,tuple
[Any
,Any
]]) – 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.
- Return type:
- Returns:
Raster with updated dtype (or None if inplace).