NOAA-PMEL/PyFerret

Spectrum levels: raise the limit (currently max 250)

Opened this issue · 3 comments

I've installed new colormaps (or spectra or palettes) by Crameri et al 2020 from http://www.fabiocrameri.ch/colourmaps.php (or https://doi.org/10.5281/zenodo.4491293 ) and I'm having this error

 **ERROR: a program limit has been reached: Too many spectrum levels in .spk file. Max is 250

Some of the palettes have more than 250 levels. It would be nice if the limit were lifted or pyferret automatically decimate the levels (like taking every other levels).

For now I'll decimate the levels for myself.

PyFerret v7.6 on macOS 11.2.2 .

It'll be pretty simple to do an automatic decimation, and that goes right along with other Ferret/PyFerret handling of the color palettes; where a palette with few colors is interpolated to create the number of colors requested.

This is in ppl/tmapadds/shade_set.F

Just for information.

After my initial post, I looked at the spk files provided by Fabio Crameri (https://doi.org/10.5281/zenodo.4491293 ) and found that the standard versions have 256 levels. He also provides 25-, 50-, and 100-level versions for each palette. One of the associated documents mentions Ferret. That suggests that he didn't know the 250-level limitation of Ferret.

In practice, we don't need such fine color control as provided by the 256-level palette and in practice, we can just use the 25-, 50-, or 100-level version.

I agree it's hard to imagine a need for that many color definitions. Lots of the sources of color palettes use 256 or I think I've even seen 512. Ferret's 250 comes about because of an old upper limit of 256 color definitions, but the first 6 were taken up by line-color definitions for 1-D plot lines.

In the spirit of not running up against hard limits, without actually rewriting more code to remove that dependence, automatically using just a sampling of the colors in a bigger palette seems a reasonable thing to do.