pacificclimate / pdp

The PCIC Data Portal - Server software to run the entire web application
GNU General Public License v3.0
1 stars 2 forks source link

logscale colour hack has stopped working with ncWMS upgrade #252

Closed corviday closed 2 years ago

corviday commented 2 years ago

We want to display precipitation on the map with a logarithmic scale, otherwise the colour gradations are too subtle to see. This is difficult, because precipitation is often 0, which cannot be represented as a log of anything.

ncWMS in theory provides a way to handle this: you can supply a range of values to be rendered with the COLORSCALERANGE parameter, and than any values outside that range will be coloured as speified by theBELOWMINCOLOR and ABOVEMAXCOLOR parameters.

However, we found that the ancient version of ncWMS the PDP used to use (1.x running on pizza) ignored the BELOWMINCOLOR parameter, and rendered all values outside the range set by COLORSCALERANGE opaque black. As a workaround, we created a custom palette whose minimum value was black and whose maximum value was cyan, and used that to render logscaled precipitation, so that the minimum COLORSCALERANGEvalue, which was rendered as black on the custom palette, blended smoothly with the black outside-of-range values.

The PDP's ncWMS has been updated, and no longer renders all out-of-range values as black, so this strategy no longer works. Currently out-of-range values are rendered transparent, but hopefully we can now just use the BELOWMINCOLOUR parameter instead of complicated workarounds.

corviday commented 2 years ago

I have checked, and it looks like we can just do BELOWMINCOLOR=extend to get the results we want!

Here's how the maps look now: default

Here's with BELOWMINCOLOR=extend: extend

corviday commented 2 years ago

Charles prefers <1mm/day transparent, so leave it as is.