[ncl-talk] Significance plot or stippling not working
Ipshita Majhi
ipmajhi at alaska.edu
Tue Jul 21 22:17:42 MDT 2015
Dear NCL,
I don't get any errors when I run this code, but the stippling does not
show up. Could you guide me on this.
Best Regards
Ipshita
;This is for correlating JJAS monthly precp with JJAS temperature
;******************************************************
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"
;*******************************************************
;=============================================
; Reading data
;=============================================
a=addfile("~/Documents/SST/Monthly/sst.mnmean.v4.nc","r")
JJAS
=asciiread("~/Documents/SST/Monthly/jjas_1871_2012.txt",(/142,1/),"float")
;=============================================
;The dataset goes from 1854-2015
sst=a->sst
; copy meta data and coordinate variables using contributed functions
copy_VarAtts(a,sst)
copy_VarCoords_1(a,sst)
;============================================
;Extracting 1871-2012 for SST
sst_1871_2012=sst(216:1908,:,:)
copy_VarAtts(sst,sst_1891_2012)
copy_VarCoords_1(a,sst_1891_2012)
;============================================
;Extracting 1871 to 2012 in JJAS rainfall
June = new((/142,89,180/),float)
June at _FillValue = -9.9621e+36
Feb = new((/142,89,180/),float)
Feb at _FillValue = -9.9621e+36
;==========================================
;Extracting SST for month of June
do nyr=0,1692,12
June(nyr/12,:,:)=sst_1871_2012(nyr+5,:,:)
Feb(nyr/12,:,:)=sst_1871_2012(nyr+1,:,:)
end do
copy_VarAtts(sst_1871_2012,June)
copy_VarCoords_1(sst_1871_2012,June)
copy_VarAtts(sst_1871_2012,Feb)
copy_VarCoords_1(sst_1871_2012,Feb)
;==========================================
;Calculating correlation
e=transpose(JJAS)
print(dimsizes(JJAS))
June_reorder=June(lat|:,lon|:,time|:)
copy_VarAtts(June,June_reorder)
copy_VarCoords_1(June,June_reorder)
corr_june=escorc(June_reorder,e)
copy_VarAtts(June_reorder,corr_june)
copy_VarCoords_1(June_reorder,corr_june)
prob_june = rtest(corr_june(:,:,0), 142,0)
copy_VarAtts(June_reorder,prob_june)
copy_VarCoords_1(June_reorder,prob_june)
;===========================================
; Now plotting the correlation
wks = gsn_open_wks("pdf","June_sst_jjas_cor_prob") ; open a
ps plot
gsn_define_colormap(wks,"BlWhRe") ; choose colormap
res = True ; make plot mods
res at cnFillOn = True ; turn on color
;---These two resources not needed in NCL V6.1.0
res at gsnSpreadColors = True ; use full colormap
;---This resource defaults to True in NCL V6.1.0
res at lbLabelAutoStride = True ; automatic lb label stride
res at cnLinesOn = False ; turn off contour lines
res at cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
res at cnMinLevelValF = -1. ; min level
res at cnMaxLevelValF = 1. ; max level
res at cnLevelSpacingF = .1 ; contour level spacing
lag = 0
res at tiMainString = "June SST with JJAS rainfall"
plotA = gsn_csm_contour_map_ce(wks,corr_june(:,:,lag),res)
; Significance plot on top of correlation plot
;
; Significance plot on top of correlation plot
;========================= PLOT 2 ==============================
res2 = True ; res2 probability plots
res2 at gsnDraw = False ; Do not draw plot
res2 at gsnFrame = False ; Do not advance frome
res2 at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
res2 at cnMinLevelValF = 0.00 ; set min contour level
res2 at cnMaxLevelValF = 1.05 ; set max contour level
res2 at cnLevelSpacingF = 0.05 ; set contour spacing
res2 at cnInfoLabelOn = False ; turn off info label
res2 at cnLinesOn = False ; do not draw contour lines
res2 at cnLineLabelsOn = False ; do not draw contour labels
res2 at cnFillScaleF = 0.6 ; add extra density
plot2 = gsn_csm_contour(wks,prob_june, res2)
;plot2 = ShadeLtContour(plot2, 0.07, 17) ; shade all areas less than
the
; 0.05 contour level
overlay (plotA, plot2)
draw (plotA)
;***************************************************************
--
Ipshita Majhi
PhD Candidate
University of Alaska , Fairbanks
Atmospheric Science Department
(907)978-4220 ipmajhi at alaska.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150721/45e2c3cf/attachment.html
More information about the ncl-talk
mailing list