[ncl-talk] error with ftest
Adam Phillips
asphilli at ucar.edu
Mon Apr 30 11:02:02 MDT 2018
Hi Lyndz,
latGauWgt will only work with gaussian latitudes (and is therefore
returning 72 weights instead of 73), and you have a regular 2.5 degree
spaced latitude grid. There are other ways to account for the shrinking
size of grid boxes as you approach the poles. You could weight by the
cosine of the latitude:
pi = 4.*atan(1.0)
rad = (pi/180.)
coslat = cos(xtmp&lat*rad) ; input array = x
xN = wgt_areaave (xEqv, coslat, 1., 0)
yN = wgt_areaave (yEqv, coslat, 1., 0)
See example one on the wgt_areaave page here for a good summary of
weighting options:
https://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml
Hope that helps!
Adam
On Sun, Apr 29, 2018 at 2:23 AM, Lyndz <olagueralyndonmark429 at gmail.com>
wrote:
> Dear NCL-experts,
>
> I am trying to perform an F-test. Here are the files:
>
> *Link to File 1: *
> https://drive.google.com/file/d/1BCKb7UdM50ckVqIvhnSbO9tkyMK0D
> miF/view?usp=sharing
>
> *Link to File 2:*
> https://drive.google.com/file/d/1YtYd4hTIUC3tupaAm4oc69xhilkP9
> qcj/view?usp=sharing
>
> Here's my script:
>
> a = addfile("P45P50_bpass_mean_anom_1979-1993.nc","r")
> fa = a->xBPF
>
> b = addfile("P45P50_bpass_mean_anom_1994-2008.nc","r")
> fb = b->xBPF
>
> xtmp = fa(lat|:,lon|:,time|:)
> ttmp = fb(lat|:,lon|:,time|:)
>
> xVar = dim_variance (xtmp)
> yVar = dim_variance (ytmp)
>
> sigr = 0.05
> xEqv = equiv_sample_size (xtmp, sigr,0)
> yEqv = equiv_sample_size (ytmp, sigr,0)
>
> nlat = 73
> gwt = latGauWgt(nlat, "lat", "gaussian weights", "") ; 72 points
>
> xN = wgt_areaave (xEqv, gwt, 1., 0)
> yN = wgt_areaave (yEqv, gwt, 1., 0)
>
> sigf = 0.10
> prob = ftest(xVar,xN, yVar,yN, False)
>
>
> Here's the *printVarSummary* of fa:
>
> Variable: fa
> Type: float
> Total Size: 630720 bytes
> 157680 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 15] x [lat | 73] x [lon | 144]
> Coordinates:
> time: [1574700..1697436]
> lat: [90..-90]
> lon: [ 0..357.5]
> Number Of Attributes: 5
> long_name : Lanczos Bpassfilt
> units : W m-2
> _FillValue : 32766
> missing_value : 32766
> wgt_runave_op_ncl : wgt_runave_n
>
>
> After the *gwt* I encounter the following errors:
>
> fatal:wgt_areaave: wgty must be a scalar or a 1-dimensional vector the
> same size as the second-to-the-last dimension of x
> fatal:["Execute.c":8638]:Execute: Error occurred at or near line 19
>
>
> Any suggestion on how to do this correctly in NCL?
>
> I'll appreciate any help.
>
> Sincerely,
>
> Lyndz
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, 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/20180430/753925ca/attachment.html>
More information about the ncl-talk
mailing list