Re: ShadeLtContour not working!!

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 27 2013 - 12:19:27 MDT

Hi Ahmad,
My apologies, I forgot to add that you also need to tell NCL to draw the
plot and advance the frame manually if you set gsnDraw and gsnFrame =
False.

So:
res = True
res@gsnDraw = False
res@gsnFrame = False
....
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = ispan(-10,10,1)

plot = gsn_csm_contour(wks,T(1000,:,:),res)
plot = ShadeLtContour(plot, 1.01, 3)
draw(plot)
frame(wks)
end

If that doesn't work let ncl-talk know.
Adam

On 06/27/2013 12:15 PM, Ahmad Farsyud wrote:
> Thank you Adam,
>
> But still not working !!
>
> 1. If I set gsnDraw and gsnFrame to 'False" i got a broken document.
> 2. If I just set gsnDraw to False, I got blank
> 3. I tried several ways to set the number which the contour will be
> shaded but still there is no effect.
>
> Please help me,
>
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
> f = addfile("ly.nc <http://ly.nc>","r") ; Read in first time
> step and
> T = f->ly(:,:,:)
>
>
> T = where(T.lt.0, 0, T) ; make values less than 0 to be zero.
>
>
> ;*******************************************************************************
>
> wks = gsn_open_wks ("pdf", "annualzonalmean" ) ; open workstation
>
> res = True ; plot mods desired
> ;res@gsnDraw = False
> ;res@gsnFrame = False
>
> res@cnLineLabelsOn = True ; turn on line labels
> res@cnFillOn = False ; turn on color fill
> res@gsnLeftString = " "
> res@gsnRightString = " "
> res@gsnCenterString = " "
> res@gsnContourZeroLineThicknessF = 0
> ;res@cnLevelSpacingF = 1
> res@cnInfoLabelOn = False
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = ispan(-10,10,1)
>
> plot = gsn_csm_contour(wks,T(1000,:,:),res)
> ;plot = ShadeLtContour(plot, 1, 3)
> ;plot = ShadeLtContour(plot, 1.51, 3)
> plot = ShadeLtContour(plot, 1.01, 3)
>
>
> end
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Fri, Jun 28, 2013 at 1:22 AM, Adam Phillips <asphilli@ucar.edu
> <mailto:asphilli@ucar.edu>> wrote:
>
> Hi Ahmad,
> Without knowing what NCL is picking as your contour levels, this
> is a bit difficult to answer.
> Note that in the ShadeLtContour documentation it states:
> "Note that the shading begins at the first contour level less than
> /value/, and not at the specified /value/. Check your plot to make
> sure that the results are what you expected. "
>
> Again, not knowing what your contours are makes this a guess, but
> try setting this:
> plot = ShadeLtContour(plot, 1.51, 3)
>
> That will result in all areas less than the first contour less
> than 1.51 to be shaded.. If you are not happy with the results,
> try setting:
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels = ispan(-10,10,1)
>
> plot = gsn_csm_contour(wks,T(1000,:,:),res)
> plot = ShadeLtContour(plot, 1.01, 3)
>
> Finally, and perhaps most importantly, you need to tell NCL to not
> draw the plot upon the call to gsn_csm_contour and to not advance
> the frame, so make sure you include the following lines no matter
> what:
> res@gsnDraw = False
> res@gsnFrame = False
> In fact, you might want to try adding those two lines first to see
> if it fixes the problem.
>
> If the above doesn't help, please let ncl-talk know.
> Adam
>
>
>
> On 06/27/2013 08:48 AM, Ahmad Farsyud wrote:
>> Dear NCL,
>>
>> I just wonder why the "ShadeLtContour" function in my code
>> is not working. I want to shade my plot if the contour less than 1.
>>
>> Here is my plot:
>>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>
>> begin
>> f = addfile("ly.nc <http://ly.nc>","r") ; Read in first time
>> step and
>> T = f->ly(:,:,:)
>>
>> ;T = T(lev|:,time|:,lat|:)
>>
>> T = where(T.lt.0, 0, T)
>>
>>
>> ;printVarSummary(TEMP)
>>
>>
>> ;*******************************************************************************
>>
>> wks = gsn_open_wks ("x11", "annualzonalmean" ) ;
>> open workstation
>>
>> res = True ; plot mods desired
>> res@cnLineLabelsOn = True ; turn on line
>> labels
>> res@cnFillOn = False ; turn on color
>> fill
>> res@cnMonoFillColor = True
>> res@gsnLeftString = " "
>> res@gsnRightString = " "
>> res@gsnCenterString = " "
>> res@gsnContourZeroLineThicknessF = 0
>> res@cnLevelSpacingF = 1
>> res@cnMonoFillPattern = True
>> res@cnInfoLabelOn = False
>>
>> ;*******************************************************************************
>> ;changing aspect ratio
>>
>> ;res@vpXF = 0.13 ; change x-scale
>> ;res@vpWidthF = 0.75 ; change height and width
>> ;res@vpHeightF = 0.45
>>
>>
>> plot = gsn_csm_contour(wks,T(1000,:,:),res)
>> plot = ShadeLtContour(plot, 1, 3)
>>
>> end
>>
>> thank you
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> ______________________________________________________________
> Adam Phillipsasphilli@ucar.edu <mailto:asphilli@ucar.edu>
> NCAR/Climate and Global Dynamics Division(303) 497-1726 <tel:%28303%29%20497-1726>
> P.O. Box 3000
> Boulder, CO 80307-3000http://www.cgd.ucar.edu/cas/asphilli
>
>

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 27 12:19:35 2013

This archive was generated by hypermail 2.1.8 : Mon Jul 01 2013 - 12:35:42 MDT