jiffyclub / palettable

Color palettes for Python
https://jiffyclub.github.io/palettable/
Other
768 stars 73 forks source link

Add import functionality for act and cbt color swatches? #15

Open brorfred opened 9 years ago

brorfred commented 9 years ago

Hi!

I have some code to import color swatches from NCAR and NASA in the cbt and act formats. Would you be interested if I submitted this as a pull request? It seems like the functionality would fit better as an io module in palettable than a separate project...

jiffyclub commented 9 years ago

I'd be interested to see it for sure! Can you give a little background about the cbt and act formats, where those come up, where you find them, etc?

awarnock3 commented 8 years ago

I've been pulling palettes for scientific applications from the IDL language into a Python application for some NASA satellite imagery. Rather than importing families of palettes, it would be most convenient to just have a general import function from some simple external formats (say, comma-delimited). Generally, I export these from IDL as (r,g,b) tuple and convert them to YAML for my own applications. I'd love to replace my custom YAML with a package like Palettable if there were an easy way to import general palettes.

BTW, I've run into a need for multiple varieties of these - simple (r,g,b) tuples, or (r,g,b,a) tuples with transparency values, and (n,r,g,b) tuples with index values (so, not necessarily sorted on index value n). There are obvious extensions. In addition to those, we also have an internal XML format that provides the palette values with separate values for background, missing data, and out-of-range values (both above and below the desired data range).

Just FYI, I've ended up using matplotlib ListedColormap most frequently since our palettes seem to be discrete rather than continuous.