Re: Annotation on map

From: Andrea N. Hahmann <ahah_at_nyahnyahspammersnyahnyah>
Date: Thu May 24 2012 - 09:41:22 MDT

I finally got it to work. I am posting the solution because it might be
useful to somebody else.

The trick was to use the actual coordinates of the edges of the map (not
datatondc) and because my map was CE (an thus linear):

      x_out = -0.5 + (xlon(i,j)-xlonW)/(xlonE-xlonW)
      y_out = 0.5 - (xlat(i,j)-xlatS)/(xlatN-xlatS)

      amres@amParallelPosF = x_out
      amres@amOrthogonalPosF = y_out

Where xlatS, xlatN, xlonE and xlonW are the edges of the map. The
resulting plot with many wind roses is attached.

Andrea

On 5/24/12 5:03 PM, "Andrea N. Hahmann" <ahah@dtu.dk> wrote:

>Hi Mary
>
>This was a simplified example. I actually what to place a bunch of wind
>roses on a map, but with my first attempt they were all coming in the
>wrong place! I think I understand what I need to do, but don't quite know
>how to do it.
>
>Many thanks, Andrea
>
>On 5/24/12 4:49 PM, "Mary Haley" <haley@ucar.edu> wrote:
>
>>Hi Andrea,
>>
>>I think part of the problem is your setting for amParallelPosF and
>>amOrthogonalPosF. These are supposed to be small values, like 0.5 or -0.5
>>to move stuff away from the center of the plot.
>>
>>When you use gsn_add_annotation to attach an object to plot, the default
>>is that the object gets attached to the center of the plot. So, I think
>>that since your center is already at 15E, 55N,
>>then hopefully you shouldn't need amParallelPosF and amOrthogonalPosF at
>>all.
>>
>>If all you are trying to do is attach a text string, can you use
>>gsn_add_text?
>>
>>--Mary
>>
>>On May 24, 2012, at 5:17 AM, Andrea N. Hahmann wrote:
>>
>>> Good morning (to most of you),
>>>
>>> I have a problem locating an annotation on a map. In the attached
>>>script I make a simple map whose center is near 15.E 55.N. Then, I try
>>>to locate an annotation at these coordinates:
>>>
>>> datatondc(base_map,15.,55.,x_out,y_out)
>>> print(x_out+" "+y_out)
>>> amres@amParallelPosF = x_out
>>> amres@amOrthogonalPosF = y_out
>>> amres@amJust = "CenterCenter"
>>> annoid = gsn_add_annotation(base_map, txid, amres) ; Attach string
>>>to plot
>>>
>>> First of all x_out and y_out are not near the center (0.,0.) and the
>>>string ends up at the lower left corner of the map. I am probably doing
>>>something wrong, but I don't know what it is.
>>>
>>> Thanks,
>>> Andrea
>>> ----
>>> Andrea N. Hahmann
>>> Senior Scientist
>>> DTU Wind Energy
>>>
>>> Technical University of Denmark
>>> Risų Campus
>>> Frederikborgvej 399, P.O. Box 49
>>> 4000 Roskilde, Denmark
>>>
>>> Direct +45 4677 5471
>>> Mobil: +45 2133 0550
>>> ahah@dtu.dk
>>> http://www.vindenergi.dtu.dk/
>>>
>>> <TestMap.ncl><Map.pdf>_______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Thu May 24 09:42:09 2012

This archive was generated by hypermail 2.1.8 : Fri May 25 2012 - 08:35:50 MDT