ubarsc / python-fmask

A set of command line utilities and Python modules that implement the ‘fmask’ algorithm
https://www.pythonfmask.org
GNU General Public License v3.0
74 stars 21 forks source link

Cloud shadow extrapolation to scene edge #46

Closed benjimin closed 3 years ago

benjimin commented 3 years ago

How should Fmask handle cloud shadows at the two edges of the scene nearest to the sun?

image Example (LC81520742013143LGN02): Landsat 8, path 152, row 74, 2013-05-23T06:11:31.604832Z

It appears that a cloud object touching the scene edge has been assigned a height, and a shadow has been projected from it. Pixels very close to the edge seem to be masked clear, because there is no data to indicate how far the cloud extends beyond the scene edge. Would it be more conservative to default to marking these pixels as shadow, where there is shadow being projected through the air column above them?

neilflood commented 3 years ago

There is not really a good solution to clouds on the sun-facing edges. Your suggestion would probably work nicely in some situations, but I suspect that there would be just as many where it was too conservative, masking out lots of extra pixels, or not conservative enough, where the unseen part of the cloud is much larger than what is visible.

A safer approach is to handle this by combining data from multiple scenes. There are various approaches, but in general terms, you should trim back from the edge, and pull in the data from the neighbouring scene. Even this is not foolproof, but does at least involve real information. In our group we routinely trim everything back to the mid-line of the overlap region prior to mosaicing scenes together (again, not perfect, but mostly good). Another variant of this would be to preferentially mosaic with the sunward scene taking preference, but you should still trim a little from both, as there is always a small null margin in the cloud mask, due to the mis-alignment of the thermal band with the visible bands.