[ncl-talk] T-test for filtered time series

Adam Phillips asphilli at ucar.edu
Wed Jan 2 11:42:36 MST 2019


Hi Lyndz,
1) You can usually safely ignore these error messages. I believe they
usually occur due to timeseries (or individual gridpoints) having standard
deviations of 0 or missing.
2) At line 50 you have this:
 prob = ttest(xAve,xVar,xN, yAve,yVar,yN, iflag, False)
and then at line 58 you have this:
 prob = prob(0,:)

The easiest solution is to rename prob to say prob2 at line 58, and then
change prob to prob2 at lines 61 and 81. Alternatively, you can also
overwrite the previous iteration of prob like this:
prob := prob(0,:)

Renaming the array is the better solution from a safe-coding perspective.

Hope that helps. If you have any further questions let ncl-talk know.
Adam



On Fri, Dec 28, 2018 at 4:41 AM Lyndz <olagueralyndonmark429 at gmail.com>
wrote:

> *Dear NCL-experts,*
>
> I want to perform a *t*-test similar to example 4 in the NCL webpage: (
> https://www.ncl.ucar.edu/Document/Functions/Built-in/ttest.shtml), but in
> this case,
> I will be using a different equivalent sample size (degrees of freedom)
> following Davis (1976) (below image explains the details and also attached
> in this email):
>
> [image: Screenshot from 2018-12-28 18-33-00.png]
>
> *Sources:*
> *Davis, R. E., 1976: Predictability of sea surface temperature and sea
> level pressure anomalies over the North Pacific Ocean. J. Phys. Oceanogr.,
> 6, 249–266.*
>
> Below are the links to my data sets. I also attached here the script. I
> want to save the output as a netcdf file with the test statistics and
> pvalues.
>
> *Link to File 1:*
> https://www.dropbox.com/s/cmjpmvcw9i4qxo0/rhum_P45P50_1979-1993_filt_850hPa.nc?dl=0
> *Link to File 2:*
> https://www.dropbox.com/s/o8dtkt2yznlgvql/rhum_P45P50_1994-2008_filt_850hPa.nc?dl=0
>
> *PROBLEMS*:
> 1. I got the following warning message:
>        *  warning:ttest: encountered 10512 cases where s1 and/or s2 were
> less than 2. Output set           to missing values in these cases*
> I am not sure if this should be ignored or this indicates a mistake in my
> code.
>
> 2. I also got the following error message after running the script:
> *         fatal:Number of dimensions on right hand side do not match
> number of dimension in left hand side*
> *         fatal:["Execute.c":8640]:Execute: Error occurred at or near line
> 58 in file ttest_filtered.ncl*
> Any idea how to solve this?
>
> I would like to ask for your suggestions 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/20190102/3214195f/attachment.html>


More information about the ncl-talk mailing list