[ncl-talk] Error number dimensions ttest funcion
Adam Phillips
asphilli at ucar.edu
Wed Nov 19 13:45:58 MST 2014
Hi Noelia,
sX and sY should be the sample sizes, so I think you should change these
lines:
sX = dimsizes (ave_ua_ncep)
sY = dimsizes(ave_ua_model)
to these lines:
sX = dimsizes (ave_ua_ncep&time)
sY = dimsizes(ave_ua_model&time)
Alternatively, you could use the equiv_sample_size function:
https://www.ncl.ucar.edu/Document/Functions/Built-in/equiv_sample_size.shtml
If you have any further queries please respond only to the ncl-talk list.
Adam
On Wed, Nov 19, 2014 at 1:11 PM, Noelia otero <noeli1680 at gmail.com> wrote:
> Hi,
>
> I am having problems with the ttest function, the error is:
>
> fatal:ttest: If s1 is not a scalar, then it must have the same number of
> dimensions as ave1, var1, ave2, and var2
>
> I don't understand very much this error, I would like to ask you what I am
> missing here.
>
> This is a piece of the code:
> ua_ncep = u_ncep->uwnd(1:42,1,:,:) ;select 925 level
> ;Averages
> ave_ua_ncep=dim_avg(ua_ncep(lat|:,lon|:,time|:))
> ;Variances
> Var_ua_ncep = dim_variance (ua_ncep(lat|:,lon|:,time|:)) ;
> calculate variances
> ;Defining sizes
> sX = dimsizes (ave_ua_ncep)
> ;Model
> ua_model = uFiles[i]->ua(1:42,1,:,:) ;plevel 1=925 plevel 9=200
> ;Time averages
> ave_ua_model=dim_avg(ua_model(lat|:,lon|:,time|:))
> ;Variances
> Var_ua_model = dim_variance (ua_model(lat|:,lon|:,time|:)) ;
> calculate var.
> sY=dimsizes(ave_ua_model)
> iflag=False
> ;Significance levels:
> prob = ttest(ave_ua_ncep,Var_ua_ncep^2,sX,
> ave_ua_model,Var_ua_model^2,sY, iflag, False) ;using STD
>
> I also wanted to ask you, in this case, would it be necessary to use
> wgt_areaave
> <https://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml>?
>
> Many thanks in advance,
>
>
> Cheers,
>
>
> Noelia
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Division, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141119/99630a1b/attachment.html
More information about the ncl-talk
mailing list