Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Displaying continuous data with multiple transparency values? #230

Closed
gadomski opened this issue Mar 21, 2022 · 0 comments
Closed

Displaying continuous data with multiple transparency values? #230

gadomski opened this issue Mar 21, 2022 · 0 comments

Comments

@gadomski
Copy link

Tl:dr; Is there a way to define a continuous colormap while still mapping multiple values to transparency?

We're using rio-cogeo (via titiler) to display COG-ified MODIS products. Some MODIS products, e.g. MOD17A3HGF, have continuous data that we'd like to display with a continuous colormap. However, these products also have multiple "fill values" that make displaying "nodata" as transparent pixels tricky. E.g. MOD17A3HGF has the following two continuous variables:

Data Sets Meaning Units Date Type Valid Range Scale Factor
Gpp_500m 8-day total GPP kgC/m2 /8d int16 0 ~ 30000 0.0001
PsnNet_500m 8-day total Net Photosynthesis kgC/m2 /8d int16 -30000 ~ 30000 0.0001

These int16 values also have "fill values" at the top end of their domain -- we want to display all of these values as transparent pixels:

32767 = _Fillvalue
32766 = land cover assigned as perennial salt or Water bodies
32765 = land cover assigned as barren,sparse veg (rock,tundra,desert)
32764 = land cover assigned as perennial snow,ice.
32763 = land cover assigned as "permanent" wetlands/inundated marshland
32762 = land cover assigned as urban/built-up
32761 = land cover assigned as "unclassified" or (not able to determine)

For now, we're using an intervals colormap to get close to what we want, e.g.:

[
    [
        [ 0, 3750 ], [ 247, 252, 253, 255 ]
    ],
    [
        [ 3750, 7500 ], [ 229, 245, 249, 255 ]
    ],
    [
        [ 7500, 11250 ], [ 204, 236, 230, 255 ]
    ],
    [
        [ 11250, 15000 ], [ 153, 216, 201, 255 ]
    ],
    [
        [ 15000, 18750 ], [ 102, 194, 164, 255 ]
    ],
    [
        [ 18750, 22500 ], [ 65, 174, 118, 255 ]
    ],
    [
        [ 22500, 26250 ], [ 35, 139, 69, 255 ]
    ],
    [
        [ 26250, 30000 ], [ 0, 88, 36, 255 ]
    ],
    [
        [ 30000, 32766 ], [ 0, 0, 0, 0 ]
    ]
]

Is there a way to define a continuous colormap while still mapping multiple values to transparency? If not, is this something that could be implemented? I'm happy to dig in an give it a shot if its something that's possible.

@cogeotiff cogeotiff locked and limited conversation to collaborators Mar 21, 2022
@vincentsarago vincentsarago converted this issue into discussion #231 Mar 21, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant