Re: Help : gsn_contour_shade is not working for "ExplicitLevels" cnLevelSelectionMode

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 27 2012 - 11:26:47 MDT

I think you just need to add a draw and frame call after gsn_contour_shade:

draw(plot2)
frame(wks)

--Mary

On Aug 25, 2012, at 7:59 PM, heaven_bird334 wrote:

> Hi,
> I met a strange problem that the "gsn_contour_shade" seems not working for "ExplicitLevels" cnLevelSelectionMode. It seems can not add the shaded area for coutours. I have attached the script(t.nc), input data(t.nc) and ouput pic(t.png) behind this email. And the following is the detailing infos:
> @> ncl -x t.ncl
> Copyright (C) 1995-2011 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> +
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> +
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> +
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> +
> + begin
> + f=addfile("t.nc","r")
> + sig=f->sig ; Three values in this var, -1,0,1
> + printVarSummary(sig)
> +
> + ;wks = gsn_open_wks("x11","t")
> + & nbsp; wks = gsn_open_wks("png","t")
> + gsn_define_colormap(wks,"amwg_blueyellowred")
> + res = True
> + res@cnLineLabelBackgroundColor = "white" ; white bckgrnd around label
> + res@gsnAddCyclic = True
> + res@gsnPolar = "NH" ; select northern hemisphere
> + res@mpCenterLonF = 0
> +
> + res@cnLineLabelsOn = True; False ; turn on line labels
> + res@cnFillOn ; = False
> + res@cnLinesOn = True; False
> + res@cnLevelSelectionMode = "ExplicitLevels" ; set manual contour levels
> + res@cnLevels = (/-0.99,0.,0.99/)
> + plot2 = gsn_csm_contour_map_polar(wks,sig(:,:),res)
> + opt = True
> + opt@cnInfoLabelOn = True;False
> + opt@gsnDraw = False
> + opt@gsnFrame = False
> + opt@gsnShadeHigh = 12 ; Use fill color #150 (yellow)
> + opt@gsnShadeLow = 7 ; You can use color indices or named colors.
> + plot2 = gsn_contour_shade(plot2, -0.99,0.99, opt) ; Shade contours > -4 yellow, and shade contour
> +
> +
> + end
> Variable: sig
> Type: float
> Total Size: 21312 bytes
> 5328 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 37] x [lon | 144]
> Coordinates:
> lat: [ 0..90]
> lon: [ 0..357.5]
> Number Of Attributes: 4
> units :
> long_name : correlation
> _FillValue : -99.99
> missing_value : -99.99
>
> Any suggestion or commont is thankworthy!
>
> Best Regards,
> Li
>
>
> <t.nc><t.ncl><t.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
Received on Mon Aug 27 11:26:54 2012

This archive was generated by hypermail 2.1.8 : Tue Aug 28 2012 - 08:53:45 MDT