Improvement in Water Mask and TCD management in LIS FSC
This ticket apply for LIS v1.11 and later versions and most likely to LIS v1.10 as well.
In latest versions LIS allow masking of inland water areas when providing a water mask as input. Providing a "tree mask", ie Tree Cover Density (TCD) raster allow to calculate the FSC OG from the FSC TOC layer. Through a bit of testing done to integrate the new version of LIS to our processing chain, we encountered a few inconsistencies in alternative workflows about the management of these two input layers.
- when a water mask is provided, the areas covered by the water mask are tagged as No Data. Hence the final layers (ie FSC OG, FSC TOC) are masked with NoData value for those pixels, including when there is cloud from L2A. A very minor improvement would be to mask the NoData values with clouds where there were clouds at first, so that the user can have a raster "looking like what could be seen from the sky"
- when TCD is not provided the OG layer is not calculated, which is fine. Though the QCFLAGS layer is generated only when the OG layer is produced. The reason is most likely because both Water Mask and TCD are required to populate some bits of the QCFLAGS. Simon Gascoin told us that it is (not calculating the QCFLAGS layer if only the TOC layer is generated), is most likely a wanted behaviour.
- when TCD is provided, but not the water mask, no major issue is encountered during the generation of the FSC main layers (NDSI, TOC, OG). Though, as the TCD is provided, the OG is generated, and the QCFLAGS as well. The lack of a Water Mask leads to an early interruption of LIS FSC, mid-QCFLAGS generation. The exception is not catched nor managed.
As a suggestion, I would propose the following evolutions. The most important being displayed first, the least important last.
- manage a no Water Mask situation in the QCFLAGS generation, by checking the provisioning of a Water Mask beforehand, and, if not provided, by populating the corresponding bit (bit 2 right now) with 0 (ie not active bit).
- provide a QCFLAGS layer even if no TCD mask was provided, ie a QCFLAGS for FSC TOC layer. Meaning including a management of no TCD in QCFLAGS creation routine, by not activating the corresponding bit (bit 3 right now).
- unmask inland water areas if they are covered by clouds (or reapply the cloud mask after hand).
- let the user choose if the Water Mask provided is to be used to mask the main FSC layers (TOC, NDSI, OG) or only to flag the pixels in the QCFLAGS. This could be done by adding a parameter in the "water_mask" section of the lis_default_configuration.json, being a boolean, set to True if the water mask is to be sued to mask the layers, or to False if it is to fill the QCFLAGS.
According to the use we have, and that of some of our partners on HR-WSI project, the most critical part is the possibility to run LIS FSC without providing a Water Mask, and still being able to generate an OG layer, and not encountering an exception.
An additional remark : we made some small evolutions on the QCFLAGS mask, including a bit for the pixels in the hillshade mask (as the snow detector is less performant in shadow areas), and a bit for the pixels from the uncalibrated_shaded_snow mask (as those are retrieved with a specific workflow, and the snow fraction is corrected after hand). Though such implementation in LIS would be more relevant after the study on the impact of correcting the shaded snow areas, that Simon Gascoin said was on the tracks.