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

Home » Public Forums » archive » cgDrawVectors over map problem?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: cgDrawVectors over map problem? [message #89625 is a reply to message #89620] Sun, 02 November 2014 09:23 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dave writes:

>
> Hi David:
>
> I want to use cgDrawVectors to draw wind over map, like this:
>
> mapNorth = Obj_New('cgMap', 'Polar Stereographic', Limit=[0, -180, 90, 180], /NoBorder)
> mapNorth -> Draw
>
> cgMap_Continents, Color='black', map_structure=mapNorth
> cgMap_Grid, LatDel=15, LonDel=15, LineStyle=1, Color='charcoal', /label, lonlabel=2, map_structure=mapNorth
>
> cgDrawVectors, 10, 0, 140, 40, vecColors='black', /Overplot, referencevector=10, /solid, thick=2, MapCoord=mapNorth
>
> In this example, the wind (u=10,v=0) should blow towards east. But the plotted wind blow towards right.
>
> That's to say, the wind direction does not fellow the map projection. So why. Very thanks!

Yikes! Bit of a problem here! :-(

This took quite a lot of thinking on my part. I don't think I got much
sleep last night. :-)

I understood my original mistake. I calculated the angle of the wind
vectors after I set up the map projection space. What I needed to do was
find a second point in the direction of the wind vectors, then transform
those two points into the map projection space, before calculating the
angle between them.

But then I couldn't figure out how to scale this vector to the reference
vector in the map space! Sigh...

Anyway, a couple more hours playing with this after coffee (LOTS of
coffee!) and I managed to get it working to my satisfaction. You can
find an updated program here:

http://www.idlcoyote.com/programs/cgdrawvectors.pro

I also added a map example (well, your example!) in the documentation
header. I've tried it with several other (and as perverse as I could
make them) map projections, and they all seem to work correctly.

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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL 6.1: X11 forward display. Mouse click not responsive on remote session.
Next Topic: polar_contour with log coordinates

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

Current Time: Wed Oct 08 11:44:46 PDT 2025

Total time taken to generate the page: 0.00406 seconds