Re: Plot rtest result with stippling

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri Jan 24 2014 - 12:14:22 MST

Hello,
I'm not sure what you mean by it gives a bad result, but your call to
gsn_contour_shade is likely the issue:

rescn@cnLevelSelectionMode = "ManualLevels"
rescn@cnMinLevelValF = -1
rescn@cnMaxLevelValF = 1
rescn@cnLevelSpacingF = 0.1
plotB=gsn_csm_contour(wks,probt,rescn)

opt = True
opt@gsnShadeFillType = "pattern" ; pattern fill
opt@gsnShadeHigh = 2 ; use pattern #2
opt@gsnShadeLow = 2
plotB=gsn_contour_shade(plotB,100.,95.,opt)

As it is currently coded, you will shade everything less than the first
contour less than or equal to 100 with fill pattern #2, and you will
shade everything greater than the first contour greater or equal to 95.
But your contours go from -1 to 1 by .1.

try this:
rescn2 = rescn
rescn2@cnMinLevelValF = 95
rescn2@cnMaxLevelValF = 100
rescn2@cnLevelSpacingF = 5.
rescn2@cnFillMode = "RasterFill" ; raster fill significance patterns
so all grid points are shown. AreaFill (=default) MAY not show all
significant grid points.
plotB=gsn_csm_contour(wks,probt,rescn2) ; contours are at 95,100

opt = True
opt@gsnShadeFillType = "pattern" ; pattern fill
opt@gsnShadeHigh = 2 ; use pattern #2
plotB=gsn_contour_shade(plotB,-999.,95.,opt) ; pattern fill all areas
greater than the first contour that is greater to or equal to 95. In
this case, that is 95.

Note that when using gsn_contour_shade that the pattern/color filling
starts at the first contour greater than or equal to the specified
value; it does not start at the specified value. Please look at the
examples on the gsn_contour_shade documentation page, notably example #3:
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_contour_shade.shtml

You will also want to also verify the range of your probt data array to
make sure the data is in the range of 95...
printMinMax(probt,0)
or
opt2 = True
opt2@PrintStat = True
stat_dispersion(probt,opt)

Good luck. If you have any further questions please respond to ncl-talk
email list.
Adam

On 01/24/2014 11:23 AM, moflod@locean-ipsl.upmc.fr wrote:
> Dear NCL,
>
> I compute correlation coefficient between two variable and I would make a
> significant test at 95% using ncl rtest fonction. I have problem to plot
> by stipplgn where probt.ge.95. I use the following code and it give bad
> result:
>
> 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"
>
> dir="/data/observations/"
> filsst_JAS="anom_sst_JAS.nc"
> filpre_JAS="indice_pre_JAS.nc"
> PLOT = True
> pltType = "png"
> pltDir = "/home/"
> pltName = "correlation_data"
> fsst_JAS = addfile(dir+filsst_JAS , "r")
> fpre_JAS = addfile(dir+filpre_JAS , "r")
> sst_JAS=fsst_JAS->sst(:,:,:)
> pre_JAS=doubletofloat(fpre_JAS->pre(:))
> rsst_JAS = escorc(pre_JAS,sst_JAS(latitude|:,longitude|:,time|:))
> copy_VarCoords(sst_JAS(0,:,:), rsst_JAS)
> rsst_JAS@long_name = " JAS Detrended and Filtred "
> probt=100.*(1.-rtest(rsst_JAS,10,0))
>
> ;plot figures
> wks = gsn_open_wks(pltType, pltDir+pltName)
> gsn_define_colormap(wks, "ncl_default")
>
> rescn = True
> rescn@gsnDraw = False
> rescn@gsnFrame = False
> rescn@gsnSpreadColors = True
> rescn@cnFillOn = True
> rescn@cnLinesOn = False
> rescn@cnLineLabelsOn = False
> rescn@cnLevelSelectionMode = "ManualLevels"
> rescn@cnMinLevelValF = -1
> rescn@cnMaxLevelValF = 1
> rescn@cnLevelSpacingF = 0.1
> rescn@lbLabelBarOn = False
> rescn@mpCenterLonF = 0.
> rescn@mpFillOn = False
>
> ; rescn@mpProjection = "Robinson"
> rescn@mpPerimOn = False
> rescn@mpGridAndLimbOn = True
> rescn@mpGridLatSpacingF = 90
> rescn@mpGridLonSpacingF = 360.
> rescn@mpGridLineColor = "transparent"
> rescn@mpGridAndLimbOn = False
>
> plotA=gsn_csm_contour_map(wks,rsst_JFM, rescn)
> rescn@cnFillOn = False
> plotB=gsn_csm_contour(wks,probt,rescn)
>
> opt = True
> opt@gsnShadeFillType = "pattern" ; pattern fill
> opt@gsnShadeHigh = 2 ; use pattern #2
> opt@gsnShadeLow = 2
>
> plotB=gsn_contour_shade(plotB,100.,95.,opt)
> overlay=(plotA,plotB)
> draw(plotA)
> frame(wks)
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
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/staff/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jan 24 12:14:35 2014

This archive was generated by hypermail 2.1.8 : Fri Feb 07 2014 - 16:39:11 MST