Unidata / MetPy

MetPy is a collection of tools in Python for reading, visualizing and performing calculations with weather data.
https://unidata.github.io/MetPy/
BSD 3-Clause "New" or "Revised" License
1.21k stars 408 forks source link

Convert AWIPS 2 Color Table for use with Python #3524

Open DirkMPetersen opened 1 month ago

DirkMPetersen commented 1 month ago

What should we add?

Hello!

Creating color curves in Python can be rather cumbersome, and often use AWIPS 2 at work to visualize meteorological data. I wrote a short script that takes color curves pulled from the AWIPS directory and converts them to R G B A .txt files that Python can use. AWIPS often saves these color curves in batches of 256 lines so they tend to be broken up in that way (just something to keep in mind. Hopefully, this can help beef up the repository of MetPy color curves, as making them in AWIPS is much easier than creating them by hand in a text editor or in code :)

Here is an example file pulled from the Unidata version of AWIPS 2

colormap_convert.txt

DirkMPetersen commented 1 month ago

I should also note that this works regardless of the order of R G B and A values, as long as they are labelled. For some reason, I found some were in a backward order within the line, listing A B G R instead. Additionally, AWIPS can very how it plots data to scale uniformly or logarithmically, which can cause the color curves to be called either too quickly or not quickly enough.