Re: setting major and minor lat/lon spacing

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jun 03 2014 - 08:44:03 MDT

Hi Frank,

I think you are almost there. It looks like you are overwriting the custom tickmarks that you created by regenerating the plot with the "old" style tickmarks.

For example, you are first calling:

   plot = gsn_csm_map(wks,res) ; Create plot

and then

   plot = add_map_tickmarks(wks,plot,tmres)

and then

   plot = gsn_csm_contour_map(wks,u,res)

The first two calls will create a map plot and attach the custom tickmarks. But then the third call is creating a whole new plot from scratch, overwriting all the previous work you did.

I think what you want is to call

   plot = gsn_csm_contour_map(wks,u,res)

without drawing it, and then:

   plot = add_map_tickmarks(wks,plot,tmres)

to attach the custom map tickmarks. Please see the attached modified script. I tested it out with generating a contour plot (since I don't have your NetCDF file), and it seems to work fine. See the attached image.

I'm interested in how the longer labels were changing the look of your plot. Maybe it's something we could fix? Do you have a sample of how the plot looks with the longer labels?

Thanks,

--Mary

On Jun 2, 2014, at 5:54 AM, Kreienkamp Frank <Frank.Kreienkamp@dwd.de> wrote:

> Hello Mary,
>
> if have tried your suggestion, but i failed.
>
> As you can see in the attached file i have added the redefinition of the
> function add_map_tickmarks. The interesting thing is, that the added
> function (incl. the new lines 320 to 327 in the main program) do not
> have any impact. Is it possible that i have missed some thing?
>
> All i want to do, is to disable the additional labels due to the small
> range (--> degree values only --> no additional minute-values).
>
> I could live with those additional minute-values if those labels would
> not change the hole picture. All my:
> amres1@amParallelPosF = -0.73
> amres1@amOrthogonalPosF = 0.88
> have a different meaning with and without the additional minute-values
> at the thick-marks.
>
> Thanks in advance
> Frank
>
>
>
>
>
>
>
>
> Am Mittwoch, den 28.05.2014, 08:08 -0600 schrieb Mary Haley:
>> Hi Frank,
>>
>> There are two types of map tickmarks that you can get with the gsn_xxxx scripts.
>>
>> The default map tickmarks, which don't have degree symbols, recognize the resources you're using.
>>
>> Under the hood, in the gsn_code.ncl script, these map tickmarks are created by hand, because at the time, we had no automatic way to get tickmarks on maps. This is the code that recognizes the gsnMajor/Minor resources,
>>
>> A few years later Dave created a way to get automatic tickmarks that give you the nice degree symbol. These are the tickmarks that you get when you set:
>>
>> res@pmTickMarkDisplayMode = "Always"
>>
>> These tickmarks are actually part of the TickMark object, and are not created by gsn_code.ncl,and hence they don't recognize any of the gsnMajor/Minor resources. These tickmarks are not very customizable unfortunately.
>>
>> If you want more custom tickmarks, see example mptick_9.ncl at:
>>
>> http://www.ncl.ucar.edu/Applications/mptick.shtml#ex9
>>
>> You will need to copy the "add_map_tickmarks" function to the top of your script, and then call it after you create your map, with something like:
>>
>> res@tmYLValues = ispan(51,53,1) ; this gives you tickmarks and labels at 51, 52, and 53
>> res@tmXBValues = ispan(11,15,1) ; 11, 12, 13, 14, 15
>>
>> ;---Attach the new map tickmarks.
>> map = add_map_tickmarks(wks,map,res)
>>
>>
>> You can look at examples mptick_10 and mptick_11 for other methods.
>>
>> --Mary
>>
>> On May 27, 2014, at 11:26 PM, Kreienkamp Frank <Frank.Kreienkamp@dwd.de> wrote:
>>
>>> Hello,
>>>
>>> i have a map in stereographic projection (see attached png.file). The
>>> system is automatically adding a setting for major and minor lat/lon
>>> labels.
>>>
>>> Using the lines:
>>> res@gsnMajorLatSpacing = 1
>>> res@gsnMinorLatSpacing = 1
>>> res@gsnMajorLonSpacing = 1
>>> res@gsnMinorLonSpacing = 1
>>> i try to change the default setting. Unfortunately i get the following
>>> warnings and nothing happens.
>>>
>>> warning:gsnMajorLatSpacing is not a valid resource in map at this time
>>> warning:gsnMajorLonSpacing is not a valid resource in map at this time
>>> warning:gsnMinorLatSpacing is not a valid resource in map at this time
>>> warning:gsnMinorLonSpacing is not a valid resource in map at this time
>>> warning:gsnMajorLatSpacing is not a valid resource in
>>> temp-develop_contour at this time
>>> warning:gsnMajorLonSpacing is not a valid resource in
>>> temp-develop_contour at this time
>>> warning:gsnMinorLatSpacing is not a valid resource in
>>> temp-develop_contour at this time
>>> warning:gsnMinorLonSpacing is not a valid resource in
>>> temp-develop_contour at this time
>>>
>>> What can i do to manually define the lat/lon label spacing? I want to
>>> have only full degree labels 52 and 53°N.
>>>
>>> Thanks in advance
>>> Frank
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> <temp-develop.ncl><temp-develop.png>_______________________________________________
>>> 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
> <temp-develop.ncl>

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

temp-develop.png
Received on Tue Jun 3 08:44:16 2014

This archive was generated by hypermail 2.1.8 : Tue Jun 03 2014 - 11:40:09 MDT