(cG) windbarb problem [message #88157] |
Tue, 25 March 2014 06:09  |
natha
Messages: 482 Registered: October 2007
|
Senior Member |
|
|
Hi all,
I am using the Windbarb program and I am having the following problems:
1) The angle of the barb is not properly represented
2) The position of the barb is wrong
I have reproduced both errors in the following example
device, dec=0
!p.background=255
!p.color=0
limit=[20.,-128.,53.,-65.]
map_set, 0, 0, limit=limit, position=[0,0,1,1], /noborder, /isotropic, /mercator
map_continents, /countries, /coasts
windbarb, [-110], [35], [50.], [45.], length=0.2, color=[0,0,0]
plots, [-110], [35], psym=1
I was expecting the barb to be oriented 45 deg and it is not the case... Also, I was expecting the barb to start at the exact position -110, 35.
Thank you in advance for your help,
nata
|
|
|
Re: (cG) windbarb problem [message #88158 is a reply to message #88157] |
Tue, 25 March 2014 06:23   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
nata writes:
> I am using the Windbarb program and I am having the following problems:
>
> 1) The angle of the barb is not properly represented
> 2) The position of the barb is wrong
>
> I have reproduced both errors in the following example
>
> device, dec=0
>
> !p.background=255
> !p.color=0
>
> limit=[20.,-128.,53.,-65.]
>
> map_set, 0, 0, limit=limit, position=[0,0,1,1], /noborder, /isotropic, /mercator
>
> map_continents, /countries, /coasts
>
> windbarb, [-110], [35], [50.], [45.], length=0.2, color=[0,0,0]
>
> plots, [-110], [35], psym=1
>
> I was expecting the barb to be oriented 45 deg and it is not the case... Also, I was expecting the barb to start at the exact position -110, 35.
>
> Thank you in advance for your help,
Yes, there are probably all *kinds* of things wrong with that old
program. But, no time to work on it at the moment. Sorry.
It needs to be completely rewritten, I would think.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|
|
Re: (cG) windbarb problem [message #88162 is a reply to message #88160] |
Tue, 25 March 2014 06:41   |
natha
Messages: 482 Registered: October 2007
|
Senior Member |
|
|
I fixed the routine by using the CLIP keyword and by modifying the lines 245 and 246
x1 = clip[0] > (xx[j] + sindr * sr) < clip[2]
y1 = clip[1] > (yy[j] + cosdr * sr * aspect) < clip[3]:
by
x1 = clip[0] > (xx[j]) < clip[2]
y1 = clip[1] > (yy[j]) < clip[3]
Now everything is working properly
device, dec=0
!p.background=255
!p.color=0
limit=[20.,-128.,53.,-65.]
dim=[800,800]
window, 0, xsize=dim[0], ysize=dim[1]
map_set, 0, 0, limit=limit, position=[0,0,1,1], /noborder, /isotropic, /mercator
map_continents, /countries, /coasts
uv_box=!map.uv_box
aspect_ratio=(uv_box[2]-uv_box[0])/(uv_box[3]-uv_box[1])
data=intarr(100,100)
temp=map_image(data,xstart,ystart,xsize,ysize,latmin=limit[0 ],latmax=limit[2],$
lonmin=limit[1],lonmax=limit[3],/compress)
clip=[xstart,ystart,xstart+xsize,ystart+ysize]/float([dim,di m])
windbarb, [-110], [35], [50.], [45.], length=0.3, color=[0,0,0], clip=clip, aspect=1.
plots, [-110], [35], psym=1
|
|
|
|
|