Why the contour does not show? [message #63877] |
Fri, 21 November 2008 11:06  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
Hi~ guys. I have a problem here. I have a small program doing a
contour plot. But is just show me the background, not the data. I
guess there is something wrong with the colors. Can anyone help?
Thanks
lat=fltarr(75)
lon=fltarr(75)
latstep=(34.3842-31.6985)/74.0
lonstep=(121.5581-118.3524)/74.0
for i=0,74 do begin
lat(i)=-31.6985-i*latstep
lon(i)=118.3524+i*lonstep
endfor
print,max(lat),min(lat)
print,max(lon),min(lon)
device,decomposed=0
!p.background = 255
xs=600
ys=600
window,xsize=xs,ysize=ys
contour,inits,color=0,xrange=[min(lon),max(lon)],yrange=[min (lat),max
(lat)],xtitle='longtitude',ytitle='latitude',title='Sensible heat
flux'
|
|
|
Re: Why the contour does not show? [message #63937 is a reply to message #63877] |
Sun, 23 November 2008 18:32  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> Thanks for your advice. David, after two cans of moutaindew, I work it
> out.
> First I have to set the r, g, b, array right. Then, I have to use much
> more levels in the contour command to make sure that all the colors
> are shown.
There you go. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Why the contour does not show? [message #63939 is a reply to message #63877] |
Sun, 23 November 2008 16:18  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
On Nov 22, 6:26 pm, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> :) HERE IT IS
>
> OK, here is what I would do. I'd take about 3 or 4 really
> deep breaths. Then maybe I'd go get a beer. While I was walking
> to the cooler, I'd be thinking about what I was really
> trying to do here.
>
> When I got back, and finished the beer, I would re-read
> all those Contour articles on Fanning's web page again,
> this time with the goal of understanding why he is doing
> the things he is doing.
>
> Then, I would have a long, hard look at this code again.
> Here are the questions I would be trying to ask myself.
> (1) How many colors do I expect to see on the contour
> plot? How do I know what those colors are? How do I know
> if my data will be displayed with those colors? How can
> I make sure it will be displayed with those colors? What
> assumptions am I making currently that are just plain wrong?
>
> When I worked though all of that, I'd write this code over
> from scratch, making sure no line in it was longer than
> about 50 characters or so, in case I had to send it to
> somebody to help me with this. If I did need to send it,
> I'd think about making a simple data set that I could send
> them so they didn't have to spend a half hour themselves
> writing code to run my program.
>
> When I was finished with all of that, I probably wouldn't
> have to ask any more questions, but if I did, I would be
> in a MUCH better place to do so. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Thanks for your advice. David, after two cans of moutaindew, I work it
out.
First I have to set the r, g, b, array right. Then, I have to use much
more levels in the contour command to make sure that all the colors
are shown.
Thanks :)
|
|
|
Re: Why the contour does not show? [message #63950 is a reply to message #63877] |
Sat, 22 November 2008 16:26  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> :) HERE IT IS
OK, here is what I would do. I'd take about 3 or 4 really
deep breaths. Then maybe I'd go get a beer. While I was walking
to the cooler, I'd be thinking about what I was really
trying to do here.
When I got back, and finished the beer, I would re-read
all those Contour articles on Fanning's web page again,
this time with the goal of understanding why he is doing
the things he is doing.
Then, I would have a long, hard look at this code again.
Here are the questions I would be trying to ask myself.
(1) How many colors do I expect to see on the contour
plot? How do I know what those colors are? How do I know
if my data will be displayed with those colors? How can
I make sure it will be displayed with those colors? What
assumptions am I making currently that are just plain wrong?
When I worked though all of that, I'd write this code over
from scratch, making sure no line in it was longer than
about 50 characters or so, in case I had to send it to
somebody to help me with this. If I did need to send it,
I'd think about making a simple data set that I could send
them so they didn't have to spend a half hour themselves
writing code to run my program.
When I was finished with all of that, I probably wouldn't
have to ask any more questions, but if I did, I would be
in a MUCH better place to do so. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Why the contour does not show? [message #63951 is a reply to message #63877] |
Sat, 22 November 2008 15:40  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
On Nov 22, 5:31 pm, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> OK, when I using this version, if I put /overplot keyword in the first
>> contour command, it give me floating errors. If i do not use this key
>> word, is does not show the TICKNAME of the axies.
>
> I think you code might be just a little mixed up. Try to
> get your entire Contour command in one place in the file.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
:) HERE IT IS
min = min(inits)
max = max(inits)
inits = (inits-min)/(max-min)
inits = inits* 255
inits=fix(inits)
print,max(inits),min(inits)
map_set,/CYLINDRICAL,limit=[-34.3842,min(lon),-31.6985,max
(lon)],color=0,/noborder
map_grid, color=0
map_continents,/countries, /coasts, color=0
TVLCT, r, g, b
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=0, Get_Decomposed=theState
contour,inits,color=0,title='Sensible heat flux', /device,/
NOERASE,xrange=[0,76],/xstyle,xTICKINTERVAL=73,xTICKNAME=[lo n1(0),lon1
(3)],$
yrange=[0,73],/ystyle,yTICKINTERVAL=73,yTICKNAME=[lat1(3),la t1(0)],
$
C_COLORS=Indgen(64),/CELL_FILL, NLEVELS=20
Contour, inits, Color=0, NLEVELS=20,/Overplot
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=theState
|
|
|
Re: Why the contour does not show? [message #63952 is a reply to message #63877] |
Sat, 22 November 2008 15:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> OK, when I using this version, if I put /overplot keyword in the first
> contour command, it give me floating errors. If i do not use this key
> word, is does not show the TICKNAME of the axies.
I think you code might be just a little mixed up. Try to
get your entire Contour command in one place in the file.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Why the contour does not show? [message #63953 is a reply to message #63877] |
Sat, 22 November 2008 15:29  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
On Nov 22, 5:06 pm, xiao <littledd...@gmail.com> wrote:
> On Nov 22, 4:27 pm, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
>
>
>
>> xiao schrieb:
>
>>> On Nov 21, 6:27 pm, David Fanning <n...@dfanning.com> wrote:
>>>> xiao writes:
>>>> > Sorry I have to ask again, i tried to scaled my data, and the result
>>>> > is right, but when I try to plot it, it just show me very few colors
>>>> > (almost bright color) Is it because of my color table? David? Thank
>>>> > you. BTW: i did scale it from 0 to 255.
>>>> Well, I don't think the CONTOUR command knows anything
>>>> about 24-bit colors. He is older, even, than I am. :-)
>
>>>> It's an odd color table, but why don't you just
>>>> load the colors and then tell the Contour command
>>>> to use an index into the color table, like this:
>
>>>> TVLCT, r, g, b
>>>> IF (!D.Flags AND 256) NE 0 THEN $
>>>> Device, Decomposed=0, Get_Decomposed=theState
>>>> CONTOUR, ....., C_Colors=Indgen(64), ....
>>>> IF (!D.Flags AND 256) NE 0 THEN $
>>>> Device, Decomposed=theState
>
>>>> That might work better. At least it is a place to start.
>
>>>> Cheers,
>
>>>> David
>>>> --
>>>> David Fanning, Ph.D.
>>>> Fanning Software Consulting, Inc.
>>>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>>> Sorry, David, it does not work :( I am trying to think where the
>>> problem should be....
>
>> please post a complete example of what you have now. That is easier to
>> understand.
>
>> cheers
>> Reimar
>
> Sorry, here u go, the result is a gray image but I want it from read
> to green :(
>
> numColors = 48
> tvlct, r,g,b,/get
>
> r(0:63)=
> [255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
>
> 0,0,0,0,0,7,15,23,31,38,46,54,62,86,110,134,158,182,206,$
>
> 230,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,$
> 255,255,255,255,255,255,255,255,255,255]
>
> g(0:63)=
> [255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
>
> 0,0,0,0,0,28,56,84,112,140,168,196,224,227,231,235,239,243,2 47,$
>
> 251,255,249,243,237,232,226,220,214,209,182,156,130,104,78,5 2,$
> 26,0,0,0,0,0,0,0,0,0]
>
> b(0:63)=
> [255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 36,$
>
> 72,109,145,182,218,255,223,191,159,127,95,63,31,0,0,0,0,0,0, 0,$
>
> 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,63,95,127,159,191,223 ,255]
>
> ; calcualte the true color index of each color defined above
>
> cn = r + 256L * ( g + 256L * b)
>
> help,cn
> min = min(inits)
> max = max(inits)
> inits = (inits-min)/(max-min)
>
> inits = inits*48 + 16
> inits=fix(inits)
> print,max(inits),min(inits)
>
> map_set,/CYLINDRICAL,limit=[-34.3842,min(lon),-31.6985,max
> (lon)],color=0,/noborder
> map_grid, color=0
> map_continents,/countries, /coasts, color=0
>
> contour,inits,color=0,title='Sensible heat flux', /device,/
> NOERASE,xrange=[0,76],/xstyle,xTICKINTERVAL=73,xTICKNAME=[lo n1(0),lon1
> (3)],$
> yrange=[0,73],/ystyle,yTICKINTERVAL=73,yTICKNAME=[lat1(3), lat1(0)],
> $
> C_COLORS=cn,/CELL_FILL, NLEVELS=20
>
> Contour, inits, Color=0, NLEVELS=20,/Overplot
OK, when I using this version, if I put /overplot keyword in the first
contour command, it give me floating errors. If i do not use this key
word, is does not show the TICKNAME of the axies.
numColors = 48
tvlct, r,g,b,/get
r(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
0,0,0,0,0,7,15,23,31,38,46,54,62,86,110,134,158,182,206,$
230,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,$
255,255,255,255,255,255,255,255,255,255]
g(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
0,0,0,0,0,28,56,84,112,140,168,196,224,227,231,235,239,243,2 47,$
251,255,249,243,237,232,226,220,214,209,182,156,130,104,78,5 2,$
26,0,0,0,0,0,0,0,0,0]
b(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 36,$
72,109,145,182,218,255,223,191,159,127,95,63,31,0,0,0,0,0,0, 0,$
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,63,95,127,159,191,223 ,255]
min = min(inits)
max = max(inits)
inits = (inits-min)/(max-min)
inits = inits* 255
inits=fix(inits)
print,max(inits),min(inits)
map_set,/CYLINDRICAL,limit=[-34.3842,min(lon),-31.6985,max
(lon)],color=0,/noborder
map_grid, color=0
map_continents,/countries, /coasts, color=0
TVLCT, r, g, b
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=0, Get_Decomposed=theState
yrange=[0,73],/ystyle,yTICKINTERVAL=73,yTICKNAME=[lat1(3),la t1(0)],
$
C_COLORS=colo,/CELL_FILL, NLEVELS=20
Contour, inits, Color=0, NLEVELS=20,/Overplot
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=theState
|
|
|
Re: Why the contour does not show? [message #63954 is a reply to message #63877] |
Sat, 22 November 2008 15:06  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
On Nov 22, 4:27 pm, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
> xiao schrieb:
>
>
>
>> On Nov 21, 6:27 pm, David Fanning <n...@dfanning.com> wrote:
>>> xiao writes:
>>>> Sorry I have to ask again, i tried to scaled my data, and the result
>>>> is right, but when I try to plot it, it just show me very few colors
>>>> (almost bright color) Is it because of my color table? David? Thank
>>>> you. BTW: i did scale it from 0 to 255.
>>> Well, I don't think the CONTOUR command knows anything
>>> about 24-bit colors. He is older, even, than I am. :-)
>
>>> It's an odd color table, but why don't you just
>>> load the colors and then tell the Contour command
>>> to use an index into the color table, like this:
>
>>> TVLCT, r, g, b
>>> IF (!D.Flags AND 256) NE 0 THEN $
>>> Device, Decomposed=0, Get_Decomposed=theState
>>> CONTOUR, ....., C_Colors=Indgen(64), ....
>>> IF (!D.Flags AND 256) NE 0 THEN $
>>> Device, Decomposed=theState
>
>>> That might work better. At least it is a place to start.
>
>>> Cheers,
>
>>> David
>>> --
>>> David Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>> Sorry, David, it does not work :( I am trying to think where the
>> problem should be....
>
> please post a complete example of what you have now. That is easier to
> understand.
>
> cheers
> Reimar
Sorry, here u go, the result is a gray image but I want it from read
to green :(
numColors = 48
tvlct, r,g,b,/get
r(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
0,0,0,0,0,7,15,23,31,38,46,54,62,86,110,134,158,182,206,$
230,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,$
255,255,255,255,255,255,255,255,255,255]
g(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
0,0,0,0,0,28,56,84,112,140,168,196,224,227,231,235,239,243,2 47,$
251,255,249,243,237,232,226,220,214,209,182,156,130,104,78,5 2,$
26,0,0,0,0,0,0,0,0,0]
b(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 36,$
72,109,145,182,218,255,223,191,159,127,95,63,31,0,0,0,0,0,0, 0,$
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,63,95,127,159,191,223 ,255]
; calcualte the true color index of each color defined above
cn = r + 256L * ( g + 256L * b)
help,cn
min = min(inits)
max = max(inits)
inits = (inits-min)/(max-min)
inits = inits*48 + 16
inits=fix(inits)
print,max(inits),min(inits)
map_set,/CYLINDRICAL,limit=[-34.3842,min(lon),-31.6985,max
(lon)],color=0,/noborder
map_grid, color=0
map_continents,/countries, /coasts, color=0
contour,inits,color=0,title='Sensible heat flux', /device,/
NOERASE,xrange=[0,76],/xstyle,xTICKINTERVAL=73,xTICKNAME=[lo n1(0),lon1
(3)],$
yrange=[0,73],/ystyle,yTICKINTERVAL=73,yTICKNAME=[lat1(3),la t1(0)],
$
C_COLORS=cn,/CELL_FILL, NLEVELS=20
Contour, inits, Color=0, NLEVELS=20,/Overplot
|
|
|
Re: Why the contour does not show? [message #63955 is a reply to message #63877] |
Sat, 22 November 2008 15:06  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> The output is still a gray image but I want it from red to green. :(
Send us the version that incorporates my suggestions, then
we can discuss further.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: Why the contour does not show? [message #63957 is a reply to message #63877] |
Sat, 22 November 2008 14:27  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
xiao schrieb:
> On Nov 21, 6:27 pm, David Fanning <n...@dfanning.com> wrote:
>> xiao writes:
>>> Sorry I have to ask again, i tried to scaled my data, and the result
>>> is right, but when I try to plot it, it just show me very few colors
>>> (almost bright color) Is it because of my color table? David? Thank
>>> you. BTW: i did scale it from 0 to 255.
>> Well, I don't think the CONTOUR command knows anything
>> about 24-bit colors. He is older, even, than I am. :-)
>>
>> It's an odd color table, but why don't you just
>> load the colors and then tell the Contour command
>> to use an index into the color table, like this:
>>
>> TVLCT, r, g, b
>> IF (!D.Flags AND 256) NE 0 THEN $
>> Device, Decomposed=0, Get_Decomposed=theState
>> CONTOUR, ....., C_Colors=Indgen(64), ....
>> IF (!D.Flags AND 256) NE 0 THEN $
>> Device, Decomposed=theState
>>
>> That might work better. At least it is a place to start.
>>
>> Cheers,
>>
>> David
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> Sorry, David, it does not work :( I am trying to think where the
> problem should be....
please post a complete example of what you have now. That is easier to
understand.
cheers
Reimar
|
|
|
Re: Why the contour does not show? [message #63958 is a reply to message #63877] |
Sat, 22 November 2008 13:42  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
On Nov 21, 6:27 pm, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> Sorry I have to ask again, i tried to scaled my data, and the result
>> is right, but when I try to plot it, it just show me very few colors
>> (almost bright color) Is it because of my color table? David? Thank
>> you. BTW: i did scale it from 0 to 255.
>
> Well, I don't think the CONTOUR command knows anything
> about 24-bit colors. He is older, even, than I am. :-)
>
> It's an odd color table, but why don't you just
> load the colors and then tell the Contour command
> to use an index into the color table, like this:
>
> TVLCT, r, g, b
> IF (!D.Flags AND 256) NE 0 THEN $
> Device, Decomposed=0, Get_Decomposed=theState
> CONTOUR, ....., C_Colors=Indgen(64), ....
> IF (!D.Flags AND 256) NE 0 THEN $
> Device, Decomposed=theState
>
> That might work better. At least it is a place to start.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Sorry, David, it does not work :( I am trying to think where the
problem should be....
|
|
|
Re: Why the contour does not show? [message #63962 is a reply to message #63877] |
Fri, 21 November 2008 16:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> Sorry I have to ask again, i tried to scaled my data, and the result
> is right, but when I try to plot it, it just show me very few colors
> (almost bright color) Is it because of my color table? David? Thank
> you. BTW: i did scale it from 0 to 255.
Well, I don't think the CONTOUR command knows anything
about 24-bit colors. He is older, even, than I am. :-)
It's an odd color table, but why don't you just
load the colors and then tell the Contour command
to use an index into the color table, like this:
TVLCT, r, g, b
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=0, Get_Decomposed=theState
CONTOUR, ....., C_Colors=Indgen(64), ....
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=theState
That might work better. At least it is a place to start.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Why the contour does not show? [message #63963 is a reply to message #63877] |
Fri, 21 November 2008 16:04  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
On Nov 21, 4:16 pm, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> haha. That is fine, David, But another problem arouse, When I plot
>> like this:
>
>> map_set,limit=[-34.3842,min(lon),-31.6985,max(lon)], /noborder,color=0
>> map_grid, color=0,/label
>> map_continents,/countries, /coasts, color=0
>> contour,inits,color=0,xtitle='longtitude',ytitle='latitude', title='Sensible
>> heat flux', /device, /CELL_FILL, /Overplot
>
>> It showed the map, but also, it gave me an error:
>
>> Program caused arithmetic error: Floating underflow
>
>> Is it because my data is larger than the map or something?
>
> Oh, underflows can come from a lot of things. The chances
> are, however, that it is not something to worry over
> excessively:
>
> http://www.dfanning.com/math_tips/underflow.html
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
Sorry I have to ask again, i tried to scaled my data, and the result
is right, but when I try to plot it, it just show me very few colors
(almost bright color) Is it because of my color table? David? Thank
you. BTW: i did scale it from 0 to 255.
tvlct, r,g,b,/get
r(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
0,0,0,0,0,7,15,23,31,38,46,54,62,86,110,134,158,182,206,$
230,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 255,$
255,255,255,255,255,255,255,255,255,255]
g(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 0,0,$
0,0,0,0,0,28,56,84,112,140,168,196,224,227,231,235,239,243,2 47,$
251,255,249,243,237,232,226,220,214,209,182,156,130,104,78,5 2,$
26,0,0,0,0,0,0,0,0,0]
b(0:63)=
[255,238,221,204,187,170,153,136,119,102,85,68,51,34,17,0,0, 36,$
72,109,145,182,218,255,223,191,159,127,95,63,31,0,0,0,0,0,0, 0,$
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,63,95,127,159,191,223 ,255]
; calcualte the true color index of each color defined above
cn = r + 256L * ( g + 256L * b)
max = max(inits)
inits = (inits-min)/(max-min)
;print,inits
inits = inits*255
inits=fix(inits) ;Scale
map_set,limit=[-34.3842,min(lon),-31.6985,max(lon)],color=0, /noborder
map_grid, color=0
map_continents,/countries, /coasts, color=0
contour,inits,color=0,title='Sensible heat flux', /device,/
NOERASE,xrange=[0,76],/xstyle,xTICKINTERVAL=73,xTICKNAME=[lo n1(0),lon1
(3)],$
yrange=[0,73],/ystyle,yTICKINTERVAL=73,yTICKNAME=[lat1(3),la t1(0)],
$
C_COLORS=cn,/CELL_FILL
screenimg = tvrd(true=1)
write_jpeg, 'jja.jpg', screenimg, true=1
end
|
|
|
Re: Why the contour does not show? [message #63964 is a reply to message #63877] |
Fri, 21 November 2008 14:16  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> haha. That is fine, David, But another problem arouse, When I plot
> like this:
>
>
> map_set,limit=[-34.3842,min(lon),-31.6985,max(lon)], /noborder,color=0
> map_grid, color=0,/label
> map_continents,/countries, /coasts, color=0
> contour,inits,color=0,xtitle='longtitude',ytitle='latitude', title='Sensible
> heat flux', /device, /CELL_FILL, /Overplot
>
>
> It showed the map, but also, it gave me an error:
>
> Program caused arithmetic error: Floating underflow
>
> Is it because my data is larger than the map or something?
Oh, underflows can come from a lot of things. The chances
are, however, that it is not something to worry over
excessively:
http://www.dfanning.com/math_tips/underflow.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Why the contour does not show? [message #63966 is a reply to message #63877] |
Fri, 21 November 2008 13:48  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
On Nov 21, 3:45 pm, David Fanning <n...@dfanning.com> wrote:
> Reimar Bauer writes:
>> David Fanning schrieb:
>>> xiao writes:
>
>>>> Thanks David. These are useful. And I also found another mistake,
>>>> because the X,Y range are out of the display so it does not show the
>>>> data. Now, I am trying to put it in a map projection an d fill the
>>>> color......
>
>>> Well, more pitfalls (and reading) then:
>
>>> http://www.dfanning.com/color_tips/fill_colors.html
>
>>> Cheers,
>
>>> David
>
>> it is not only incorrect colors. missing data is also shown as data.
>> Can you provide the data for the examples.
>
> Humm. No, sorry. As I recall, that was from a private e-mail
> conversation. The data has long since disappeared. :-(
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
haha. That is fine, David, But another problem arouse, When I plot
like this:
map_set,limit=[-34.3842,min(lon),-31.6985,max(lon)], /noborder,color=0
map_grid, color=0,/label
map_continents,/countries, /coasts, color=0
contour,inits,color=0,xtitle='longtitude',ytitle='latitude', title='Sensible
heat flux', /device, /CELL_FILL, /Overplot
It showed the map, but also, it gave me an error:
Program caused arithmetic error: Floating underflow
Is it because my data is larger than the map or something?
Thanks very much :)
|
|
|
Re: Why the contour does not show? [message #63967 is a reply to message #63877] |
Fri, 21 November 2008 13:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Reimar Bauer writes:
> David Fanning schrieb:
>> xiao writes:
>>
>>> Thanks David. These are useful. And I also found another mistake,
>>> because the X,Y range are out of the display so it does not show the
>>> data. Now, I am trying to put it in a map projection an d fill the
>>> color......
>>
>> Well, more pitfalls (and reading) then:
>>
>> http://www.dfanning.com/color_tips/fill_colors.html
>>
>> Cheers,
>>
>> David
>
> it is not only incorrect colors. missing data is also shown as data.
> Can you provide the data for the examples.
Humm. No, sorry. As I recall, that was from a private e-mail
conversation. The data has long since disappeared. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Why the contour does not show? [message #63969 is a reply to message #63877] |
Fri, 21 November 2008 13:23  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
David Fanning schrieb:
> xiao writes:
>
>> Thanks David. These are useful. And I also found another mistake,
>> because the X,Y range are out of the display so it does not show the
>> data. Now, I am trying to put it in a map projection an d fill the
>> color......
>
> Well, more pitfalls (and reading) then:
>
> http://www.dfanning.com/color_tips/fill_colors.html
>
> Cheers,
>
> David
it is not only incorrect colors. missing data is also shown as data.
Can you provide the data for the examples.
cheers
Reimar
|
|
|