Default nodata value


amaury.dehecq@...
 

Hi,

what is the default nodata used by GDAL, and hence rasterio, for any given dtype?
For example, rasterio.warp.reproject states:
dst_nodata (int or float, optional) – The nodata value used to initialize the destination; it will remain in all areas not covered by the reprojected source. Defaults to the nodata value of the destination image (if set), the value of src_nodata, or 0 (GDAL default).

But I couldn't find anywhere in rasterio's or GDAL's documentation what was the default value for any given dtype.

Thanks,

Amaury


Idan Miara
 

Hi Amaury,

I'm not aware of any "default" nodata value per dtype in gdal.
Though, you might find the defaults in gdal_calc useful:

Idan


On Tue, 6 Jul 2021 at 15:31, <amaury.dehecq@...> wrote:

Hi,

what is the default nodata used by GDAL, and hence rasterio, for any given dtype?
For example, rasterio.warp.reproject states:
dst_nodata (int or float, optional) – The nodata value used to initialize the destination; it will remain in all areas not covered by the reprojected source. Defaults to the nodata value of the destination image (if set), the value of src_nodata, or 0 (GDAL default).

But I couldn't find anywhere in rasterio's or GDAL's documentation what was the default value for any given dtype.

Thanks,

Amaury


amaury.dehecq@...
 

Hi Idan,

thanks, that's already quite useful. This is typically the kind of default values I encounter when using GDAL in the command line indeed.

This does not match the values I find when using rasterio's reproject, when nodata is set to None, which would be, e.g.

- uint8: 255 -> ok
- uint16: 65535 -> ok

- int16: 32767 -> ok
- uint32: 999999 -> not the same

- float32: 1e20 -> not the same

- float64: 1e20 -> not the same

Amaury