[ncl-talk] CylindricalEqualArea map projection problems

Mary Haley haley at ucar.edu
Wed Mar 14 08:10:09 MDT 2018


Hi Marc,

[Adam, thanks for the assist.]

I think what's happening is that the default tickmark behavior (when you
set pmTickMarkDisplayMode set to "Always") is that no tickmark labels will
appear at the top or right. You can turn them on by setting:

  res at tmXTOn                 = True    ; turn on top tickmarks
  res at tmYROn                 = True    ; turn on right tickmarks
  res at tmXTLabelsOn           = True    ; turn on top tickmark labels
  res at tmYRLabelsOn           = True    ; turn on right tickmark labels

The work-around Adam provided is perfectly valid and allows you more
control over how you label things.

--Mary


On Tue, Mar 13, 2018 at 1:03 PM, Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Marc,
> Mary created a function a while ago that can accomplish this that is
> buried in map tickmarks example #9 here:
> http://www.ncl.ucar.edu/Applications/mptick.shtml#ex9
>
> I modified your snippet of code to include the gsn_add_tickmarks function,
> and the resulting script and output is attached.
> Let ncl-talk know if you have any further queries..
> Adam
>
> On Tue, Mar 13, 2018 at 10:18 AM, Marc Michelsen <marc at u.washington.edu>
> wrote:
>
>> Hi Adam,
>>
>> That worked but strangely it also got rid of the latitude tickmarks and
>> labels. Looks like this now:
>>
>>
>>
>> ncl script is below. Anyway to get them back?
>> Thanks,
>> Marc
>>
>> 243 olympus% cat maponly.ncl
>> begin
>>
>>   wks  = gsn_open_wks("eps","maponly")
>>   res                        = True
>>   res at mpOceanFillColor       = "cyan"
>>   res at mpLandFillColor        = "sienna"
>>   res at mpInlandWaterFillColor = "cyan"
>> ;  res at mpProjection = "CylindricalEquidistant"
>>   res at mpProjection = "CylindricalEqualArea"
>>   res at mpLimitMode = "LatLon"
>>   res at mpMinLatF = -45.
>>   res at mpMaxLatF = 45.
>>   res at pmTickMarkDisplayMode = "Always"
>>   plot = gsn_csm_map(wks,res)
>>   delete(wks)
>>   system("convert -trim -density 133 maponly.eps maponly.png")
>>
>>  end
>> 244 olympus%
>>
>>
>>
>> On 3/13/2018 8:54 AM, Adam Phillips wrote:
>>
>> Hi Marc,
>> Try also setting:
>> res at mpLimitMode = "LatLon"
>> I think that setting is implied when using the cylindrical equidistant
>> project, but is needed to use the mp*LatF resources for other projections..
>> Adam
>>
>> On Tue, Mar 13, 2018 at 9:26 AM, Marc Michelsen <marc at u.washington.edu>
>> wrote:
>>
>>> Hi Mary,
>>>
>>> Thank you, that fixed the tickmarks and labels, but what about the min
>>> and max latitude?
>>> It's still rendered from -90 to 90 despite setting
>>> res at mpMinLatF = -45.
>>> res at mpMaxLatF = 45.
>>>
>>> Thanks,
>>> Marc
>>>
>>> On 3/13/2018 7:15 AM, Mary Haley wrote:
>>>
>>> Hi Marc,
>>>
>>> The simple solution is to set:
>>>
>>>   res at pmTickMarkDisplayMode = "Always"
>>>
>>> ​The longish explanation is that it used to be that you couldn't get map
>>> tickmark labels at all, so for C.E. plots, we created some special code to
>>> explicitly add labels. This is what you see in the original plot.  We
>>> didn't do this for other map projections because we knew that eventually
>>> the internal code would be enhanced to get labels for other map
>>> projections. This internal code only gets activated by the "​pmTickMarkDisplayMode"
>>> resource, which is a Plot Manager resource that if you give it a value of
>>> "Always", it will force the map tickmarks to be added. We haven't made this
>>> the default yet because the internal code is not really complete. I think
>>> at some point we may just turn this on and make it the default.
>>>
>>> --Mary
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sat, Mar 10, 2018 at 8:45 AM, Marc Michelsen <marc at u.washington.edu>
>>> wrote:
>>>
>>>> Hi NCLers,
>>>>
>>>> When I use the CylindricalEquidistant map projection it looks great:
>>>>
>>>> 3414 olympus% cat maponly.ncl
>>>> begin
>>>>   wks  = gsn_open_wks("png","maponly")
>>>>   res                        = True
>>>>   res at mpOceanFillColor       = "cyan"
>>>>   res at mpLandFillColor        = "sienna"
>>>>   res at mpInlandWaterFillColor = "cyan"
>>>>   res at mpProjection = "CylindricalEquidistant"
>>>> ;  res at mpProjection = "CylindricalEqualArea"
>>>>   res at mpMinLatF = -45.
>>>>   res at mpMaxLatF = 45.
>>>>   plot = gsn_csm_map(wks,res)
>>>>   delete(wks)
>>>>   system("convert -trim maponly.png maponly.png")
>>>>   end
>>>> 3415 olympus% ncl < maponly.ncl
>>>>  Copyright (C) 1995-2017 - All Rights Reserved
>>>>  University Corporation for Atmospheric Research
>>>>  NCAR Command Language Version 6.4.0
>>>>  The use of this software is governed by a License Agreement.
>>>>  See http://www.ncl.ucar.edu/ for more details.
>>>> 3416 olympus%
>>>>
>>>>
>>>>
>>>> However if I switch to
>>>> res at mpProjection = "CylindricalEqualArea"
>>>> I get this:
>>>>
>>>>
>>>>
>>>> i.e. no tickmarks, no lat/lon labels and the min max latitude are not
>>>> respected. Is this a bug or am I missing something?
>>>>
>>>> Thanks,
>>>>
>>>> Marc
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726 <(303)%20497-1726>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726 <(303)%20497-1726>
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180314/720b8953/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ojjeifeicjejhjeh.png
Type: image/png
Size: 23107 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180314/720b8953/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kfpmligoddaogcja.png
Type: image/png
Size: 15095 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180314/720b8953/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icbhafbaaojgafnk.png
Type: image/png
Size: 4840 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180314/720b8953/attachment-0005.png>


More information about the ncl-talk mailing list