cogeotiff / rio-tiler

User friendly Rasterio plugin to read raster datasets.
https://cogeotiff.github.io/rio-tiler/
BSD 3-Clause "New" or "Revised" License
502 stars 106 forks source link

nodata value being ignored #671

Closed banesullivan closed 7 months ago

banesullivan commented 7 months ago

Here's an example dataset that seems to have the nodata value ignored (I'm also seeing the same result for tile())

from rio_tiler.io import Reader

class Im(bytes):
    def _repr_png_(self):
        return self

reader = Reader('https://github.com/giswqs/data/raw/main/raster/landsat7.tif')

Im(reader.preview(nodata=-1, max_size=256).render())

download

cc @giswqs and originally reported in https://github.com/banesullivan/localtileserver/issues/58

vincentsarago commented 7 months ago

🙏 thanks for the report @banesullivan

This is coming from the latest minor version of rio-tiler where we are not using WarpedVRT from nodata override but only https://github.com/cogeotiff/rio-tiler/blob/21c4dce2ded8d6d32cc74315c31141e9c4c166f5/rio_tiler/reader.py#L241

This will merge the old mask and the new mask from the provided nodata value.... while we only want one from the nodata.

Will fix this today!

banesullivan commented 7 months ago

Thanks for addressing this so quickly!!

I see 6.3.1 was issued 34de1a2 but perhaps the tag wasn't pushed?

vincentsarago commented 7 months ago

@banesullivan 🤦

CI running now https://github.com/cogeotiff/rio-tiler/actions/runs/7615127404