[ncl-talk] How to plot t-test figure?

Steven Kong kongksk at gmail.com
Wed Oct 21 20:32:52 MDT 2015


Hi all,

I try to plot t-test figure, with significant change >95% between
01-January and 02-Janaury. But i found an error as shown below

"fatal:Number of dimensions in parameter (2) of (wrf_contour) is (1), (2)
dimensions were
expected

fatal:["Execute.c":8578]:Execute: Error occurred at or near line 56 in file
t-test2.ncl  "

Can anyone help me on this? Your assistance is highly appreciated.
Thank you.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
   a = addfile("./JAN2010/01-05/wrfout_d02_2010-01-01_00:00:00","r")
   b = addfile("./JAN2010/01-05/wrfout_d02_2010-01-02_00:00:00","r")

  wks = gsn_open_wks("x11","plt_geo2_6")
        gsn_define_colormap(wks,"BlAqGrYeOrReVi200")            ; Create a
plot workstation

  opts = True                                      ; Set some Basic Plot
options
  opts at MainTitle = "GEOGRID FIELDS"
  opts at InitTime = False                            ; Do not plot time or
footers
  opts at Footer = False

;;;;;;;;;;;;;;;;;;;;;daily mean temperature at 01 January;;;;;;;;;;;;;;

temp1=a->T2(0,:,:)
temp1=0
  do i = 0,23
    temp1 = temp1 + a->T2(i,:,:)
  end do

  mean1 = temp1/24

;;;;;;;;;;;;;;;;;;;;;daily mean temperature at 02 January;;;;;;;;;;;;;;

temp2=b->T2(0,:,:)
temp2=0
  do i = 0,23
    temp2 = temp2 + b->T2(i,:,:)
  end do

  mean2 = temp2/24

;------------------T-Test: Area with 95% significant
difference----------------------------------------------

aveX = avg(mean1)
varX = variance(mean1)

aveY = avg(mean2)
varY = variance(mean2)

alphat = 100.*(1. - ttest(aveX,varX,24, aveY,varY,24, True, False))
aveX = where(alphat.lt.95.,aveX at _FillValue, aveX)

  res = opts                                       ; Use basic options for
this field
  res at cnFillOn = True                              ; Create a color fill
plot
;  res at ContourParameters = (/ -50., 50., 5. /)    ; Set the levels

  contour = wrf_contour(a,wks,aveX,res)

  pltres = True                                    ; Set plot options
  mpres = True                                     ; Set map options
  mpres at mpGeophysicalLineColor      = "Black"      ; Overwrite basic map
settings
  mpres at mpGridLineColor             = "Black"
  mpres at mpLimbLineColor             = "Black"
  mpres at mpNationalLineColor         = "Black"
  mpres at mpPerimLineColor            = "Black"
  mpres at mpUSStateLineColor          = "Black"
  plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres) ; Plot field over
map background

end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151022/38d7f133/attachment.html 


More information about the ncl-talk mailing list