comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » why does not show the number correctly
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
why does not show the number correctly [message #62171] Fri, 29 August 2008 08:12 Go to next message
xiao zhang is currently offline  xiao zhang
Messages: 81
Registered: June 2008
Member
Hi~ everyone. This the the part of my program. The data is all right
here, But when I run it , the number of my color bar and the grids
does not show right. (Like letter or something ) Why is that? Anyone
can help?
Thank you

device, decomposed=0,retain=2
window,1,xsize=np,ysize=nl+10

;define the display window

!P.background=FSC_Color('Gray')
dd=fltarr(np,nl+10,3)
dd(*,*,*)=255
tv,dd,true=3


r=[255,255,000,204,000,153,102,051,204,051,051,102,051,000,1 02,051,102,051,000,102]

g=[255,102,102,153,204,102,000,204,255,000,051,000,051,000,0 00,051,000,000,051,051]

b=[255,153,102,102,102,204,051,204,051,153,051,102,102,204,0 51,000,000,153,051,000]
tvlct,r,g,b

class='!20!b'+
['0','1','2','3','4','5','6','7','8','9','10','11','12','13' ,'14','15','16','17','18','19','20']
xxx=indgen(20)*40
yyy=[nl, nl, nl,nl, nl,nl,nl, nl, nl,nl, nl,nl,nl, nl, nl,nl,
nl,nl,nl, nl, nl,nl, nl,nl]

lat_min=-35.3
lat_max=-28.1

lon_min=113.64
lon_max=122.14

;defind the max and min latitude and longtitude of the data area

map=MAP_PROJ_INIT('Polar Stereographic',/
GCTP,center_longitude=117.89,center_latitude=-31.7,limit=[la t_min,lon_min,lat_max,lon_max])

r= MAP_PROJ_FORWARD([lon_min,lon_max],[lat_min,lat_max],/
fill,MAP_STRUCTURE=map)

result=map_proj_image(percumulus,
[lon_min,lat_min,lon_max,lat_max],MAP_STRUCTURE=map,missing= 0)

;display the data to the map

pos = [0.05, 0.05, 0.95, 0.95]
tvimage,result, position=pos,/KEEP_ASPECT,/tv,order=1

Plot, [r[0,0],r[0,1]], [r[1,0], r[1,1]], Position=pos,/Nodata,
XStyle=5, YStyle=5, /NoErase
MAP_GRID,/label,linestyle=0, map_structure=map,
color=FSC_Color('black'),glinethick=2,charthick=2,charsize=2
; Draw gridlines over the map

MAP_CONTINENTS, map_structure=map,
color=FSC_Color('black'),mlinethick=2
; Draw continent outlines:

for i=0, 19 do begin
plots,[xxx(i), xxx(i)+40], [yyy(i), yyy(i)], color=i, thick=20,/
device
xyouts, xxx(i), nl-20,
class(i),charsize=2,charthick=1.5,color=35,/device
endfor
;second step to draw a color bar

Write_Jpeg, 'percumulus2006.jpg', tvrd(true=1), true=1
Re: why does not show the number correctly [message #62263 is a reply to message #62171] Fri, 29 August 2008 09:05 Go to previous message
xiao zhang is currently offline  xiao zhang
Messages: 81
Registered: June 2008
Member
On Aug 29, 10:53 am, xiao <littledd...@gmail.com> wrote:
> On Aug 29, 10:49 am, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> xiao writes:
>>> Sorry David. I am not sure what you mean , do you mean I have to
>>> convert the number in this line? I mean the number in percumulus?
>>> Thank you
>
>>> result=map_proj_image(percumulus,
>>> [lon_min,lat_min,lon_max,lat_max],MAP_STRUCTURE=map,missing= 0)
>
>> Well, let's see. I didn't run your code, but what the
>> hell is it you mean to have in your class variable?
>> I can't make heads or tails of it. That is probably the
>> problem. :-)
>
>> IDL> print, class
>> !20!b0 !20!b1 !20!b2 !20!b3 !20!b4 !20!b5 !20!b6 !20!b7 !20!b8 !20!b9 !
>> 20!b10 !20!b11 !20!b12
>> !20!b13 !20!b14 !20!b15 !20!b16 !20!b17 !20!b18 !20!b19 !20!b20
>
>> Those look like bytes converted to strings to me (or
>> something, God knows!). What are they suppose to be?
>
>> 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.")
>
> They are just the number of my color bar. :)

