<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Hi Sri,</div><div>When you comment out cnLevelSelectionMode you are allowing NCL to choose the contour levels. Thus, NCL might choose .55,.65,.75. To use gsn_contour_shade you will want to select the levels, as gsn_contour_shade will not add/change the existing contour levels, it simply uses what it is given. Just because your script (without setting chLevelSelectonMode) shows stippling does not mean those areas are significant to the 95% level. If the above is confusing I would suggest you review the gsn_contour_</div><div><br></div><div>Is it possible that you have very little area that is significant? Did you verify that the ranges/units of the 2 datasets that you input into ttest are the same?</div><div>Hope that helps. As always respond to NCL talk if you have further questions.</div><div>Adam</div><div><br></div><div>On Jan 19, 2018, at 3:56 AM, Sri Nandini <<a href="mailto:snandini@marum.de">snandini@marum.de</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title></title><br>Hello<br><br>I used both methods which didnt plot at either 0.05 or 95 for me.<br>However, it did plot (attached) when i used this plotting resources:commenting out the Explicit Levels <br>Using this ttest method:<br><br> probt = ttest(aveY,varY,xEqv,aveX,varX,yEqv,False,False) ; values are between 0 and 1 so 0.05 for 95% significance; 0.1 for 90% and so on.. <br><br><br>    res2 = True                            ; res2 probability plots<br>  res2@gsnDraw             = False       ; Do not draw plot<br>  res2@gsnFrame            = False       ; Do not advance frome<br>  ;res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev<br>  ;res2@cnLevels   = (/.95/)    ; only have 1 contour level<br>  res2@cnInfoLabelOn       = False<br>  res2@cnLinesOn           = False       ; do not draw contour lines<br>  res2@cnLineLabelsOn      = False       ; do not draw contour labels<br>  res2@cnFillScaleF        = 0.6         ; add extra density<br>                                         ; add cyclic point<br>  ;res@gsnAddCyclic                = True              ; add cyclic point<br>  plot2   = gsn_csm_contour(wks,gsn_add_cyclic_point(probt(:,:)), res2) <br><br><br>opt = True                    ; set up parameters for pattern fill<br>opt@gsnShadeFillType = "pattern"  ; specify pattern fill<br>opt@gsnShadeLow      = 17         ; stipple pattern<br>plot2   = gsn_contour_shade(plot2, 0.95,1, opt) ; stipple all areas >= 95  contour       <br>overlay (plot, plot2)<br><br>If i use 0.05 instead of 0.95 or .75 then it doesnt plot. The one at 0.75 is also attached. <br><br>Using the other ttest method:also doesnt plot.<br>probt = 100.*(1. -ttest(aveY,varY,xEqv,aveX,varX,yEqv,False,False)) ; all areas whose value > 95 are significant <br><br>res2 = True                            ; res2 probability plots<br>  res2@gsnDraw             = False       ; Do not draw plot<br>  res2@gsnFrame            = False       ; Do not advance frome<br>  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev<br>  res2@cnLevels   = (/95./)    ; only have 1 contour level<br>  res2@cnInfoLabelOn       = False<br>  res2@cnLinesOn           = False       ; do not draw contour lines<br>  res2@cnLineLabelsOn      = False       ; do not draw contour labels<br>  res2@cnFillScaleF        = 0.6         ; add extra density<br>                                         ; add cyclic point<br>  ;res@gsnAddCyclic                = True              ; add cyclic point<br>  plot2   = gsn_csm_contour(wks,gsn_add_cyclic_point(probt(:,:)), res2) <br><br>opt = True                    ; set up parameters for pattern fill<br>opt@gsnShadeFillType = "pattern"  ; specify pattern fill<br>opt@gsnShadeHigh      = 17         ; stipple pattern<br>plot2   = gsn_contour_shade(plot2, 1,95., opt) ; stipple all areas >= 95  contour      <br>overlay (plot, plot2)<br><br>Would it be possible to send my new clean script plus the netcdf files for some one to test it on for me?<br>Much appreciated.<br><br><br><br><br><br><br><br><br>On Jan 18, 2018 6:08:16 PM, Adam Phillips wrote:
<br><blockquote class="felamimail-body-blockquote"><div dir="ltr">Hi Sri,<div>To clarify my previous response, res2@cnMonoFillPattern = False also needs to be set when not using gsn_contour_shade:</div><div><div style="font-size:12.8px;"><span style="font-size:12.8px;">  res2 = True                          </span><span style="font-size:12.8px;">  ; res2 probability plots</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@gsnDraw             = False       ; Do not draw plot</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@gsnFrame            = False       ; Do not advance frome</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLevels   = (/.05/)    ; only have 1 contour level</span></div><div style="font-size:12.8px;">  <span style="font-size:small;">res2@cnMonoFillPattern = False </span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnFillPatterns = (/17,-1/) ; don't fill <0.95, stipple >=0.95</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res@cnFillOn = True</span><br style="font-size:12.8px;"><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnInfoLabelOn       = False</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLinesOn           = False       ; do not draw contour lines</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLineLabelsOn      = False       ; do not draw contour labels</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnFillScaleF        = 0.6         ; add extra density</span><br style="font-size:12.8px;"><br style="font-size:12.8px;"><span style="font-size:12.8px;">  plot2 = gsn_csm_contour(wks,probt,</span><span style="font-size:12.8px;">res2)                         </span><span style="font-size:12.8px;">            ; add cyclic point</span><br style="font-size:12.8px;"></div><div style="font-size:12.8px;"><span style="font-size:12.8px;">  </span><span style="font-size:12.8px;">overlay (plot, plot2)</span></div></div><div><br></div><div>Looking at the new modifications to your script, you are doing this for your t-test calculation:</div><div><span style="font-size:12.8px;">probt = 100.*(1. -ttest(aveY,varY,xEqv,aveX,</span><span style="font-size:12.8px;">varX,yEqv,True,False)) ; all areas whose value > 95 are significant</span><br></div><div><br></div><div>As you are multiplying by 100 after subtracting the values from one, your comment is correct, all values greater than 95 would be considered significant. However, you are also setting your contour levels like this:</div><div><span style="font-size:12.8px;">res2@cnLevels   = (/.95/)    ; only have 1 contour level</span></div><div><span style="font-size:12.8px;">Thus, you are setting your single contour level to be at .95, and not 95. So you should change that resource to 95. </span></div><div><span style="font-size:12.8px;"><br></span></div><div><span style="font-size:12.8px;">Also, you are calling gsn_contour_shade like this:</span></div><div><div><span style="font-size:12.8px;">opt = True                    ; set up parameters for pattern fill</span></div><div><span style="font-size:12.8px;">opt@gsnShadeFillType = "pattern"  ; specify pattern fill</span></div><div><span style="font-size:12.8px;">opt@gsnShadeLow      = 17         ; stipple pattern</span></div><div><span style="font-size:12.8px;">plot2   = gsn_contour_shade(plot2, 0.95, 3., opt) ; stipple all areas < 95 contour              </span></div></div><div><br></div><div>Those settings will result in all values less than or equal to .95 (matches your original contour level of .95) being shaded, which is not what you want. Those setting should be switched to this:</div><div><br></div><div><span style="font-size:12.8px;">res2@cnLevels   = (/95./)   </span></div><div><span style="font-size:12.8px;"><br></span></div><div><span style="font-size:12.8px;">opt = True                    ; set up parameters for pattern fill</span></div><div><span style="font-size:12.8px;">opt@gsnShadeFillType = "pattern"  ; specify pattern fill</span></div><div><span style="font-size:12.8px;">opt@gsnShadeHigh      = 17         ; stipple pattern</span></div><div><span style="font-size:12.8px;">plot2   = gsn_contour_shade(plot2, 1, 95., opt) ; stipple all areas >= 95  contour       </span></div><div><span style="font-size:12.8px;"><br></span></div><div><span style="font-size:12.8px;">Also note that when you turn stippling on that not every grid box will necessarily have one stipple in it, and some (depending on your grid) might have more. </span><br></div><div><br></div><div>If you have any further questions please respond to ncl-talk.</div><div>Adam</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 18, 2018 at 8:28 AM, Sri Nandini via ncl-talk <span dir="ltr"><<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></span> wrote:<br><blockquote class="felamimail-body-blockquote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Hello<br><br>It appears now the stippling is being added to the map, see pdf attached, however the the latlon seem to be shifted, am i wrong about this?<br>Here is my modified script:<br><br><br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br><br> yrStrt = 0000<br> yrLast = 0100<br>; ==============================================================<br>; Open the file: Read only the user specified period <br>; ==============================================================<br>f= addfile("T2M_C.nc", "r") ;Model Control<br>TIME   = f->time<br>  YYYY   = cd_calendar(TIME,-1)/100                 ; entire file<br>  iYYYY  = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)<br>T41    = f->TREFHT(iYYYY,:,:)<br>;printVarSummary(T41)                                ; (time, lat,lon)<br>T4    = lonFlip(T41)<br>;printVarSummary(T4)                                ; (time, lat,lon)<br>T4@_FillValue = -9.96921e+36  <br>aveX = dim_avg_n_Wrap(T4, 0)                   ;; average over the 0th dim<br>;printVarSummary(aveX)                                ; (lat,lon) <br>varX = dim_variance_n_Wrap(T4,0) ; compute variance<br>;printVarSummary(varX)                                ; (lat,lon) <br>;==============================================================================<br><br>f2= addfile("T2M_CC.nc", "r") ;Current Caspian<br>TIME2  = f2->time<br>  YYYY2   = cd_calendar(TIME2,-1)/100                 ; entire file<br>  iYYYY2  = ind(YYYY2.ge.yrStrt .and. YYYY2.le.yrLast)<br>air22   = f2->TREFHT(iYYYY2,:,:)<br>air2    = lonFlip(air22)<br>;printVarSummary(air2)                                ; (time, lat,lon)<br>air2@_FillValue = -9.96921e+36                              <br>aveY = dim_avg_n_Wrap(air2,0)  ; average over the 0th dim<br>;printVarSummary(aveY)                                ; (lat,lon) <br>varY = dim_variance_n_Wrap(air2,0) ; compute variance<br>;printVarSummary(varY)                                ; (lat,lon) <br>;================================================================================<br>;Use "ttest" to compute the probabilities  plot: ZeroNegDashLineContour and ShadeLtContour<br>;           are in shea_util.ncl. <br>;=================================================================================<br>  sigr = 0.05                        ; critical sig lvl for r<br><br> xEqv = new(dimsizes(varY),typeof(varY),varY@_FillValue)<br>;printVarSummary(xEqv)                               ; (lat,lon) <br>  xEqv = equiv_sample_size (T4(lat|:,lon|:,time|:), sigr,0)   <br> copy_VarMeta(varY,xEqv)<br>;printVarSummary(xEqv)                               ; (lat,lon) <br><br> yEqv = new(dimsizes(varY),typeof(varY),varY@_FillValue)<br>;printVarSummary(yEqv)                                ; (lat,lon) <br>  yEqv = equiv_sample_size (air2(lat|:,lon|:,time|:), sigr,0)<br>copy_VarMeta(varY,yEqv)<br>;printVarSummary(yEqv)                                ; (lat,lon) <br>                   <br>;==================================================================================<br> probt = new(dimsizes(varY),typeof(varY),varY@_FillValue)<br><br> ;probt = ttest(aveY,varY,xEqv,aveX,varX,yEqv,True,False) ; values are between 0 and 1<br><br>probt = 100.*(1. -ttest(aveY,varY,xEqv,aveX,varX,yEqv,True,False)) ; all areas whose value > 95 are significant<br>printVarSummary(probt)                ; (lat,lon) <br><br>copy_VarMeta(varY,probt)<br>printVarSummary(probt)                ; (lat,lon) <br><br> printMinMax(probt,0)                    ;  min=0   max=97.2842<br>;============================================================<br>;calculate the T2M difference <br>;============================================================ <br> T2diff = new(dimsizes(aveY),typeof(aveY),aveY@_FillValue)<br>;printVarSummary(T2diff)                                 <br>copy_VarMeta(aveY,T2diff)<br>;printVarSummary(T2diff)                                 <br>T2diff=aveY-aveX<br>  ; printVarSummary(T2diff)                                ; (lat,lon) <br>;====================================================================<br>;Here is a section of my code that draws a color fill plot, and then<br>;overlays contours of statistical significance.<br>;====================================================================<br>   wks = gsn_open_wks("pdf","T2M_tt")<br>   gsn_define_colormap(wks,"BlWhRe")<br><br>  res = True<br>  res@cnFillOn             = True                ; turn on color<br>  res@gsnSpreadColors      = True                ; use full colormap<br><br>  res@cnLinesOn            = False               ; turn off contour lines<br>  res@cnLevelSelectionMode = "ManualLevels"  ; set manual contour levels<br>  res@cnMinLevelValF       = -2.             ; set min contour level<br>  res@cnMaxLevelValF       =  2.             ; set max contour level<br>  res@cnLevelSpacingF      =  0.2            ; set contour spacing<br><br>  res@gsnDraw              = False           ; Do not draw plot<br>  res@gsnFrame             = False           ; Do not advance frome<br><br>  res@tiMainString         = "T2M Difference: 50yrs overlay with ttest"<br>  ;res@gsnCenterString      = "5% stippled"<br>  ;res@gsnLeftString        = "K"<br>     res@cnFillMode       = "RasterFill"       ; Raster Mode<br>   res@cnRasterModeOn              = True              ; Raster mode shows grid cells<br>   plot = gsn_csm_contour_map(wks,T2diff,res)  <br>   plot = ZeroNegDashLineContour (plot)            ; a shea_util.ncl function<br><br> aa=stat_dispersion(probt,True)   ; Make sure your data has values less than  or equal to 0.95 that can be plotted<br>    <br>  res2 = True                            ; res2 probability plots<br>  res2@gsnDraw             = False       ; Do not draw plot<br>  res2@gsnFrame            = False       ; Do not advance frome<br>  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev<br>  res2@cnLevels   = (/.95/)    ; only have 1 contour level<br>  res2@cnInfoLabelOn       = False<br>  res2@cnLinesOn           = False       ; do not draw contour lines<br>  res2@cnLineLabelsOn      = False       ; do not draw contour labels<br>  res2@cnFillScaleF        = 0.6         ; add extra density<br>                                         ; add cyclic point<br>  ;res@gsnAddCyclic                = True              ; add cyclic point<br><br>  plot2   = gsn_csm_contour(wks,gsn_add_cyclic_point(probt(:,:)), res2) <br>  opt = True                    ; set up parameters for pattern fill<br>  opt@gsnShadeFillType = "pattern"  ; specify pattern fill<br>  opt@gsnShadeLow      = 17         ; stipple pattern<br>  plot2   = gsn_contour_shade(plot2, 0.95, 3., opt) ; stipple all areas < 95 contour                               <br>  overlay (plot, plot2)<br><br>  draw (plot)<br>  frame(wks)<br><br>;=====================================================================<br>;T2diff contains the temperature difference, probt contains the ttest<br>;values. <br>;=====================================================================<br><br><br><br><br><br><br>On Jan 17, 2018 9:36:03 PM, Adam Phillips wrote:
<br><blockquote class="felamimail-body-blockquote"><div dir="ltr">Hi Sri,<div>I think the issue is that you are letting NCL create the contour levels (for plot2), as you are setting <span style="font-size:12.8px;">res2@cnLevelSelectionMode = "ExplicitLevels" but you are </span>not setting res2@cnLevels. </div><div><div>gsn_contour_shade uses the existing contour levels to modify the plot, it does not add them itself. I would suggest doing this:</div></div><div><br></div><div>  stat_dispersion(probt,True)   ; Make sure your data has values less than  or equal to .05 that can be plotted</div><div>                                            ; <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml</a></div><div><br></div><div><span style="font-size:12.8px;">  res2 = True                          </span><span style="font-size:12.8px;">  ; res2 probability plots</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@gsnDraw             = False       ; Do not draw plot</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@gsnFrame            = False       ; Do not advance frome</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLevels   = (/.05/)    ; only have 1 contour level</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  ;res2@cnFillPatterns = (/-1,17/) ; don't fill <0.95, stipple >=0.95</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res@cnFillOn = True</span><br style="font-size:12.8px;"><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnInfoLabelOn       = False</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLinesOn           = False       ; do not draw contour lines</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLineLabelsOn      = False       ; do not draw contour labels</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnFillScaleF        = 0.6         ; add extra density</span><br style="font-size:12.8px;"><br style="font-size:12.8px;"><span style="font-size:12.8px;">  plot2 = gsn_csm_contour(wks,probt,</span><span style="font-size:12.8px;">res2)                         </span><span style="font-size:12.8px;">            ; add cyclic point</span><br style="font-size:12.8px;"><br style="font-size:12.8px;"><span style="font-size:12.8px;">  opt = True                    ; set up parameters for pattern fill</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  opt@gsnShadeFillType = "pattern"  ; specify pattern fill</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  opt@gsnShadeLow      = 17         ; stipple pattern</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  plot2   = gsn_contour_shade(plot2, 0.05, 3., opt) ; stipple all areas <= 0.05 contour</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  overlay (plot, plot2)</span><br style="font-size:12.8px;"></div><div><span style="font-size:12.8px;"><br></span></div><div><span style="font-size:12.8px;">or, more simply, do not even use gsn_contour_shade:</span></div><div><div>stat_dispersion(probt,True)   ; Make sure your data has values less than  or equal to .05 that can be plotted</div><div>                                            ; <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml</a></div></div><div><span style="font-size:12.8px;">  res2 = True                          </span><span style="font-size:12.8px;">  ; res2 probability plots</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@gsnDraw             = False       ; Do not draw plot</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@gsnFrame            = False       ; Do not advance frome</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLevels   = (/.05/)    ; only have 1 contour level</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnFillPatterns = (/17,-1/) ; don't fill <0.95, stipple >=0.95</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res@cnFillOn = True</span><br style="font-size:12.8px;"><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnInfoLabelOn       = False</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLinesOn           = False       ; do not draw contour lines</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnLineLabelsOn      = False       ; do not draw contour labels</span><br style="font-size:12.8px;"><span style="font-size:12.8px;">  res2@cnFillScaleF        = 0.6         ; add extra density</span><br style="font-size:12.8px;"><br style="font-size:12.8px;"><span style="font-size:12.8px;">  plot2 = gsn_csm_contour(wks,probt,</span><span style="font-size:12.8px;">res2)                         </span><span style="font-size:12.8px;">            ; add cyclic point</span><br style="font-size:12.8px;"></div><div><span style="font-size:12.8px;">  </span><span style="font-size:12.8px;">overlay (plot, plot2)</span></div><div><span style="font-size:12.8px;"><br></span></div><div><span style="font-size:12.8px;">Hope that helps. If you have any further questions please respond to the ncl-talk email list.</span></div><div><span style="font-size:12.8px;">Adam</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 17, 2018 at 1:18 PM, Sri Nandini via ncl-talk <span dir="ltr"><<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></span> wrote:<br><blockquote class="felamimail-body-blockquote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div>Hello<br><br>I am trying to plot ttest values overlay onto the T2m differences, but it is not being plotted nor shaded region according to 95%confidence limits with ttest.<br>Below is the script, i would be grateful if someone could let me know of my omission or deletion in the resources plotting attributes.<br><br>;Use NCL's named dimensions to reorder in time.<br>;Calculate the temporal means and variances using the dim_avg and dim_variance functions.<br>;Specify a critical significance level to test the lag-one auto-correlation coefficient and determine the (temporal) number of equivalent sample sizes in each grid point using equiv_sample_size.<br>;Specify a critical significance level for the ttest and test if the means are different at each grid point. <br>; This file still has to be loaded manually<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br><br> yrStrt = 0000<br> yrLast = 0100<br>; ==============================================================<br>; Open the file: Read only the user specified period <br>; ==============================================================<br>f= addfile("T2M_C.nc", "r") ;Model Control<br>TIME   = f->time<br>  YYYY   = cd_calendar(TIME,-1)/100                 ; entire file<br>  iYYYY  = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)<br>T41    = f->TREFHT(iYYYY,:,:)<br>printVarSummary(T41)                                ; (time, lat,lon)<br>T4    = lonFlip(T41)<br>printVarSummary(T4)                                ; (time, lat,lon)<br>T4@_FillValue = -9.96921e+36  <br>aveX = dim_avg_n_Wrap(T4, 0)                   ;; average over the 0th dim<br>printVarSummary(aveX)                                ; (lat,lon) <br>varX = dim_variance_n_Wrap(T4,0)               ; compute variance<br>printVarSummary(varX)                                ; (lat,lon) <br>;==============================================================================<br><br>f2= addfile("T2M_CC.nc", "r") ;Current Caspian<br>TIME2  = f2->time<br>  YYYY2   = cd_calendar(TIME2,-1)/100                 ; entire file<br>  iYYYY2  = ind(YYYY2.ge.yrStrt .and. YYYY2.le.yrLast)<br>air22   = f2->TREFHT(iYYYY2,:,:)<br>air2    = lonFlip(air22)<br>printVarSummary(air2)                                ; (time, lat,lon)<br>air2@_FillValue = -9.96921e+36                              <br>aveY = dim_avg_n_Wrap(air2,0)  ; average over the 0th dim<br>printVarSummary(aveY)                                ; (lat,lon) <br>varY = dim_variance_n_Wrap(air2,0) ; compute variance<br>printVarSummary(varY)                                ; (lat,lon) <br>;================================================================================<br>;Use "ttest" to compute the probabilities<br>;=================================================================================<br><br>  sigr = 0.05                        ; critical sig lvl for r<br><br> xEqv = new(dimsizes(varY),typeof(varY),varY@_FillValue)<br>printVarSummary(xEqv)                               ; (lat,lon) <br>  xEqv = equiv_sample_size (T4(lat|:,lon|:,time|:), sigr,0)   <br> copy_VarMeta(varY,xEqv)<br>printVarSummary(xEqv)                               ; (lat,lon) <br><br> yEqv = new(dimsizes(varY),typeof(varY),varY@_FillValue)<br>printVarSummary(yEqv)                                ; (lat,lon) <br>  yEqv = equiv_sample_size (air2(lat|:,lon|:,time|:), sigr,0)<br>copy_VarMeta(varY,yEqv)<br>printVarSummary(yEqv)                                ; (lat,lon) <br>                   <br>;==================================================================================<br> probt = new(dimsizes(varY),typeof(varY),varY@_FillValue)<br><br> probt = ttest(aveY,varY,xEqv,aveX,varX,yEqv,True,False) ; values are between 0 and 1<br><br>;probt = 100.*(1. -ttest(aveY,varY,xEqv,aveX,varX,yEqv,True,False)) ; all areas whose value > 95 are significant<br>printVarSummary(probt)                ; (lat,lon) <br>copy_VarMeta(varY,probt)<br>printVarSummary(probt)                ; (lat,lon) <br>print(probt)                   ;check to make sure values are between 0 and 1.<br>;============================================================<br>;calculate the T2M difference <br>;============================================================ <br> T2diff = new(dimsizes(aveY),typeof(aveY),aveY@_FillValue)<br>printVarSummary(T2diff)                                 <br>copy_VarMeta(aveY,T2diff)<br>printVarSummary(T2diff)                                 <br>T2diff=aveY-aveX<br>   printVarSummary(T2diff)                                ; (lat,lon) <br>;====================================================================<br>;Here is a section of my code that draws a color fill plot, and then<br>;overlays contours of statistical significance.<br>;====================================================================<br>   wks = gsn_open_wks("pdf","T2M_ttest")<br>   gsn_define_colormap(wks,"BlWhRe")<br><br>  res = True<br>  res@cnFillOn             = True                ; turn on color<br>  res@gsnSpreadColors      = True                ; use full colormap<br><br>  res@cnLinesOn            = False               ; turn off contour lines<br>  res@cnLevelSelectionMode = "ManualLevels"  ; set manual contour levels<br>  res@cnMinLevelValF       = -2.             ; set min contour level<br>  res@cnMaxLevelValF       =  2.             ; set max contour level<br>  res@cnLevelSpacingF      =  0.2            ; set contour spacing<br><br>  res@gsnDraw              = False           ; Do not draw plot<br>  res@gsnFrame             = False           ; Do not advance frome<br><br>  res@tiMainString         = "T2M Difference: 50yrs overlay with ttest"<br>  res@gsnCenterString      = "5% stippled"<br>  res@gsnLeftString        = "K"<br><br>   res@cnRasterModeOn              = True              ; Raster mode shows grid cells<br>   plot = gsn_csm_contour_map_ce(wks,T2diff,res)  <br>   plot = ZeroNegDashLineContour (plot)<br><br>  res2 = True                            ; res2 probability plots<br>  res2@gsnDraw             = False       ; Do not draw plot<br>  res2@gsnFrame            = False       ; Do not advance frome<br>  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev<br>  ;res2@cnLevels   = (/.95/)    ; only have 1 contour level<br>  ;res2@cnFillPatterns = (/-1,17/) ; don't fill <0.95, stipple >=0.95<br>  res@cnFillOn = False<br><br>  res2@cnInfoLabelOn       = False<br>  res2@cnLinesOn           = False       ; do not draw contour lines<br>  res2@cnLineLabelsOn      = False       ; do not draw contour labels<br>  res2@cnFillScaleF        = 0.6         ; add extra density<br><br>  plot2 = gsn_csm_contour(wks,probt,res2)                                     ; add cyclic point<br><br>  opt = True                    ; set up parameters for pattern fill<br>  opt@gsnShadeFillType = "pattern"  ; specify pattern fill<br>  opt@gsnShadeLow      = 17         ; stipple pattern<br>  plot2   = gsn_contour_shade(plot2, 0.091, 3., opt) ; stipple all areas < 0.09 contour<br>  overlay (plot, plot2)<br><br>  draw (plot)<br>  frame(wks)<br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br><br></blockquote></div><br><br style="clear:both;"><span class="HOEnZb"><span style="color:#888888;"></span></span><div><br></div>-- <br><div class="m_-5392367849868451064gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><span style="color:#888888;">Adam Phillips <br></span></span></div><span><span style="color:#888888;">Associate Scientist,  </span></span><span><span style="color:#888888;">Climate and Global Dynamics Laboratory, NCAR<br></span></span></div></div><div><span><span style="color:#888888;"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </span></span><span><span style="color:#888888;"><a target="_blank">303-497-1726</a> </span></span></div><span><span style="color:#888888;"></span></span><div><div><span><span style="color:#888888;"><br></span></span><div><span><span style="color:#888888;"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></span></span></div></div></div></div></div></div></div></div></div></div></div>
</div>
</blockquote><br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br><br></blockquote></div><br><br style="clear:both;"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><span style="color:#888888;">Adam Phillips <br></span></span></div><span><span style="color:#888888;">Associate Scientist,  </span></span><span><span style="color:#888888;">Climate and Global Dynamics Laboratory, NCAR<br></span></span></div></div><div><span><span style="color:#888888;"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </span></span><span><span style="color:#888888;">303-497-1726 </span></span></div><span><span style="color:#888888;"></span></span><div><div><span><span style="color:#888888;"><br></span></span><div><span><span style="color:#888888;"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></span></span></div></div></div></div></div></div></div></div></div></div></div>
</div>
</blockquote> res2 = True                            ; res2 probability plots<br>  res2@gsnDraw             = False       ; Do not draw plot<br>  res2@gsnFrame            = False       ; Do not advance frome<br>  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev<br>  res2@cnLevels   = (/95./)    ; only have 1 contour level<br>  res2@cnInfoLabelOn       = False<br>  res2@cnLinesOn           = False       ; do not draw contour lines<br>  res2@cnLineLabelsOn      = False       ; do not draw contour labels<br>  res2@cnFillScaleF        = 0.6         ; add extra density<br>                                         ; add cyclic point<br>  ;res@gsnAddCyclic                = True              ; add cyclic point<br>  plot2   = gsn_csm_contour(wks,gsn_add_cyclic_point(probt(:,:)), res2) <br><br>opt = True                    ; set up parameters for pattern fill<br>opt@gsnShadeFillType = "pattern"  ; specify pattern fill<br>opt@gsnShadeHigh      = 17         ; stipple pattern<br>plot2   = gsn_contour_shade(plot2, 1,95., opt) ; stipple all areas >= 95  contour      <br>overlay (plot, plot2)<br><br>  draw (plot)<br>  frame(wks) res2 = True                            ; res2 probability plots<br>  res2@gsnDraw             = False       ; Do not draw plot<br>  res2@gsnFrame            = False       ; Do not advance frome<br>  res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev<br>  res2@cnLevels   = (/95./)    ; only have 1 contour level<br>  res2@cnInfoLabelOn       = False<br>  res2@cnLinesOn           = False       ; do not draw contour lines<br>  res2@cnLineLabelsOn      = False       ; do not draw contour labels<br>  res2@cnFillScaleF        = 0.6         ; add extra density<br>                                         ; add cyclic point<br>  ;res@gsnAddCyclic                = True              ; add cyclic point<br>  plot2   = gsn_csm_contour(wks,gsn_add_cyclic_point(probt(:,:)), res2) <br><br>opt = True                    ; set up parameters for pattern fill<br>opt@gsnShadeFillType = "pattern"  ; specify pattern fill<br>opt@gsnShadeHigh      = 17         ; stipple pattern<br>plot2   = gsn_contour_shade(plot2, 1,95., opt) ; stipple all areas >= 95  contour      <br>overlay (plot, plot2)<br>
</div></blockquote><blockquote type="cite"><div><T2M_tt_0.95_NCL.pdf></div></blockquote><blockquote type="cite"><div><T2M_tt_0.75_NCL.pdf></div></blockquote></body></html>