Open maxrjones opened 4 weeks ago
@vincentsarago @sharkinsspatial would either of you be able to provide guidance about the correct approach for unscaling during tile generation?
in rio-tiler we apply unscaling
after reprojection/resampling https://github.com/cogeotiff/rio-tiler/blob/0a8456122d3b4a256cdb63da466f32a3587df512/rio_tiler/reader.py#L264-L276
In GDAL, applying the scale and offset is done after reading the data
Note that applying scale and offset is of the responsibility of the user, and is not done by methods such as RasterIO() or ReadBlock().
About the mask
we let GDAL handle everything https://gdal.org/en/latest/programs/gdalwarp.html#nodata-source-validity-mask-handling but the mask
(either nodata / alpha / internal mask) has to be set before wrapping.
I see that with rioxarray you do the opposite (when using mask_and_scale=True
), you'll read the dataset, upscale and then wrap (I think)
I'm not quite sure about the optimization but when unscaling
the data you'll endup with float
data which might take more memory 🤷♂️
Despite potential modest performance hits, should the mask and scale always be applied before resampling to prevent accidental mistakes?
If not, I think this approach could work: