[ncl-talk] gsn_contour_shade

Laura Fowler laura at ucar.edu
Thu Jul 19 19:33:02 MDT 2018


Hi Adam:

I really appreciate you looking at my script. Let me reply first to your
last question regarding my call to gsn_csm_shade. The picture I attached to
my last e-mail shows the cloud liquid water path on the top of which I want
to overlay cloud-top temperatures.

For the cloud liquid water path, I use:

res at cnFillMode               = "RasterFill"

res at cnFillOn                 = True

res at cnLinesOn                = False

I only want to overlay cloud-top temperatures in the range between 248K and
268K. To do this, and prior to my call the gsn_csm_shade, I set:


ores at cnFillOn       = False

ores at cnLinesOn      = False

ores at cnLineLabelsOn = False

to not have contour lines on the top of the shading. If I set cnLines to
True, then I have contour lines on the top of the shading.


About your question regarding my values of lowval and highval, I set lowval
to 268 "so that  all areas less than that first contour will be shaded" as
explained in the definition of lowval. Same for highval so that "all areas
greater than that first contour will be shaded" as also explained in the
definition.

In other words, I was trying to replicate the function
ColorShadeLeGeContour which is now deprecated. This is the reason I used

plot2 = gsn_contour_shade(plot2,268,248,opt)


instead of


plot2 = gsn_contour_shade(plot2,248,268,opt)

Hope this makes more sense although that did not solve the issue about
the line thickness.


Cheers,

Laura









