# 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.

â€¦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.