<div dir="ltr"><div><div><div><div>Dear NCL,<br> <br></div>I would like to calculate the significance. I am using the probability function, i am not sure where things are not working out. There are no error message, the code runs but no stippling show for significance.<br></div>Here is the code<br><br>;This is for correlating JJAS monthly precp with JJAS temperature with lag<br><br>;******************************************************<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;<br>;*******************************************************<br><br>;=============================================<br>; Reading data<br>;=============================================<br><br>a=addfile(&quot;~/Documents/SST/Monthly/<a href="http://sst.mnmean.v4.nc">sst.mnmean.v4.nc</a>&quot;,&quot;r&quot;)<br><br>;==============================================<br><br>JJAS_1871_2012 =asciiread(&quot;~/Documents/SST/Monthly/jjas_1871_2012.txt&quot;,(/142,1/),&quot;float&quot;)<br>;Extracting JJAS for 1967 to 2012<br><br>JJAS_1967_2012=JJAS_1871_2012(96:141,0)<br>print(dimsizes(JJAS_1967_2012))<br><br>e=transpose(transpose(JJAS_1967_2012))<br>;print(dimsizes(e))<br><br>;=============================================<br><br>;For some months around september it is better to <br>;=============================================<br> ;The dataset goes from 1854-2015<br>  sst=a-&gt;sst<br>; copy meta data and coordinate variables using contributed functions<br> copy_VarAtts(a,sst)   <br> copy_VarCoords_1(a,sst)<br>;============================================<br><br>;Extracting 1967-2012 for SST<br>sst_1967_2012=sst(1367:1918,:,:)<br><br><br>copy_VarAtts(sst,sst_1967_2012)   <br>copy_VarCoords_1(a,sst_1967_2012)<br><br>;============================================<br>;Seasonal three month average<br><br> <br> sst_djf=month_to_season(sst_1967_2012, &quot;DJF&quot;)<br> sst_jfm=month_to_season(sst_1967_2012, &quot;JFM&quot;)<br> sst_fma=month_to_season(sst_1967_2012, &quot;FMA&quot;)<br> sst_mam=month_to_season(sst_1967_2012, &quot;MAM&quot;)<br> sst_amj=month_to_season(sst_1967_2012, &quot;AMJ&quot;)<br> sst_mjj=month_to_season(sst_1967_2012, &quot;MJJ&quot;)<br> sst_jja=month_to_season(sst_1967_2012, &quot;JJA&quot;)<br> sst_jas=month_to_season(sst_1967_2012, &quot;JAS&quot;)<br> sst_aso=month_to_season(sst_1967_2012, &quot;ASO&quot;)<br> sst_son=month_to_season(sst_1967_2012, &quot;SON&quot;)<br> sst_ond=month_to_season(sst_1967_2012, &quot;OND&quot;)<br> sst_ndj=month_to_season(sst_1967_2012, &quot;NDJ&quot;)<br><br>;==============================================<br>;Copying Attributes and Coordinates<br><br>copy_VarAtts(sst_1967_2012,sst_djf)   <br>copy_VarCoords_1(sst_1967_2012,sst_djf)<br><br>copy_VarAtts(sst_1967_2012,sst_jfm)   <br>copy_VarCoords_1(sst_1967_2012,sst_jfm)<br><br>copy_VarAtts(sst_1967_2012,sst_fma)   <br>copy_VarCoords_1(sst_1967_2012,sst_fma)<br><br>copy_VarAtts(sst_1967_2012,sst_mam)   <br>copy_VarCoords_1(sst_1967_2012,sst_mam)<br><br>copy_VarAtts(sst_1967_2012,sst_amj)   <br>copy_VarCoords_1(sst_1967_2012,sst_amj)<br><br>copy_VarAtts(sst_1967_2012,sst_mjj)   <br>copy_VarCoords_1(sst_1967_2012,sst_mjj)<br><br>copy_VarAtts(sst_1967_2012,sst_jja)   <br>copy_VarCoords_1(sst_1967_2012,sst_jja)<br><br>copy_VarAtts(sst_1967_2012,sst_jas)   <br>copy_VarCoords_1(sst_1967_2012,sst_jas)<br><br>copy_VarAtts(sst_1967_2012,sst_aso)   <br>copy_VarCoords_1(sst_1967_2012,sst_aso)<br><br>copy_VarAtts(sst_1967_2012,sst_son)   <br>copy_VarCoords_1(sst_1967_2012,sst_son)<br><br>copy_VarAtts(sst_1967_2012,sst_ond)   <br>copy_VarCoords_1(sst_1967_2012,sst_ond)<br><br>copy_VarAtts(sst_1967_2012,sst_ndj)   <br>copy_VarCoords_1(sst_1967_2012,sst_ndj)<br><br>;=============================================<br><br>;Calculating correlation<br><br><br><br>djf_reorder=sst_djf(lat|:,lon|:,time|:)<br>jfm_reorder=sst_jfm(lat|:,lon|:,time|:)<br>fma_reorder=sst_fma(lat|:,lon|:,time|:)<br>mam_reorder=sst_mam(lat|:,lon|:,time|:)<br>amj_reorder=sst_amj(lat|:,lon|:,time|:)<br>mjj_reorder=sst_mjj(lat|:,lon|:,time|:)<br>jja_reorder=sst_jja(lat|:,lon|:,time|:)<br>jas_reorder=sst_jas(lat|:,lon|:,time|:)<br>aso_reorder=sst_aso(lat|:,lon|:,time|:)<br>son_reorder=sst_son(lat|:,lon|:,time|:)<br>ond_reorder=sst_ond(lat|:,lon|:,time|:)<br>ndj_reorder=sst_ndj(lat|:,lon|:,time|:)<br><br>;===================================================<br><br>copy_VarAtts(sst_djf,djf_reorder)   <br>copy_VarCoords_1(sst_djf,djf_reorder)<br><br>copy_VarAtts(sst_jfm,jfm_reorder)   <br>copy_VarCoords_1(sst_jfm,jfm_reorder)<br><br>copy_VarAtts(sst_fma,fma_reorder)   <br>copy_VarCoords_1(sst_fma,fma_reorder)<br><br>copy_VarAtts(sst_mam,mam_reorder)   <br>copy_VarCoords_1(sst_mam,mam_reorder)<br><br>copy_VarAtts(sst_amj,amj_reorder)   <br>copy_VarCoords_1(sst_amj,amj_reorder)<br><br>copy_VarAtts(sst_mjj,mjj_reorder)   <br>copy_VarCoords_1(sst_mjj,mjj_reorder)<br><br>copy_VarAtts(sst_jja,jja_reorder)   <br>copy_VarCoords_1(sst_jja,jja_reorder)<br><br>copy_VarAtts(sst_jas,jas_reorder)   <br>copy_VarCoords_1(sst_jas,jas_reorder)<br><br>copy_VarAtts(sst_aso,aso_reorder)   <br>copy_VarCoords_1(sst_aso,aso_reorder)<br><br>copy_VarAtts(sst_son,son_reorder)   <br>copy_VarCoords_1(sst_son,son_reorder)<br><br>copy_VarAtts(sst_ond,ond_reorder)   <br>copy_VarCoords_1(sst_ond,ond_reorder)<br><br>copy_VarAtts(sst_ndj,ndj_reorder)   <br>copy_VarCoords_1(sst_ndj,ndj_reorder)<br><br>;=======================================<br>;Calculating Correlation Coefficient<br><br>;Months with Lag<br>corr_djf=esccr(JJAS_1967_2012,djf_reorder,1)<br>corr_ndj=escorc(ndj_reorder(:,:,0:44),JJAS_1967_2012(1:45))<br>corr_ond=escorc(ond_reorder(:,:,0:44),JJAS_1967_2012(1:45))<br>corr_son=escorc(son_reorder(:,:,0:44),JJAS_1967_2012(1:45))<br>corr_aso=escorc(aso_reorder(:,:,0:44),JJAS_1967_2012(1:45))<br><br>copy_VarAtts(djf_reorder,corr_djf)   <br>copy_VarCoords_1(djf_reorder,corr_djf)<br><br>copy_VarAtts(ndj_reorder,corr_ndj)   <br>copy_VarCoords_1(ndj_reorder,corr_ndj)<br><br>copy_VarAtts(ond_reorder,corr_ond)   <br>copy_VarCoords_1(ond_reorder,corr_ond)<br><br>copy_VarAtts(son_reorder,corr_son)   <br>copy_VarCoords_1(son_reorder,corr_son)<br><br>copy_VarAtts(aso_reorder,corr_aso)   <br>copy_VarCoords_1(aso_reorder,corr_aso)<br><br>;========================================<br>;Probability<br>x=corr_djf(:,:,1)<br>print(dimsizes(x))<br>;==============================<br>; Now plotting the correlation<br><br>;===========================================<br><br>; Now plotting the correlation<br><br><br>    wks  = gsn_open_wks(&quot;pdf&quot;,&quot;DJF_sst_jjas_cor_prob_sig_lag&quot;)             <br>  gsn_define_colormap(wks,&quot;BlWhRe&quot;)              ; choose colormap<br> <br>  res                      = True                ; make plot mods<br>  res@gsnDraw = False<br>  res@gsnFrame = False<br>  res@cnFillOn             = True                ; turn on color<br>  res@gsnSpreadColors      = True                ; use full colormap<br>  res@lbLabelAutoStride    = True         ; automatic lb label stride<br><br>  res@cnLinesOn            = False               ; turn off contour lines<br>  res@cnLevelSelectionMode = &quot;ManualLevels&quot; ; manually set cnlev<br>  res@cnMinLevelValF       = -1.                 ; min level<br>  res@cnMaxLevelValF       =  1.                 ; max level<br>  res@cnLevelSpacingF      = .1                  ; contour level spacing<br><br>  lag                      = 0<br>  res@tiMainString         = &quot;DJF SST with JJAS rainfall&quot;<br>  plotA = gsn_csm_contour_map_ce(wks,corr_djf,res)<br><br> ; Significance plot on top of correlation plot<br> ;========================= PLOT 2 =========<br>  res2 = True                            ; res2 probability plots<br><br>  res2@gsnDraw             = False       ; Do not draw plot<br>  res2@gsnFrame            = False       ; Do not advance frome<br>  res2@cnFillOn = True                   ; turn on color/pattern fill<br>  res2@cnMonoFillPattern = False   ; allow different patterns<br>  res2@cnMonoFillColor = True       ; only use one color (black)<br><br>  res2@cnLevelSelectionMode = &quot;ExplicitLevels&quot; ; set explicit cnlev<br>  res2@cnLevels   = (/.90/)    ; only have 1 contour level<br>  res2@cnFillPatterns = (/-1,17/) ; don&#39;t fill &lt;0.95, stipple &gt;=0.95<br> <br>  res2@gsnAddCyclic = True   ; may or may not be needed<br> <br>  res2@cnInfoLabelOn       = False       ; turn off info label<br><br>  res2@cnLinesOn           = False       ; do not draw contour lines<br>  res2@cnLineLabelsOn      = False    ; do not draw contour labels<br><br>  res2@cnFillScaleF        = 0.5         ; add extra density<br><br>  printMinMax(prob_djf,0)   ; check to make sure values are<br>                                             ; between 0 and 1.<br><br>  plot2   = gsn_csm_contour(wks,prob_djf, res2)<br>  overlay (plotA, plot2)<br><br>  draw (plotA)<br>  frame(wks)<br><br></div>Best Regards<br></div>Ipshita<br><div><div><div><div><div><br clear="all"><div><br><div class="gmail_signature"><div dir="ltr"><br></div></div>
</div></div></div></div></div></div></div>