PermafrostDiscoveryGateway / viz-raster

PDG vizualization pipeline for raster processing
Apache License 2.0
0 stars 3 forks source link

Automate multiple palette assignment to each statistic #24

Open julietcohen opened 8 months ago

julietcohen commented 8 months ago

During the rasterization step of the viz workflow, each statistic that was defined in the config generates one tileset of geotiffs. Importantly, each statistic contains specification for one palette that can be either a list of hex codes or the name of a palette that contains multiple colors. During the subsequent viz workflow step, web tiling, each palette is assigned to its respective tileset of geotiffs, generating one tileset of web tiles for each geotiff tileset.

Because we currently show PNG's on the portal, and do not display geotiffs, we are not currently able to generate layers in any palette that a user may specify. In other words, we cannot generate PNG tilesets on the fly.

Doug Hungarter from Google.org suggested that the users be able to choose between several predefined palettes for each data layer. For example, a user should be able to choose between green, yellow, or purple ice-wedge polygons while the ice-wedge polygons layer is toggled on, and potentially layered on top of other layers. He suggested that we automate the web tiling with the following changes:

We can and should differentiate between categorical and discrete color palettes:

Integrating Doug's suggested changes would require:

This issue is related to viz-staging issue#25

julietcohen commented 8 months ago

Another related in-progress ticket is issue#16. For each statistic, the no data value must be defined, and it may vary per statistic. The default is currently set to be 0, but in plenty of datasets 0 is a real value.

A high priority goal of the visualization workflow is to be able to differentiate between no data and no detections. For a layer, users should be able to tell whether a region (tile) that lacks polygons is empty because the region was run through a detection model and no feature was detected versus the region was not input into the model.

We have discussed achieving this in various ways. Some examples:

If there is existing documentation about this that I haven't linked to, anyone feel free to note it.

Notes:

julietcohen commented 8 months ago

In the package, web tiling is executed when we run WebImage() within the webtile_from_geotiffs() here. webtile_from_geotiffs iterates through each stat in the config. So perhaps within this loop would be a good place to iterate through each palette in each stat (a nested loop). The palette argument for WebImage defines the default palette, and only 1 is defined.

julietcohen commented 8 months ago

As noted earlier, before iterating though each palette in each stat, we need to determine if the stats is continuous, categorical, or discrete. This may need to be an entirely new option in the statistic part of the config. Perhaps we could integrate a default for this by writing a function that determines the type of the column entered for the stat with gdf[column_name].dtype and if a string is detected then the behavior is different than if numbers are detected. The output options are described here.