RAS_PALETTE(5NCARG)

πŸ“¦ version 6.6.2, in epel 9, fedora 43, fedora 44

πŸ’– 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 0 to black.
0 0 0 0
  • Set color index 255 to 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 the 0 index defaults to black and the 255 index 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 (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