On Thu, Jul 19, 2018 at 4:02 PM, Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Laura,
> Looking at your script, you are turning the lines off in your res and ores
> resource list. gsn_contour_shade simply fills areas between existing
> contour lines, it does not turn on certain lines nor alter their thickness.
> If you could elaborate a bit on what you're trying to do that would be
> helpful.
>
> Note: You are setting this in gsn_contour_shade:
> plot2 = gsn_contour_shade(plot2,268,248,opt)
> The 2nd input in this function represents the low value, beneath which the
> first contour and all contours less than this value should be shaded. The
> 3rd option represents the high value, above or equal to which the first
> contour and all contours greater than this value will be shaded. (This
> function does not necessarily shade between exact values .) I think you
> want to reverse those two inputs here.
> Adam
>
> On Thu, Jul 19, 2018 at 2:09 PM Laura Fowler <laura at ucar.edu> wrote:
>
>> Adam and Rick:
>>
>> I had tried Adam's suggestion earlier
>>
>> ores at cnMonoLineThickness = True
>>
>> ores at cnLineThicknessF    = 3.0
>>
>> but that did not work. Rick's suggestion did not work either:
>>
>> ores at gsnContourLineThicknessesScale = 2.0
>>
>>
>> May be we just can't do this with gsn_csm_shade after all. I also tried
>> to include them in the opt option used in the call to gsn_csm_shade, but
>> that did not work either.
>>
>>
>> Many thanks,
>> Laura
>>
>>
>> On Thu, Jul 19, 2018 at 1:55 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>>
>>> Hi Laura,
>>> Rick's suggestion should work. Alternatively you can set
>>> cnLineThicknessF (to say, 2.0) within your ores resource list. Even though
>>> it won't be used in the initial plot call, it will still be used when
>>> gsn_contour_shade is called..
>>> Adam
>>>
>>> On Thu, Jul 19, 2018 at 1:51 PM Rick Brownrigg <brownrig at ucar.edu>
>>> wrote:
>>>
>>>> Hi Laura,
>>>>
>>>> I don't know with certainty that this works, but you might try:
>>>>
>>>> *gsnContourLineThicknessesScale* This resource, recognized by any gsn
>>>> contour <http://ncl.ucar.edu/Document/Graphics/Interfaces/#Contours>
>>>> drawing routine, allows you to set line thickness scale factors for all
>>>> contour lines. For example, aq value of 2.0 will make the lines twice as
>>>> thick. If this is set to an array that is not large enough to handle all
>>>> contour lines, then the default value of 1.0 will be used for the remaining
>>>> contour lines.
>>>>
>>>> On Thu, Jul 19, 2018 at 12:47 PM, Laura Fowler <laura at ucar.edu> wrote:
>>>>
>>>>> Hi Adam:
>>>>> Thanks for your help. Now it did work (see attached plot). Is there a
>>>>> way by chance to increase the thickness of the individual lines? Looking at
>>>>> the documentation on gsm_csm_shade, it does not seem to be an option,
>>>>> except that of increasing the density of lines?
>>>>>
>>>>> Thanks,
>>>>> Laura
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Jul 19, 2018 at 12:12 PM, Adam Phillips <asphilli at ucar.edu>
>>>>> wrote:
>>>>>
>>>>>> Hi Laura,
>>>>>> Try adding:
>>>>>> ores at cnLineLabelsOn = False
>>>>>> Adam
>>>>>>
>>>>>> On Thu, Jul 19, 2018 at 12:09 PM Laura Fowler <laura at ucar.edu> wrote:
>>>>>>
>>>>>>> Hi Adam:
>>>>>>>
>>>>>>> Thanks for your help. It did work after switching to
>>>>>>> gsn_csm_contour. I followed your suggestion and added separate resources
>>>>>>> for plot2 to remove the "mp" warning messages.
>>>>>>>
>>>>>>> Despite adding the following lines:
>>>>>>>
>>>>>>> ores at cnFillOn      = False
>>>>>>>
>>>>>>> ores at cnLinesOn     = False
>>>>>>>
>>>>>>> ores at cnLevelFlags  = "NoLine"
>>>>>>>
>>>>>>> ores at cnInfoLabelOn = False
>>>>>>>
>>>>>>> to my second (ores) set of ressources, I still get labels attached
>>>>>>> to the shading. Which additional option do I need to add to remove those
>>>>>>> extra labels so that the output looks like the one in overlay.ncl?
>>>>>>>
>>>>>>> Many thanks,
>>>>>>> Laura
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Jul 19, 2018 at 11:39 AM, Adam Phillips <asphilli at ucar.edu>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi Laura,
>>>>>>>> One can't overlay a plotting type with a map over another plotting
>>>>>>>> class with a map. This should work:
>>>>>>>> plot  = gsn_csm_contour_map(wks,lwpath_a(:,:,n),res)
>>>>>>>> plot2 = gsn_csm_contour(wks,cldtopt_a(:,:,n),res)
>>>>>>>> overlay(plot,plot2)
>>>>>>>>
>>>>>>>> You are getting the various mp* errors as you can't pass mp
>>>>>>>> resources to a non-map plotting function, in this case gsn_csm_contour. You
>>>>>>>> should be able to safely ignore those messages as everything will still
>>>>>>>> work; NCL is just telling you it is ignoring some of your resources. If you
>>>>>>>> would like to get rid of the messages though, I would recommend you create
>>>>>>>> a new resource list, res2, for your cldtopt_a array that excludes mp
>>>>>>>> resources.
>>>>>>>> Hope that helps!
>>>>>>>> Adam
>>>>>>>>
>>>>>>>> On Thu, Jul 19, 2018 at 11:33 AM Laura Fowler <laura at ucar.edu>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hello:
>>>>>>>>>
>>>>>>>>> I am following the ncl script overlay_5.ncl to overlay shading
>>>>>>>>> over a contour plot. see the script test3.ncl in
>>>>>>>>>
>>>>>>>>> /glade2/scratch2/laura/forNCL
>>>>>>>>>
>>>>>>>>> first, I plot the cloud liquid water path:
>>>>>>>>>
>>>>>>>>> plot  = gsn_csm_contour_map(wks,lwpath_a(:,:,n),res)
>>>>>>>>>
>>>>>>>>> then I would like to overlay shading of the cloud-top temperature
>>>>>>>>> with shading for cloud-top temperatures less than 248 or greater than 268.
>>>>>>>>>
>>>>>>>>> When I use:
>>>>>>>>>
>>>>>>>>> plot2 = gsn_csm_contour_map(wks,cldtopt_a(:,:,n),res)
>>>>>>>>>
>>>>>>>>> I get the error message:
>>>>>>>>>
>>>>>>>>> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay
>>>>>>>>> plot member
>>>>>>>>>
>>>>>>>>> When I use gsn_csm_contour(wks,cldtopt_a(:,:,n),res)
>>>>>>>>> then I get the messages:
>>>>>>>>>
>>>>>>>>> warning:mpProjection is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> warning:mpMinLonF is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> warning:mpMaxLonF is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> warning:mpMinLatF is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> warning:mpMaxLatF is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> warning:mpCenterLonF is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> warning:mpShapeMode is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> warning:mpDataBaseVersion is not a valid resource in
>>>>>>>>> test3.ceres_aqua.PO.dec2015_contour at this time
>>>>>>>>>
>>>>>>>>> I am not sure what is going wrong, and would really like a
>>>>>>>>> suggestion on how to fix this.
>>>>>>>>>
>>>>>>>>> Many thanks,
>>>>>>>>> Laura
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> !-----------------------------------------------------------
>>>>>>>>> --------------------------------------------------
>>>>>>>>> Laura D. Fowler
>>>>>>>>>
>>>>>>>>> Mesoscale and Microscale Meteorology Division (MMM)
>>>>>>>>> National Center for Atmospheric Research
>>>>>>>>> P.O. Box 3000, Boulder CO 80307-3000
>>>>>>>>>
>>>>>>>>> e-mail: laura at ucar.edu
>>>>>>>>> phone: 303-497-1628
>>>>>>>>>
>>>>>>>>> !-----------------------------------------------------------
>>>>>>>>> --------------------------------------------------
>>>>>>>>> _______________________________________________
>>>>>>>>> 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
>>>>>>>>
>>>>>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> !-----------------------------------------------------------
>>>>>>> --------------------------------------------------
>>>>>>> Laura D. Fowler
>>>>>>>
>>>>>>> Mesoscale and Microscale Meteorology Division (MMM)
>>>>>>> National Center for Atmospheric Research
>>>>>>> P.O. Box 3000, Boulder CO 80307-3000
>>>>>>>
>>>>>>> e-mail: laura at ucar.edu
>>>>>>> phone: 303-497-1628
>>>>>>>
>>>>>>> !-----------------------------------------------------------
>>>>>>> --------------------------------------------------
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Adam Phillips
>>>>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>>>
>>>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> !-----------------------------------------------------------
>>>>> --------------------------------------------------
>>>>> Laura D. Fowler
>>>>>
>>>>> Mesoscale and Microscale Meteorology Division (MMM)
>>>>> National Center for Atmospheric Research
>>>>> P.O. Box 3000, Boulder CO 80307-3000
>>>>>
>>>>> e-mail: laura at ucar.edu
>>>>> phone: 303-497-1628
>>>>>
>>>>> !-----------------------------------------------------------
>>>>> --------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>
>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>
>>
>>
>>
>> --
>> !-----------------------------------------------------------
>> --------------------------------------------------
>> Laura D. Fowler
>>
>> Mesoscale and Microscale Meteorology Division (MMM)
>> National Center for Atmospheric Research
>> P.O. Box 3000, Boulder CO 80307-3000
>>
>> e-mail: laura at ucar.edu
>> phone: 303-497-1628
>>
>> !-----------------------------------------------------------
>> --------------------------------------------------
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>



-- 
!-------------------------------------------------------------------------------------------------------------
Laura D. Fowler

Mesoscale and Microscale Meteorology Division (MMM)
National Center for Atmospheric Research
P.O. Box 3000, Boulder CO 80307-3000

e-mail: laura at ucar.edu
phone: 303-497-1628

!-------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180719/1fd545ad/attachment-0001.html>


More information about the ncl-talk mailing list