Re: gsn_contour_shade question

From: Marc Michelsen <marc_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 24 2013 - 09:33:07 MDT

Thanks very much Mary and Adam. The new code works great.
Marc

On 7/24/2013 8:23 AM, Adam Phillips wrote:
> Hi Marc,
> gsn_contour_shade was written to replace 4 older functions:
> ShadeLeContour, ShadeGeContour, ShadeGeLeContour, and
> ShadeLeGeContour. None of those four functions allowed one to fill the
> middle at all, so I am guessing I just didn't think of adding the
> ability to shade the middle and top/bottom as an option.
>
> Mary, I'd recommend that your gsn_shade_contour_mod code becomes the
> new gsn_shade_contour coding upon the next release of NCL..
> Adam
>
> On 07/23/2013 10:43 PM, Mary Haley wrote:
>> Hi Marc,
>>
>> I'm not familiar with the gsn_shade_contour code, so I took a quick look at it.
>>
>> It does appear that if you set gsnShadeMid, then you can't set either gsnShadeLow or gsnShadeHigh. In fact, I think the only case where you can set more than one of these is gsnShadeLow and gsnShadeHigh.
>>
>> I'm sure there must be a reason why it is coded this way, and hopefully Adam can chime in.
>>
>> Meanwhile, I created a modified version of gsn_shade_contour ("gsn_shade_contour_mod") that does what I think you want.
>>
>> I modified your example slightly to show different combinations of setting the three Shade resources. See the attached image and script.
>>
>> --Mary
>>
>>
>> On Jul 23, 2013, at 5:11 PM, Marc Michelsen<marc@u.washington.edu> wrote:
>>
>>> Hi NCLers,
>>>
>>> Are you supposed to be able to set gsnShadeLow and gsnShadeMid in the same gsn_contour_shade call?
>>> Here's a stripped down version of contour effects example 13:
>>>
>>> 803 challenger% cat coneff_13.ncl
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>
>>> begin
>>> f = addfile ("uvt.nc", "r") ; add file
>>> lat = f->lat ; get latitude
>>> ind14S= ind(lat.eq.-1.395307) ; subscript index of 1.4S
>>> u = f->U(0,:,ind14S,:) ; get u at 1.4S
>>>
>>> wks = gsn_open_wks ("ps", "coneff" )
>>> res = True
>>> res@cnLevelSpacingF = 5.0
>>> res@gsnDraw = False ; We're going to panel later, so don't
>>> res@gsnFrame = False ; draw or advance frame.
>>> plot = gsn_csm_pres_hgt(wks, u, res )
>>> opt = True
>>> opt@gsnShadeLow = "red"
>>> ; opt@gsnShadeMid = "yellow"
>>> opt@gsnShadeHigh = "yellow"
>>> plot = gsn_contour_shade(plot, -10.,-5, opt)
>>> draw(plot)
>>> end
>>> 804 challenger%
>>>
>>> and it produces this plot:
>>> <jjhddgba.png>
>>>
>>>
>>> so I would like the current white area to be yellow and the current yellow area to be white
>>> so I make the follow change (i.e. I use gsnShadeMid rather than gsnShadeHigh)
>>>
>>> opt@gsnShadeLow = "red"
>>> opt@gsnShadeMid = "yellow"
>>> ; opt@gsnShadeHigh = "yellow"
>>>
>>> and this is what I get:
>>> <cbibgbdi.png>
>>> No filled colors, no errors or warning messages.
>>> I'm using NCL v 6.1.2
>>> Am I doing something wrong? is this supposed to work?
>>> Thanks,
>>>
>>> Marc
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>
> --
> ______________________________________________________________
> Adam Phillipsasphilli@ucar.edu
> NCAR/Climate and Global Dynamics Division (303) 497-1726
> P.O. Box 3000
> Boulder, CO 80307-3000http://www.cgd.ucar.edu/cas/asphilli
Received on Wed Jul 24 09:36:18 2013

This archive was generated by hypermail 2.1.8 : Thu Jul 25 2013 - 21:02:42 MDT