Okay, past my bug and on to a technical question:
Can I use Iris to append addtional singleton time dimension 4D slices (1, 40, 24, 28) [time, z, lat, lon] to my existing 1 time step NetCDF written by Iris?
I can do it using NetCDF4:
nc = netCDF4.Dataset('cfsr.nc','r+')
for i in range(10):
url='http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/\
cmd_ocnh/2009/200905/200905%2.2d/ocnh01.gdas.200905%2.2d00.grb2' % (i+1,i+1)
print url
cubes = iris.load(url)
t = cubes[4]
slice=t.extract(iris.Constraint(longitude=lambda cell: -77.+360. < cell < -63.0+360.,latitude=lambda cell: 34. < cell < 46.0))
nc.variables['Potential_temperature'][i,:,:,:]=slice.data
and this works (although I still would need to write the time value for each step), but I'm wondering whether I could avoid using NetCDF4 directly and just use Iris.
Full example here:
http://nbviewer.ipython.org/5777643Thanks,
Rich