<div dir="ltr">Hi Steven,<div>Starting with the error message:</div><div><span style="font-size:12.8px">&quot;fatal:Number of dimensions in parameter (2) of (wrf_contour) is (1), (2) dimensions were expected                      </span><span style="font-size:12.8px">                              </span><span style="font-size:12.8px">                   </span><br style="font-size:12.8px"><span style="font-size:12.8px">fatal:[&quot;Execute.c&quot;:8578]:</span><span style="font-size:12.8px">Execute: Error occurred at or near line 56 in file t-test2.ncl  &quot;</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">The error message is saying you are passing in a 1-dimensional array, while wrf_contour expects a 2-dimensional array. You can see this by issuing a printVarSummary(aveX) command. </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Backing up in your script, this is happening because you are using the avg and variance functions which will each return a single value.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I believe you want to use the dim_avg_N_Wrap and dim_variance_n_Wrap functions, but you need to pass in the hourly values and not the mean values as you are doing now.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I believe the following code will accomplish what you are trying to do. It is untested, so make sure you understand what it is doing and check the results:</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">load &quot;$NCARG_ROOT/lib/ncarg/</span><span style="font-size:12.8px">nclscripts/csm/gsn_code.ncl&quot;</span><br style="font-size:12.8px"><span style="font-size:12.8px">load &quot;$NCARG_ROOT/lib/ncarg/</span><span style="font-size:12.8px">nclscripts/wrf/WRFUserARW.ncl&quot;</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">begin</span><br style="font-size:12.8px"><span style="font-size:12.8px">   a = addfile(&quot;./JAN2010/01-05/</span><span style="font-size:12.8px">wrfout_d02_2010-01-01_00:00:</span><span style="font-size:12.8px">00&quot;,&quot;r&quot;)</span><br style="font-size:12.8px"><span style="font-size:12.8px">   b = addfile(&quot;./JAN2010/01-05/</span><span style="font-size:12.8px">wrfout_d02_2010-01-02_00:00:</span><span style="font-size:12.8px">00&quot;,&quot;r&quot;)</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">  wks = gsn_open_wks(&quot;x11&quot;,&quot;plt_geo2_</span><span style="font-size:12.8px">6&quot;)</span><br style="font-size:12.8px"><span style="font-size:12.8px">        gsn_define_colormap(wks,&quot;</span><span style="font-size:12.8px">BlAqGrYeOrReVi200&quot;)            ; Create a plot workstation</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">  opts = True                          </span><span style="font-size:12.8px">            ; Set some Basic Plot options</span><br style="font-size:12.8px"><span style="font-size:12.8px">  opts@MainTitle = &quot;GEOGRID FIELDS&quot;</span><br style="font-size:12.8px"><span style="font-size:12.8px">  opts@InitTime = False                         </span><span style="font-size:12.8px">   ; Do not plot time or footers</span><br style="font-size:12.8px"><span style="font-size:12.8px">  opts@Footer = False</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">;;;;;;;;;;;;;;;;;;;;;daily mean temperature at </span><span class="" tabindex="0" style="font-size:12.8px"><span class="">01 January</span></span><span style="font-size:12.8px">;;;;;;;;;;;;;;</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">temp1 = a-&gt;T2</span><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">aveX = dim_avg_n_Wrap(temp1,0)  ; average over the 0th dim</span></div><div><span style="font-size:12.8px">varX = dim_variance_n_Wrap(temp1,0) ; compute variance</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">printVarSummary(temp1)</span></div><div><span style="font-size:12.8px">printVarSummary(aveX)</span></div><div><span style="font-size:12.8px">printVarSummary(varX)</span><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><div><span style="font-size:12.8px">temp2 = b-&gt;T2</span><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">aveY = dim_avg_n_Wrap(temp2,0)  ; average over the 0th dim</span></div><div><span style="font-size:12.8px">varY = dim_variance_n_Wrap(temp2,0) ; compute variance</span></div></div><div><br></div><div><span style="font-size:12.8px">alphat = 100.*(1. - ttest(aveX,varX,24, aveY,varY,24, True, False))</span><br style="font-size:12.8px"></div><div><div><span style="font-size:12.8px">aveX = where(alphat.lt.95.,aveX@_</span><span style="font-size:12.8px">FillValue, aveX)</span></div></div><div><span style="font-size:12.8px">;--------------------------------</span><br></div><div><span style="font-size:12.8px">These last two lines are straight from your original script. I would strongly suggest you review the documentation for ttest:</span></div><div><span style="font-size:12.8px"><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ttest.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/ttest.shtml</a></span><br></div><div><span style="font-size:12.8px">as I do not believe you should be setting your 2nd to last option to True.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">And you should also review the documentation for dim_avg_n_Wrap and dim_variance_n_Wrap if you have not used them before:</span></div><div><span style="font-size:12.8px"><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml</a></span><br></div><div><span style="font-size:12.8px"><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_variance_n_Wrap.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_variance_n_Wrap.shtml</a></span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">If the above does not help, or if you have any further questions, please respond to the ncl-talk email list and not to me personally.</span></div><div><span style="font-size:12.8px">Adam</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> </span></div><div><span style="font-size:12.8px"><br></span></div><div><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 21, 2015 at 8:32 PM, Steven Kong <span dir="ltr">&lt;<a href="mailto:kongksk@gmail.com" target="_blank">kongksk@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi all, <br><br></div>I try to plot t-test figure, with significant change &gt;95% between 01-January and 02-Janaury. But i found an error as shown below<br><div><div><br>&quot;fatal:Number of dimensions in parameter (2) of (wrf_contour) is (1), (2) dimensions were expected                                                                       <br>fatal:[&quot;Execute.c&quot;:8578]:Execute: Error occurred at or near line 56 in file t-test2.ncl  &quot;<br><br>Can anyone help me on this? Your assistance is highly appreciated.<br>Thank you.<br><br><br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl&quot;<br><br>begin<br>   a = addfile(&quot;./JAN2010/01-05/wrfout_d02_2010-01-01_00:00:00&quot;,&quot;r&quot;)<br>   b = addfile(&quot;./JAN2010/01-05/wrfout_d02_2010-01-02_00:00:00&quot;,&quot;r&quot;)<br><br>  wks = gsn_open_wks(&quot;x11&quot;,&quot;plt_geo2_6&quot;)<br>        gsn_define_colormap(wks,&quot;BlAqGrYeOrReVi200&quot;)            ; Create a plot workstation<br><br>  opts = True                                      ; Set some Basic Plot options<br>  opts@MainTitle = &quot;GEOGRID FIELDS&quot;<br>  opts@InitTime = False                            ; Do not plot time or footers<br>  opts@Footer = False<br><br>;;;;;;;;;;;;;;;;;;;;;daily mean temperature at 01 January;;;;;;;;;;;;;;<br><br>temp1=a-&gt;T2(0,:,:)<br>temp1=0<br>  do i = 0,23<br>    temp1 = temp1 + a-&gt;T2(i,:,:)<br>  end do<br><br>  mean1 = temp1/24<br><br>;;;;;;;;;;;;;;;;;;;;;daily mean temperature at 02 January;;;;;;;;;;;;;;<br><br>temp2=b-&gt;T2(0,:,:)<br>temp2=0<br>  do i = 0,23<br>    temp2 = temp2 + b-&gt;T2(i,:,:)<br>  end do<br><br>  mean2 = temp2/24<br><br>;------------------T-Test: Area with 95% significant difference----------------------------------------------<br><br>aveX = avg(mean1)<br>varX = variance(mean1)<br><br>aveY = avg(mean2)<br>varY = variance(mean2)<br><br>alphat = 100.*(1. - ttest(aveX,varX,24, aveY,varY,24, True, False))<br>aveX = where(alphat.lt.95.,aveX@_FillValue, aveX)<br><br>  res = opts                                       ; Use basic options for this field<br>  res@cnFillOn = True                              ; Create a color fill plot<br>;  res@ContourParameters = (/ -50., 50., 5. /)    ; Set the levels<br><br>  contour = wrf_contour(a,wks,aveX,res)<br><br>  pltres = True                                    ; Set plot options<br>  mpres = True                                     ; Set map options<br>  mpres@mpGeophysicalLineColor      = &quot;Black&quot;      ; Overwrite basic map settings<br>  mpres@mpGridLineColor             = &quot;Black&quot;<br>  mpres@mpLimbLineColor             = &quot;Black&quot;<br>  mpres@mpNationalLineColor         = &quot;Black&quot;<br>  mpres@mpPerimLineColor            = &quot;Black&quot;<br>  mpres@mpUSStateLineColor          = &quot;Black&quot;<br>  plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres) ; Plot field over map background<br><br>end<br><br></div></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><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><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>