[Numpy-discussion] Reading a big netcdf file

Christopher Barker Chris.Barker@noaa....
Wed Aug 3 13:40:08 CDT 2011


On 8/3/11 9:46 AM, Gökhan Sever wrote:
> In [23]: from netCDF4 import Dataset
>
> In [24]: f = Dataset("test.nc <http://test.nc>")
>
> In [25]: f.variables['reflectivity'].shape
> Out[25]: (6, 18909, 506)
>
> In [26]: f.variables['reflectivity'].size
> Out[26]: 57407724
>
> In [27]: f.variables['reflectivity'][:].dtype
> Out[27]: dtype('float32')
>
> In [28]: timeit z = f.variables['reflectivity'][:]
> 1 loops, best of 3: 731 ms per loop

that seems pretty fast, actually -- are you sure that [:] forces the 
full data read? It probably does, but I'm not totally sure.

is "z" a numpy array object at that point?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list