problem with colors [message #47093] |
Thu, 19 January 2006 09:29 |
psbeps
Messages: 8 Registered: March 2005
|
Junior Member |
|
|
I have an IDL program that creates an image of sea surface temperature
anomalies, where dark purple (almost black) is the cold anomalies and
red is the warm anomalies. I have set up brown, blue, black, and white
as color indices 252, 253, 254, and 255, respectively. The hottest
anomalies were showing up as blue (this was before I added brown as a
color), instead of red, which I think is because blue was the next
color after red. So I changed the code from
scaledc=bytscl(c, MIN=min(c), MAX=max(c), top=253) + byte(bottom)
to
scaledc=bytscl(c, MIN=min(c), MAX=max(c), top=251) + byte(bottom)
because 251 is the last red color index. When the top is set to 251,
the blue anomalies are red, which I think they should be. So that is
good. The problem is that when I have top set to 251, it won't let me
assign parts of the image to certain colors, like making the ice white
or the land black. I think it's only by coincidence making the ice
white and the land black, so I don't totally trust black areas are land
and white areas are ice, although it looks plausible. It only will
draw the 4 assigned colors where I want them, if the top value in the
above line of code is equal to 256, to include the 4 assigned color
indices. I want to be able to have the hottest anomalies be red (if
top=251), but also I want to be able to make the land black and the ice
white, and undetermined values black or brown (if top=256). How can I
do both things? Here is the other relevant code:
c(*,*)=scaledc(*,*)*(theIceflags(*,*) eq 0 and theLandflags(*,*) eq 0
and theundflags(*,*) eq 0) + iceColor*(theIceflags(*,*) eq 1) +
landColor*(theLandflags(*,*) eq 1) + landColor*(theundflags(*,*) eq 1)
--where c is the sea surface temperature anomaly which should be
purple, blue, yellow, orange, or red. My theIceflag array is 1's and
0's, where 0 means there is no ice, and 1 means there is ice. The same
goes for theLandflags and theundflags.
Jill
|
|
|