why does not show the number correctly

This is a discussion on why does not show the number correctly within the Idl-pvwave forums in Programming Languages category; 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,05 1,000,102,051,102,051,000,102] g=[255,102,102,153,204,102,000,204,255,000,051,000,05 1,000,000,051,000,000,051,051] b=[255,153,102,102,102,204,051,204,051,153,051,102,10 2,204,051,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',/ ...

Go Back   Application Development Forum > Programming Languages > Idl-pvwave

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-29-2008, 11:12 AM
xiao
Guest
 
Default why does not show the number correctly

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,05 1,000,102,051,102,051,000,102]

g=[255,102,102,153,204,102,000,204,255,000,051,000,05 1,000,000,051,000,000,051,051]

b=[255,153,102,102,102,204,051,204,051,153,051,102,10 2,204,051,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=[lat_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
Reply With Quote
  #2  
Old 08-29-2008, 11:20 AM
David Fanning
Guest
 
Default Re: why does not show the number correctly

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.")
Reply With Quote
  #3  
Old 08-29-2008, 11:29 AM
xiao
Guest
 
Default Re: why does not show the number correctly

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)
Reply With Quote
  #4  
Old 08-29-2008, 11:49 AM
David Fanning
Guest
 
Default Re: why does not show the number correctly

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.")
Reply With Quote
  #5  
Old 08-29-2008, 11:53 AM
xiao
Guest
 
Default Re: why does not show the number correctly

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.
Reply With Quote
  #6  
Old 08-29-2008, 12:05 PM
xiao
Guest
 
Default Re: why does not show the number correctly

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....
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:29 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.