raster_tools.Raster.set_null_value#

Raster.set_null_value(value)[source]#

Sets or replaces the null value for the raster.

If there was previously no null value for the raster, one is set. If there was already a null value, then it is replaced. If the raster has an integer dtype and value is a float, the dtype will be promoted to a float dtype. If value is None, the null value is cleared. The raster data is not changed in this case.

Parameters

value (scalar or None) – The new null value for the raster. If None, the resulting raster will have no null value, i.e. the null value is cleared.

Returns

The new resulting Raster.

Return type

Raster