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

Home » Public Forums » archive » Re: overlaying wind vectors on a map
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
Re: overlaying wind vectors on a map [message #70177] Tue, 23 March 2010 12:03 Go to next message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
"slippy133" <slippy133@yahoo.com> wrote in message
news:c2833c42-8235-44fc-9110-528cd16ccd0c@h35g2000pri.google groups.com...
> Hi,
...
> I have also used ivector, but that doesn't seem to overlay on current
> maps either.
>
> Is there a simple way to do this in IDL that I am simply unaware of?


I wrote a routine to do this. Here is the relevant snippet,

; here, i have zonal wind in "zon" and meridional wind in "mer"

wgood = where(finite(zon) eq 1, wgoodcount)

if wgoodcount eq 0 then return
arrowtail_lat = zon*!values.f_nan ; same as zon but full of NANs
arrowtail_lon = arrowtail_lat

; lon is col
; lat is row
; Decimate arrow points ; arrow at each point may be too much
decimating_index = lindgen(wgoodcount/decfactor)*decfactor
wgood = wgood(decimating_index) ; arrow at every 'n'th data point
arrowtail_lat_index = wgood/nlon
arrowtail_lon_index = wgood mod nlon
arrowtail_lat(arrowtail_lon_index,arrowtail_lat_index) =
lats(arrowtail_lat_index)
arrowtail_lon(arrowtail_lon_index,arrowtail_lat_index)=
lons(arrowtail_lon_index)

arrowhead_lat = arrowtail_lat + mer*mps_to_latlong_copy
arrowhead_lon = arrowtail_lon + zon*mps_to_latlong_copy



if n_elements(mapStruct) gt 0 then begin


resulttail =
MAP_PROJ_FORWARD(arrowtail_lon,arrowtail_lat,map_structure = mapstruct)
resulthead =
MAP_PROJ_FORWARD(arrowhead_lon,arrowhead_lat,map_structure = mapstruct)
arrowtail_lon = resulttail[0,*]
arrowtail_lat = resulttail[1,*]
arrowhead_lon = resulthead[0,*]
arrowhead_lat = resulthead[1,*]

; different map struct used, so conver (in uv coords here)
wbadwrap = where( abs(arrowtail_lon - arrowhead_lon) gt
19848285L, wbadwrapcount,complement=badwrapcomp)
; remove these
arrowtail_lon = arrowtail_lon(badwrapcomp)
arrowtail_lat = arrowtail_lat(badwrapcomp)
arrowhead_lon = arrowhead_lon(badwrapcomp)
arrowhead_lat = arrowhead_lat(badwrapcomp)


for i = 0, n_elements(arrowtail_lon)-1 do begin
arrow,arrowtail_lon(i),arrowtail_lat(i),$
arrowhead_lon(i),arrowhead_lat(i),data=1,color=arrowcolor,hs ize=newhsize,solid=solid
endfor
endif else begin
; data in lat lon coords

arrow,arrowtail_lon(*),arrowtail_lat(*),$
arrowhead_lon(*),arrowhead_lat(*),data=1,color=arrowcolor,hs ize=newhsize,solid=solid
endelse




cheers,
bob
Re: overlaying wind vectors on a map [message #70262 is a reply to message #70177] Wed, 24 March 2010 06:01 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Why you don't use the VELOVECT routine ?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Detecting whether a user-defined System Variable is in use
Next Topic: adding subset image into larger one

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

Current Time: Wed Oct 08 11:37:06 PDT 2025

Total time taken to generate the page: 0.00628 seconds