Skip to content

Refactor colormap handling and add new "version=2" of product info endpoint

David Hoese requested to merge feature-better-cmaps into main

This is as discussed in some of our recent meetings and puts things in place to have more flexible colormap handling in the future. There are a lot of internal changes to the configuration, but only one specific change as far as the "public" API goes (CC @csuplinski).

The main change is that there is no an optional version=2 URL parameter to /info/products. It defaults to 1 for the old/existing behavior. If set to 2 then a couple things change:

  1. There is now a root-level colormaps mapping. It maps a string name to a list of lists where each sub-list is an RGBA color on the 0-255 (8-bit unsigned integer) scale.
  2. Product objects now say colormap: "colormap_name" which points to the name of a colormap in the global colormaps dictionary.
  3. Products also now include a valid_range: [minimum_value, maximum_value] and a units: "%" (or some other string unit). This should replace the values in version 1 of the API and removes the units from the colormap which may be different from product to product even if they use the same colors for a colormap.

I'll try to get this deployed on geosphere-test and then once all the websites are using version=2 I'll change the default version to 2 and remove support for version 1. @csuplinski, any questions? Does this seem usable?

Merge request reports