[ncl-talk] Fwd: Fwd: Adding your own longitude/latitude labels to a masked Lambert Conformal plot
Sinan Sahin
ssahin at nku.edu.tr
Fri Jun 24 10:42:06 MDT 2016
Dear Mary Haley
Thank you for your help, Best Regards
Sinan
---------- Forwarded message ----------
From: Mary Haley <haley at ucar.edu>
Date: 2016-06-24 17:18 GMT+02:00
Subject: Re: [ncl-talk] Fwd: Adding your own longitude/latitude labels to a
masked Lambert Conformal plot
To: Sinan Sahin <ssahin at nku.edu.tr>
Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
Hi,
Please respond back to ncl-talk for all follow-up so that everybody can
benefit from the answer.
I've modified the lcmask_4.ncl script to remove the contouring part and to
show how you might adjust the labels. I changed the example so that the
longitude range is extended, which causes the labels to flip.
--Mary
On Thu, Jun 23, 2016 at 7:10 AM, Sinan Sahin <ssahin at nku.edu.tr> wrote:
> Hello Dear Mary,
>
> Thank you for your answer, I tried adding 180 to the "txAngleF" but I
> believe this is for rotation of longitude lebels, the bad labels still
> exist and they are still inside the map. The problem is the location of the
> labels. The code for longitude labels are below. I will greatly appreciate
> if you look at it and tell me what is wrong in this code which I downloaded
> from Ncl web site. Thank you.
>
> ; Now do longitude labels. These are harder because we're not
> ; adding them to a straight line.
> ;
> ; Loop through lon values, and attach labels to the bottom edge of the
> ; masked LC plot.
> ;
> delete(txres at txPosXF)
> txres at txPosYF = -5.0
>
> ;---Pick some "nice" values for the longitude labels.
> lon_values = ispan(toint(minlon+10),toint(maxlon-10),10) * 1.
> nlon = dimsizes(lon_values)
>
> dum_bot = new(nlon,graphic) ; Dummy array to hold attached strings.
>
> do n=0,nlon-1
> ;
> ; For each longitude label, we need to figure out how much to rotate
> ; it, so get the approximate slope at that point.
> ;
> datatondc(map,lon_values(n)-0.25,minlat,lon1_ndc,lat1_ndc)
> datatondc(map,lon_values(n)+0.25,minlat,lon2_ndc,lat2_ndc)
> slope_bot = (lat1_ndc-lat2_ndc)/(lon1_ndc-lon2_ndc)
> txres at txAngleF = atan(slope_bot) * RAD_TO_DEG
> ;
> ; Create longitude label. Add extra carriage returns to
> ; move label away from plot.
> ;
> ;---Check if East, West, or Zero
> lon_label_bot = " ~C~ ~C~" + abs(lon_values(n)) + "~S~o~N~"
> if(lon_values(n).lt.0) then
> lon_label_bot = lon_label_bot + "W"
> end if
> if(lon_values(n).gt.0) then
> lon_label_bot = lon_label_bot + "E"
> end if
>
> ;---Attach to map.
> dum_bot(n) =
> gsn_add_text(wks,map,lon_label_bot,lon_values(n),minlat,txres)
> end do
> end
>
> Best Regards
>
> Sinan
>
> 2016-06-22 22:48 GMT+02:00 Mary Haley <haley at ucar.edu>:
>
>> I don't have time to look at why the code switches for those particular
>> labels, but I think you should be able to modify the code to check for
>> those bad labels, and add 180 to the "txAngleF" value that's being set.
>>
>> --Mary
>>
>>
>> On Wed, Jun 22, 2016 at 4:43 AM, Sinan Sahin <ssahin at nku.edu.tr> wrote:
>>
>>> Hello Dear Ncl Users,
>>>
>>>
>>>
>>> I have used the script "lcmask_4.ncl” for Masked Lambert Conformal
>>> Projections. The problem is the longitude values are inside the map
>>> (between 120W-160W and 80E-120E) when the center angle is higher than 180
>>> degree. I have attached my plot prepared with "lcmask_4.ncl" to show my
>>> problem. How can I fix this? Thank you all.
>>>
>>>
>>>
>>> Sinan
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/8ca0d755/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lcmask.png
Type: image/png
Size: 323183 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/8ca0d755/attachment-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lcmask_4.ncl
Type: application/octet-stream
Size: 6181 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/8ca0d755/attachment-0001.obj
More information about the ncl-talk
mailing list