Basic config l2w_mask
-
- Posts: 9
- Joined: Wed May 29, 2019 6:22 pm
Basic config l2w_mask
Hello Quinten,
I came across a doubt about these two parameters:
l2w_mask=True
l2w_mask_water_parameters=True
I tried to use both with "true and false" and in both processing all the products returned the same, without any difference.
What's the difference in actually using l2w_mask true or false? And for the l2w_mask_water_parameters?
I'm extracting as parameters l2w = rhos _ *, spm_nechad2016, t_dogliotti, fai, kd490_qaasw
Example using in the first picture the l2w_mask = True and the second picture l2w_mask = False. The same, without differences... Best Regards,
I came across a doubt about these two parameters:
l2w_mask=True
l2w_mask_water_parameters=True
I tried to use both with "true and false" and in both processing all the products returned the same, without any difference.
What's the difference in actually using l2w_mask true or false? And for the l2w_mask_water_parameters?
I'm extracting as parameters l2w = rhos _ *, spm_nechad2016, t_dogliotti, fai, kd490_qaasw
Example using in the first picture the l2w_mask = True and the second picture l2w_mask = False. The same, without differences... Best Regards,
Re: Basic config l2w_mask
Hi Andressa
The effect of these keywords is rather subtle: l2w_mask determines whether a mask is computed. If it is set to True you will have a l2_flags dataset in your output file. l2w_mask_water_parameters determines whether this l2_flags dataset is used to hard mask the output data, i.e. the data values will be replaced by NaN for pixels where the mask != 0.
So there are 3 options:
1) If l2w_mask = False, nothing happens. Changing l2w_mask_water_parameters has no effect. Parameters will be provided for all pixels.
2) If l2w_mask = True and l2w_mask_water_parameters = True, a flags dataset will be computed and the output data will be removed (set to NaN) for flagged pixels.
3) If l2w_mask = True and l2w_mask_water_parameters = False, a flags dataset will be computed but no output data will be removed.
I would recommend setting both to True and only changing the masking procedure if you understand why the flags were triggered and are using/developing an alternative masking procedure. If you disable the l2w_mask or l2w_mask_water_parameters, the retrieval algorithms will be applied to non-water pixels as well, which will lead to nonsensical results ("land turbidity" and "cloud chlorophyll"
).
Hope this helps!
Quinten
The effect of these keywords is rather subtle: l2w_mask determines whether a mask is computed. If it is set to True you will have a l2_flags dataset in your output file. l2w_mask_water_parameters determines whether this l2_flags dataset is used to hard mask the output data, i.e. the data values will be replaced by NaN for pixels where the mask != 0.
So there are 3 options:
1) If l2w_mask = False, nothing happens. Changing l2w_mask_water_parameters has no effect. Parameters will be provided for all pixels.
2) If l2w_mask = True and l2w_mask_water_parameters = True, a flags dataset will be computed and the output data will be removed (set to NaN) for flagged pixels.
3) If l2w_mask = True and l2w_mask_water_parameters = False, a flags dataset will be computed but no output data will be removed.
I would recommend setting both to True and only changing the masking procedure if you understand why the flags were triggered and are using/developing an alternative masking procedure. If you disable the l2w_mask or l2w_mask_water_parameters, the retrieval algorithms will be applied to non-water pixels as well, which will lead to nonsensical results ("land turbidity" and "cloud chlorophyll"
![Surprised :o](./images/smilies/icon_e_surprised.gif)
Hope this helps!
Quinten
-
- Posts: 9
- Joined: Wed May 29, 2019 6:22 pm
Re: Basic config l2w_mask
Thanks for the answer Quinten!
I just had one more question: If I set both to "true" will the islands or aquatic plants on the surface of the water be mask? I say this for the "rhos" product.
l2w_mask_water_parameters and l2w_parameters = True affect the rhos?
This is a part of config txt that I use:
l2w_parameters=rhos_*,spm_nechad2016,t_dogliotti,fai,kd490_qaasw
l2w_mask=True
l2w_mask_wave=1600
l2w_mask_threshold=0.0215
l2w_mask_water_parameters=True
l2w_mask_negative_rhow=True
l2w_mask_cirrus=True
l2w_mask_cirrus_threshold=0.005
I just had one more question: If I set both to "true" will the islands or aquatic plants on the surface of the water be mask? I say this for the "rhos" product.
l2w_mask_water_parameters and l2w_parameters = True affect the rhos?
This is a part of config txt that I use:
l2w_parameters=rhos_*,spm_nechad2016,t_dogliotti,fai,kd490_qaasw
l2w_mask=True
l2w_mask_wave=1600
l2w_mask_threshold=0.0215
l2w_mask_water_parameters=True
l2w_mask_negative_rhow=True
l2w_mask_cirrus=True
l2w_mask_cirrus_threshold=0.005
Re: Basic config l2w_mask
Hi Andressa
rhos_* should not be affected by l2w_mask or l2w_mask_water_parameters. Let me know if you find otherwise!
Quinten
rhos_* should not be affected by l2w_mask or l2w_mask_water_parameters. Let me know if you find otherwise!
Quinten
-
- Posts: 9
- Joined: Wed May 29, 2019 6:22 pm
Re: Basic config l2w_mask
Nice Quinten, I'll try.
About the file ".nc". Is it possible to not create this product in processing?
About the file ".nc". Is it possible to not create this product in processing?
Re: Basic config l2w_mask
No, the .nc NetCDF files are in fact the main output. The PNG and GeoTIFF files are created from the NetCDF files.
Re: Basic config l2w_mask
Quinten,
I am currently getting an odd l2_flag output in the L2W file using the settings attached on Linux using the binary version of the code.
mask file
settings file
This has been the case on all of the tiles I have looked at when processing many.
Do you have any idea why this would be the case?
I am currently getting an odd l2_flag output in the L2W file using the settings attached on Linux using the binary version of the code.
mask file
settings file
This has been the case on all of the tiles I have looked at when processing many.
Do you have any idea why this would be the case?
Re: Basic config l2w_mask
We had a database crash of the forum on 27 November and further answers to this thread were lost. For completeness, I believe the issue you had was related to the auto scaling of the datasets in SNAP to a NetCDF fill value (some really big number). I hope to improve masking of the NetCDF data in the future.
Quinten
Quinten
-
- Posts: 8
- Joined: Sat Sep 18, 2021 11:20 am
Re: Basic config l2w_mask
Hi Quinten,
I am processing S2 data, and the readings of l2_flags are 0,1,2, 3. What do these mumbers mean?
Thanks!
Guoqinag
I am processing S2 data, and the readings of l2_flags are 0,1,2, 3. What do these mumbers mean?
Thanks!
Guoqinag
Re: Basic config l2w_mask
Hi Guoqiang
The flags are represented in binary, so each bit can represent a different flag. By default the l2_flags are computed according to these exponents:
A 0 occurs when no flags are set, a 1 means the SWIR threshold is reached (2**0), a 2 means that the cirrus threshold is reached (2**1), and a three occurs when both SWIR and cirrus thresholds are reached (2**0+2**1).
Quinten
The flags are represented in binary, so each bit can represent a different flag. By default the l2_flags are computed according to these exponents:
Code: Select all
flag_exponent_swir=0
flag_exponent_cirrus=1
flag_exponent_toa=2
flag_exponent_negative=3
flag_exponent_outofscene=4
Quinten