Converting the Pixel values to NaN

How can I convert pixels outside my interest area with values of -0 to NaN? @ABraun

You can define them with logical statements or a polygon and then use the mask manager to create a mask of all unwanted pixels and use these in the valid pixel expression of your band (in the properties).

Thank you for the prompt reply. Please, can you help me these logical statements? @ABraun

This is hard without knowing your data. Maybe you can share a screenshot and describe which parts you want to have removed.

The white part is in 1s. The black part in the study area is in 0s, while the black part outside the study area is in -0s. I want to convert the -0s to NaN.

The black part in the outside of the study area is the area where I make the dotted rectangle

that means all black parts have the same value?
What happens when you open the band properties and set 0 as NoData?

Only the black part in the study area have same value which is 0 but the black part outside the study area have -0 value. The NoData was set at 0 when I opened it. I have attached a screenshot.

-0 is not a valid number. Can you display all the decimals to see whether it is a very small negative number?

it is just -0.000000

Interesting, I didn’t know that negative zero existed in computers:

Why computers have two floating point zeros: +0 and -0 (johndcook.com)

Anyway, something strange is going on - @marpet @lveci any idea?

…if negative zero is equal to positive zero in certain situations but not others, I could cause strange issues. Thank you for the report @Adeola21

Any number from -0.000000499, to IEEE 754 negative zero printed with 6 digits past the period will give -0.000000… This standard requires:-0 == 0 == +0, but also provides a sign() function to distinguish between them.

How were your values that print as -0.000000 generated?

I think you are right about your analysis here because its just -0.00000…so there might be another 0499…behind it that did not show. The values that printed as -0.00000 was generated when I created masks of different landcover classes on my study area in QGIS using Raster calculator.

Can you set “band_1 >= 0” as Valid-Pixel Expression then?

I have set the Valid-Pixel Expression as “band_1 >= 0” but the -0.00000 values outside the study area still remains.

@ABraun I actually used your manuals; “SAR-based landcover classification
with Sentinel-1 GRD products”, “Time-series analysis with Sentinel-1” and “Synergetic use of radar
and optical data Combination of Sentinel-1 and Sentinel-2 and application of analysis tools”.

I got into this issue of NaN when I was trying to mask out each landcover class of my study area (Forest, Tundra, Water and Bare Ground). But I did not create the masks from the Sentinel products, I created the masks from the output of the supervised landcover classification. Am I doing the right thing there?

My sole aim is to check for changes in landcover types on my study area for a period of five years by using statistics. Please sir, is there another way you can advise me on?

Ok so in this case -0 seems to be equal to +0. :scream:

…can you try to set -0 to some value that is outside the valid data value dange, and then set that as the new data value.

Sorry I don’t think I fully understand your problem.

The problem is that the data has two kinds of zeroes and the -0 areas should be converted to No Data.

Thank you, butt his is the part I understood.

I was confused about this, maybe @Adeola21 can clarify.

To me it looks like the confusion between the inner and the outer part has already happened one step before the binarization of the image.