Question

I am trying to read a .nc file using the netcdf4 package in ipython-notebook. This file is a combination of 30 .nc files each with shape [time,lat,long] [12,222,462] -- created using the simple NCO command -

    $ ncrcat infiles*.nc out.nc

I know ncrcat operates on the (and requires a) record dimension -- time is the unlimited dimension in these files. So I expect out.nc to have the shape [360,222,462]. But when I use netcdf4 to read out.nc file, it's shape is still [12,222,462] and it seems to only read the first input file. I know that out.nc has more records in it because when I use the 'ncBrowse' utility, out.nc shows up with expected dimensions - i.e. with 360 'time' records in place of 12!!!

I have only been working with netcdf files for a couple of weeks (usinf netcdf4 and pandas) and I am just a beginner python user. So I am wondering if i am missing something obvious here?

Other possibly pertinent info: I use NCO operators on a linux machine to concatenate files, but ipython on a windows machine. Each individual input file is correctly read by netcdf4.

I really appreciate any help on this!

Was it helpful?

Solution

In case anyone came across a similar issue -- I didn't find a real solution but I was able to use/open all the .nc files in ipython on the same Linux machine that they were created on (still unable to do that on the windows machine). Strange!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top