|
Re: A color table for topography [message #46019 is a reply to message #46014] |
Tue, 25 October 2005 23:22  |
peter.albert@gmx.de
Messages: 108 Registered: July 2005
|
Senior Member |
|
|
Hi Hjalti,
I once tried to mimick such a color table myself. It uses the first 82
colours only, so there is room for improvement. And I am sure it does
not fulfill any serious geographer's conventions. But it looks not too
bad.
N.B. Blue is set to index 2, so if the ocean is to appear blue, make
the appropriate pixels have the correct value. (Or modify the code, I
have no idea why back in time that was necessary for me..)
Here is the code:
r = bytarr(256)
g = bytarr(256)
b = bytarr(256)
; Blue for ocean
r[2] = 0 & g[2] = 0 & b[2] = 150
; Some shades of green for the lower elevations
r[3:20] = 0
g[3:20] = bindgen(18) * (190.-120.) / 17. + 120
b[3:20] = 0
; Here we go from green to more brownish colours
r[21:40] = bindgen(20) * (220.) / 19.
g[21:40] = 190
b[21:40] = 0
; Now these are the real brown colours for higher elevations
r[41:60] = 220 - bindgen(20) * (30) / 19.
g[41:60] = 190 - bindgen(20) * (80) / 19.
b[41:60] = 0
; And finally let the colours fade such that we get white mountain
tops:
r[61:80] = bindgen(20) * 65 / 19. + 190
g[61:80] = bindgen(20) * 145 / 19. + 110
b[61:80] = bindgen(20) * 255 / 19.
; For some reason I needed a gray value at index 81, probably for
annotations?
r[81] = 235 & g[81] = 235 & b[81] = 235
; Well, go for it!
tvlct, r, g, b
; And, just to get an idea, this is how a strangely shaped mountain
; (with some small spots of ocean in the image edges)
; could be displayed with this colour table:
tv, bytscl((dist(200))^2,top=78)+2
Best regards,
Peter
|
|
|