Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NODATA value is not masked after adding NODATA option of titiler #95

Open
JinIgarashi opened this issue Apr 22, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@JinIgarashi
Copy link
Contributor

In RasterTransform feature, I added nodata=-9999 to titiler endpoints, but this value is not becoming transparent (masked).

The below URL is titiler's /statistics/ endpoint.

https://titiler-dev.undpgeohub.org/cog/statistics?url=https%3A%2F%2Fundpgeohub.blob.core.windows.net%2Fuserdata%2Fa85516c81c0b78d3e89d3f00099b8b15%2Fdatasets%2FDem_Rwanda_10m_allt_20230921150153.tif%2FDem_Rwanda_10m_allt_20230921150153_band1.tif%3Fc3Y9MjAyMy0xMS0wMyZzcz1iJnNydD1vJnNlPTIwMjUtMDQtMjJUMDclM0E0OCUzQTIzWiZzcD1yJnNpZz1SMFYyb1VSZW5WZ0U4JTJGb2tSMnElMkZWSnVOVG9lWmpEVW9FM2VlcTclMkJ5WTNjJTNE&histogram_bins=10&expression=where%28b1+%3C+2112%2C+b1%2C+-9999%29%3B&nodata=-9999
statistics endpoint response
{
   "where(b1 < 2112, b1, -9999)":{
      "min":-9999,
      "max":2111,
      "mean":-89.04128130744485,
      "count":974848,
      "sum":-86801715,
      "std":3201.58412936971,
      "median":1287,
      "majority":0,
      "minority":100,
      "unique":1226,
      "histogram":[
         [
            87301,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            392128,
            495419
         ],
         [
            -9999,
            -8788,
            -7577,
            -6366,
            -5155,
            -3944,
            -2733,
            -1522,
            -311,
            900,
            2111
         ]
      ],
      "valid_percent":100,
      "masked_pixels":0,
      "valid_pixels":974848,
      "percentile_2":-9999,
      "percentile_98":2039
   }
}

As you can see, -9999 is set to min, and 0 pixel is masked from statistics api. Titiler doc says NODATA option will overwrite internal no data value, but the behaviour looks very weird (see the below screenshot from geohub).

image

@JinIgarashi JinIgarashi added the bug Something isn't working label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant