I am currently using Sentinel-2-data that are further processed with the C2RCC S2-MSI processor. Working with these data, I had problems handling the c2rcc_flags band in R, which I currently use to analyze the data.
When I tried to convert the numerical values of the c2rcc_flag band to the corresponding Boolean flag values, R showed this warning message:
”In intToBits(number) : NAs introduced by coercion to integer range”
As far as I know, R still stores integers in 32bit signed integer format with a maximum value of 2147483647. The value of a valid pixel expression (Valid_PE) exceeds this limit (2147483648) and therefore causes problems in R. I know there are possible workarounds for that problem in R and of course, this is a specification in ESA SNAP not R, but is there a possibility to assign a different value / bit to the Valid_PE flag (maybe to 1)?
Particularly, because this “problem” also somewhat applies to SNAP itself:
Here, the output of the Pixel Extraction tool for one of my Sentinel 2 scenes is shown. I extracted the values of pixels where a second flag besides the valid pixel expression is activated (Adet_at_min, Agelb_at_min). Only some of the columns are shown. Additionally, I included the original value of the pixel at hand.
As one can see, the output value for the c2rcc_flags band is somewhat capped at 2147483647, regardless of the original value. Nevertheless, the flags are read out correctly, which is somewhat confusing if one is looking at the results. I guess, this problem could be solved if another value would be assigned to the VALID_PE flag.
Note: I used SNAP 4.0 for this example, but newer versions of SNAP still seemed to face the issue.