Sorry , David, I just delete the '!20!b' before class ,and then it
works....
Re: why does not show the number correctly [message #62264 is a reply to message #62171] Fri, 29 August 2008 08:53 Go to previous message
xiao zhang is currently offline  xiao zhang
Messages: 81
Registered: June 2008
Member
On Aug 29, 10:49 am, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> Sorry David. I am not sure what you mean , do you mean I have to
>> convert the number in this line? I mean the number in percumulus?
>> Thank you
>
>> result=map_proj_image(percumulus,
>> [lon_min,lat_min,lon_max,lat_max],MAP_STRUCTURE=map,missing= 0)
>
> Well, let's see. I didn't run your code, but what the
> hell is it you mean to have in your class variable?
> I can't make heads or tails of it. That is probably the
> problem. :-)
>
> IDL> print, class
> !20!b0 !20!b1 !20!b2 !20!b3 !20!b4 !20!b5 !20!b6 !20!b7 !20!b8 !20!b9 !
> 20!b10 !20!b11 !20!b12
> !20!b13 !20!b14 !20!b15 !20!b16 !20!b17 !20!b18 !20!b19 !20!b20
>
> Those look like bytes converted to strings to me (or
> something, God knows!). What are they suppose to be?
>
> 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.")

They are just the number of my color bar. :)
Re: why does not show the number correctly [message #62265 is a reply to message #62171] Fri, 29 August 2008 08:49 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
xiao writes:

> Sorry David. I am not sure what you mean , do you mean I have to
> convert the number in this line? I mean the number in percumulus?
> Thank you
>
> result=map_proj_image(percumulus,
> [lon_min,lat_min,lon_max,lat_max],MAP_STRUCTURE=map,missing= 0)

Well, let's see. I didn't run your code, but what the
hell is it you mean to have in your class variable?
I can't make heads or tails of it. That is probably the
problem. :-)

IDL> print, class
!20!b0 !20!b1 !20!b2 !20!b3 !20!b4 !20!b5 !20!b6 !20!b7 !20!b8 !20!b9 !
20!b10 !20!b11 !20!b12
!20!b13 !20!b14 !20!b15 !20!b16 !20!b17 !20!b18 !20!b19 !20!b20

Those look like bytes converted to strings to me (or
something, God knows!). What are they suppose to be?

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 does not show the number correctly [message #62268 is a reply to message #62171] Fri, 29 August 2008 08:29 Go to previous message
xiao zhang is currently offline  xiao zhang
Messages: 81
Registered: June 2008
Member
On Aug 29, 10:20 am, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> Hi~ everyone. This the the part of my program. The data is all right
>> here, But when I run it , the number of my color bar and the grids
>> does not show right. (Like letter or something ) Why is that? Anyone
>> can help?
>
> It is because the number is a byte, and bytes, when they are converted
> to strings, are converted "literally". Most literal characters
> cannot be represented on computers. Make this number
> an INT before you convert it to a string for display.
>
> 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. I am not sure what you mean , do you mean I have to
convert the number in this line? I mean the number in percumulus?
Thank you

result=map_proj_image(percumulus,
[lon_min,lat_min,lon_max,lat_max],MAP_STRUCTURE=map,missing= 0)
Re: why does not show the number correctly [message #62269 is a reply to message #62171] Fri, 29 August 2008 08:20 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
xiao writes:

> Hi~ everyone. This the the part of my program. The data is all right
> here, But when I run it , the number of my color bar and the grids
> does not show right. (Like letter or something ) Why is that? Anyone
> can help?

It is because the number is a byte, and bytes, when they are converted
to strings, are converted "literally". Most literal characters
cannot be represented on computers. Make this number
an INT before you convert it to a string for display.

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Two named structures with the same name that won't concatenate. Any suggestions?
Next Topic: write widget_table out to file?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:40:46 PDT 2025

Total time taken to generate the page: 0.00793 seconds