JornDallinga / JornDallinga.github.io

0 stars 0 forks source link

cloud_filter: mcCalc called without datatype argument #10

Open GreatEmerald opened 7 years ago

GreatEmerald commented 7 years ago

The cloud_filter function creates a mask of values 0, 1 and 2. However, it calls mcCalc without specifying the datatype argument, which means it defaults to FLT4S, which is an extreme waste of disk space. It filled my whole userdata drive and segfaulted.

Similarly, it should allow passing the of argument to select the format of the output file. It defaults to ENVI and I'm not sure why that would be better than TIFF. It saves a header file with band names, but the band names are lost in the transition anyway, so it doesn't help.

Likewise, it should allow passing other options to it, such as the compression algorithm to use (DEFLATE is pretty good at saving disk space for data like this!).

For me, these options seem to look the best for this particular case:

gdal_translate -ot Byte -co "COMPRESS=DEFLATE" -co "ZLEVEL=9" -co "NBITS=2" -co "NUM_THREADS=4" input.vrt output.tif

(there doesn't seem to be any benefit to increasing threads beyond 4 here)

JornDallinga commented 7 years ago

No experience yet with DEFLATE, but will look it up. Your other points make sense as well.

GreatEmerald commented 7 years ago

DEFLATE is the algorithm used in ZIP compression. LZMA is used in 7Z compression, which has a better compression ratio, but GDAL has to be built with LZMA support for that to work. Though the one on the VM in fact does have LZMA support, so it might be an even better option.

GreatEmerald commented 7 years ago

Oh, sorry, I was talking about the function cloud_filter, rather. That's the one that produces a mask.