Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCDA: Ignoring isolated cloudy pixels #14

Open
BaptisteVandecrux opened this issue Mar 3, 2021 · 1 comment
Open

SCDA: Ignoring isolated cloudy pixels #14

BaptisteVandecrux opened this issue Mar 3, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@BaptisteVandecrux
Copy link
Member

I think we should not consider one or two isolated cloudy pixels as clouds, and grow a buffer around them.

SICE/dm.grass.sh

Lines 50 to 59 in b18b5de

log_info "Masking clouds in SZA raster"
r.grow input=SCDA_v20 output=SCDA_grow radius=-5 new=-1 --q # increase clouds by 5 pixels
# remove small clusters of isolated pixels
r.clump -d input=SCDA_grow output=SCDA_clump --q
# frink "(1000 m)^2 -> hectares" 100 hectares per pixel, so value=10000 -> 10 pixels
# this sometimes fails. Force success (||true) and check for failure on next line.
r.reclass.area -c input=SCDA_clump output=SCDA_area value=10000 mode=greater --q || true
[[ "" == $(g.list type=raster pattern=SCDA_area) ]] && r.mapcalc "SCDA_area = null()" --q
# SZA_CM is SZA but Cloud Masked: Invalid where buffered clouds over ice w/ valid SZA
r.mapcalc "SCDA_final = if((isnull(SCDA_area) && (MASK@PERMANENT == 220)) || (isnull(SCDA_v20) && (MASK@PERMANENT != 220)), null(), 1)" --q

I think r.clump was supposed to take care of it but I believe it has no impact after r.grow. Or maybe I misunderstood the role of r.clump?

r.area is successful at removing small clusters of cloud-free pixels within clouds but is ineffective on isolated cloudy-pixels in a cloud-free regions.

Maybe a fix would be to shrink the SCDA_v20 before we grow it:

  r.grow input=SCDA_v20 output=SCDA_shrink radius=2 new=1 --q # decrease clouds by 2 pixels
  r.grow input=SCDA_v20 output=SCDA_grow radius=-5 new=-1 --q # increase clouds by 5 pixels
@AdrienWehrle
Copy link
Member

AdrienWehrle commented Mar 20, 2021

Those post-processing steps were implemented by @mankoff before we started to use SCDA, and we indeed definitely have to check if they are still appropriate/needed!
One of the ideas behind it was to make sure we remove e.g. cloud shadows, that are not correctly detected by SCDA. Maybe more than an isotrope buffer, we could work with SZA and only buffer in the right direction.

From what I understand r.clump is only polygonizing the data, creating objects from contiguous areas to then filter them by extent (r.reclass.area).

but is ineffective on isolated cloudy-pixels in a cloud-free regions.

I find it weird. Again, from my understanding, objects should be created independently of their values and therefore the processing should be the same for isolated cloud-free and cloudy pixels. I probably miss something here.

Maybe a fix would be to shrink the SCDA_v20 before we grow it

Very interesting fix. However I think we loose some precious SCDA detection in the process even if only for two pixels. I am pretty sure there is a way to directly filter by area independently of the class. I will investigate!

@AdrienWehrle AdrienWehrle added the enhancement New feature or request label Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants