Re: cgDrawVectors over map problem? [message #89629 is a reply to message #89625] |
Sun, 02 November 2014 16:10   |
Dave[4]
Messages: 38 Registered: December 2007
|
Member |
|
|
在 2014年11月3日星期一UTC+8上午1时23分18秒,David Fanning写道:
> 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.")
Hi, David:
Now cgDrawVector works with map projection. Very thanks!
Dave
|
|
|