force icon indicating copy to clipboard operation
force copied to clipboard

Masked blocks in TSS are assigned 0 instead of nodata value

Open ernstste opened this issue 2 years ago • 7 comments

Maybe related to #26:

When producing TSS with masks in v3.7.8, there are some masked areas that are assigned 0 instead of the nodata value. The issue does not occur when using v3.7.7. We also didn't observe this when Landsat was processed for the same 30x30km tile - same block size (3000) but 30m res instead of 10m.

sdf

ernstste avatar Sep 27 '22 15:09 ernstste

I wonder what I changed... I guess I will need to implement the CSO fix in each sub-module

davidfrantz avatar Oct 20 '22 14:10 davidfrantz

Hey @ernstste, did https://github.com/davidfrantz/force/issues/26 ever work? I just made a small test, and it doesn't work for TSA and CSO.

I tried to pin down the issue, and problem is, that data for this chunk are neither read, computed, nor written. I guess that the GeoTiff is sparse, though I do not understand yet why this worked in the past.

davidfrantz avatar Oct 20 '22 16:10 davidfrantz

Damn

davidfrantz avatar Oct 20 '22 16:10 davidfrantz

This bug was introduced when implementing the custom GDAL options where you can define your own output format and choose your own driver.

Not every driver supports "creating" a dataset, some need to create by copying an existing one. This can be an in-memory dataset, however. And to be most flexible and simplify the code, I followed that strategy for all drivers, i.e.

  1. create dataset in-memory
  2. copy dataset to disk

Apparently, this does not work with sparse files somehow... ugh.

I guess I will need to check if the driver can create files, and then work around this by either directly creating or create/copying only if needed.

davidfrantz avatar Oct 20 '22 16:10 davidfrantz

Ouch. Custom GDAL options come back to bite you again.

I'm pretty sure #26 did work back then. I tried it right after you implemented the fix and the results looked ok.

ernstste avatar Oct 20 '22 16:10 ernstste

It might be, that the problem does not consistently surface - you also mentioned that you did not see that issue with Landsat data.

davidfrantz avatar Oct 21 '22 13:10 davidfrantz

I worked on a fix: https://github.com/davidfrantz/force/commit/d9759f64204a563723ec39f63970928267a77751

I think it solves this issue.

The only thing to mention (and I believe this already did not work before) is that I could not make create/copy drivers work for block-output (like in HLPS). If full files are written, it works, however (like the OVV images in L2PS).

davidfrantz avatar Oct 21 '22 13:10 davidfrantz