len() of unsized object - ks test
Jamie Mitchell
jamiemitchell1604 at gmail.com
Fri Apr 25 12:23:59 EDT 2014
On Friday, April 25, 2014 3:07:54 PM UTC+1, Jamie Mitchell wrote:
> Hello all,
>
>
>
> I am trying to perform a Kolmogorov-Smirnov test in Python but I'm having a few difficulties.
>
>
>
> # My files are netCDF so I import them as follows:
>
>
>
> control=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swest_concatannavg_1D.nc','r')
>
>
>
> # The string is simply a 1D array
>
>
>
> # Then performing the ks test:
>
>
>
> kstest(control,'norm')
>
>
>
> # I then get the following error:
>
>
>
> File "<stdin>", line 1, in <module>
>
> File "/usr/local/sci/lib/python2.7/site-packages/scipy/stats/stats.py", line 3413, in kstest
>
> N = len(vals)
>
> TypeError: len() of unsized object
>
>
>
> Any ideas on why this isn't working would be great.
>
>
>
> Thanks,
>
>
>
> Jamie
Thanks for your help.
Steven your right I wasn't reading in the file on netCDF4.Dataset, I was just opening it. I have rectified it now - a silly mistake!
Thanks again,
Jamie
More information about the Python-list
mailing list