RAS_PALETTE(5NCARG)
π RAS_PALETTE π
okay bestie, so this is the 5NCARG manual page for ras_palette β it's all about how palette files work for NCAR View. If you've ever wanted to know how colors get stored in a file so your imagery doesn't look like a sad gray blob, this is THE page. β¨
πΈ NAME πΈ
ras_palette β format descriptions for palette files for NCAR View π¨
π SYNOPSIS π
palette_file.pal
palette_file.txt
π¦ DESCRIPTION π¦
NCAR View is that girl and she supports two formats for color palettes β a binary one and a textual one. Two options, both iconic, we love choices. π
binary format (the .pal one) πΎ
The binary format is compatible with NCSA HDF, and ngl it must have a file extension of ".pal". Like, it's not optional, that's just the rules.
So the palette has a red table, a green table, and a blue table β each one holding 256 single unsigned byte entries. A 0 means no intensity for that color, and a 255 means full intensity. Slay.
In the file, the palette gets stored like this:
R0 R1 ... R255 G0 G1 ... G255 B0 B1 ... B255
for a total of 768 bytes. That's it, that's the whole thing, no cap. π«Ά
textual format (the .txt one) π
The textual format can be made by a program or manually with a text editor β very DIY of it, we respect the hustle. It provides for 256 RGB entries but also allows for a sparse color table. And in that sparse case? The missing values get calculated from the ones you did give using linear interpolation. Math girlies rise up. π
Also, if unspecified, the 0 entry defaults to black and the 255 entry defaults to white. (Cute defaults, honestly.)
Each color palette entry has this format:
index_number red green blue
where index_number, red, green, and blue are all integers in the range 0 to 255. β
π EXAMPLES π
All of the examples below deal with textual color palettes. Just so we're clear. π
Setting Entries βοΈ
- Set color index
0to black.
0 0 0 0
- Set color index
255to white.
255 255 255 255
Grayscale Ramp π€π€
Let's suppose you have a file named "my.txt" and it has just two lines in it: the black entry and the white entry from above. This will produce a grayscale color palette, where the table starts at black and ramps up to white; and since only entries 0 and 255 are specified, the remaining indices are interpolated.
0 0 0 0
255 255 255 255
Note: An empty palette file (e.g."empty.txt") is legal and, since the0index defaults to black and the255index to white, produces a grayscale ramp just as in the above example. Empty file but make it fashion. πβ¨
Temperature Color Scale π‘οΈπ₯
Let's suppose you want entry 0 to be black, and the remaining indices to start at 1 with a fully-saturated blue and shift linearly to 255 with a fully-saturated red. Only three entries are required in your file, "temp.txt".
0 0 0 0
1 0 0 255
255 255 0 0
The way that blue-to-red glow-up happens with literally three lines?? Obsessed. ππ
π SEE ALSO π
rasview(1NCARG), rascat(1NCARG), rasgetpal(1NCARG), rassplit(1NCARG), rasls(1NCARG), ras_formats(5NCARG)
Go read those too bestie, they're all in the family. π«Ά
π BUGS/CAVEATS π
Color palettes are only useful with indexed-color imagery. That's the caveat, that's the tea. Don't come for me. π
π COPYRIGHT π
Copyright (C) 1987-2009 University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.
and that's the whole page, bestie!! this lil masterpiece is from the NCARG crew, dated January 1993, and yeah she's vintage but she ATE. π β¨π no cap, fr fr. bye mwah ππ
π¦ where this page comes from
- epel 9: ncl-common 6.6.2-59.el9 Β· LicenseRef-Callaway-BSD
- fedora 43: ncl-common 6.6.2-58.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: ncl-common 6.6.2-62.fc44 Β· LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms