0

I have a raster with nodata values of 3.4028e+38. I want to convert the nodata to be -32768, so it is consistent with the nodata values of some other layers. I found a thread on here that indicated r.null was the best way to convert, but it doesn't seem to work for me. Why?

I am using QGIS 3.22.

Here is the raster I want to convert. Note the nodata value. : enter image description here

Then, I pass the file and the information to r.null: enter image description here

This is the output. It sets the minimum value to the value I wanted to be reserved for nodata. And then there's no nodata value at all. Why?

Sometimes it will convert to nodata, but the value will be listed as 'nan' which is not the intended value. enter image description here

2 Answers 2

1

As you probably know, 3.4028e+38 is NOT nodata. Also -32768 is not nodata. Some GIS software arbitrarily assign some very large or very small value to represent nodata. However some GIS software actually have a "nodata" representation in their raster format. The module that you mentioned, r.null is a GRASS GIS module. And in GRASS there is a true nodata (i.e. null) in the raster format. You can, using the r.null utility, choose to convert some value to null in the GRASS internal representation:

 r.null map=<your GRASS raster> setnull=3.4028e+38

Alternatively, if you have true null values in the raster, with the same module you can assign those pixels some (arbitrary) value, so:

r.null map=<your GRASS raster> null=-32768

Those two commands should do what you want.

0

Alternatively, in the raster calculator: if(raster== (-3.40282*10^38), null(), raster)

if the decimals are an issue: if(raster<= (-3.40282*10^38), null(), raster)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.