Bitmask and flags - OLCI

Post Reply
patilla7
Posts: 5
Joined: Wed Apr 17, 2019 9:37 am
company / institution: University of Valencia
Location: Spain

Bitmask and flags - OLCI

Post by patilla7 »

Hi François, I hope you are doing well.

I am new to Python and to POLYMER. I am working on OLCI-Rrs validation in CASE 2 - inland waters, but I am having trouble understanding and applying the flags. I took a look at the common.py script to understand the value of each flag, but I do not understand where the value of 1023 for the BITMASK_REJECT in the params.py script is coming from:

# BITMASK
# (see common.py for bitmask definition)
# no product (NaN) in case of...
self.BITMASK_INVALID = 1+2+4+32+512

# recommended pixek rejection test: (bitmask & BITMASK_REJECT) != 0
self.BITMASK_REJECT = 1023

Furthermore, according to the script above, it says there is a recommended pixel rejection expression, but the parameter BITMASK_REJECT is not that expression, but a value. Could you please tell me if I need to modify the value of BITMASK_REJECT to set the expression? If yes, how can I modify it?

Thanks in advance,
Patricia
User avatar
fsteinmetz
Site Admin
Posts: 306
Joined: Fri Sep 07, 2018 1:34 pm
company / institution: Hygeos
Location: Lille, France
Contact:

Re: Bitmask and flags - OLCI

Post by fsteinmetz »

Dear Patricia,

BITMASK_INVALID is an internal mask, and corresponds to the bits in "bitmask", that lead to an empty product (presence of NaN values).

BITMASK_REJECT is the value (1023) included in the recommended expression that you should apply on the resulting products to filter out pixels that may be of reduced quality, but are still provided in the output for checking. The expression corresponding to invalid pixels is "bitmask & 1023 != 0", where "&" is the "binary and" operator. The value 1023 corresponds to any of the first 10 bits of the bitmask value. In other words, what is recommended here is to reject a pixel when any of the first 10 bits of bitmask, is raised. After these 10 bits, the others bits are informational.
Note that this value is not used in the code, and is just a recommendation for filtering pixels a posteriori.

I hope this clarifies.
Cheers, François
Post Reply