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
75 stars 20 forks source link

Clarify precedence (cloud > shadow > snow > water) #37

Closed benjimin closed 4 years ago

benjimin commented 4 years ago

Expressing this as unconvolutedly as possible. (Should also perform slightly faster, and use slightly less memory.)

neilflood commented 4 years ago

I don't understand what problem you are trying to solve. The original code is pretty clear.

The speed is dominated by I/O, and also by the shadow search phase (depending on size and number of clouds). The memory usage is already very efficient, due to the use of RIOS for raster processing.

Could you elaborate on your concerns?

benjimin commented 4 years ago

My concern is readability. I sometimes work with data that belongs to multiple categories (such as shadow on water) and debug suspected misclassifications, and I've occasionally needed to confirm the category precedence order. More than once in the past, I've looked up this section of the code to remind myself or verify which category gets reported if multiple apply. I found the original version to be convoluted, but unnecessarily so:

I propose this very minor change:

neilflood commented 4 years ago

OK, fair enough. I have tested this using LC08_L1TP_091085_20180813_20180828_01_T1, which has some of all classes present, and it gives identical results.