Ive got a netCDF file that looks as follows:
$ ncdump my_file.nc
dimensions:
time = UNLIMITED ; // (144 currently)
lat = 130 ;
lon = 360 ;
bnds = 2 ;
variables:
double ohc_2D(time, lat) ;
ohc_2D:_FillValue = 1.e+20 ;
ohc_2D:standard_name = "ocean_heat_content_2D" ;
ohc_2D:long_name = "ocean heat content 2D" ;
ohc_2D:units = "10^12 J m-2" ;
float time(time) ;
time:axis = "T" ;
time:units = "days since 2004-01-01 00:00:00" ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:calendar = "gregorian" ;
time:time_origin = "01-JAN-2004 00:00:00" ;
float lat(lat) ;
lat:axis = "Y" ;
lat:units = "degrees" ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:point_spacing = "even" ;
double ohc_3D(time, lat, lon) ;
ohc_3D:_FillValue = 1.e+20 ;
ohc_3D:standard_name = "ocean_heat_content_3D" ;
ohc_3D:long_name = "ocean heat content 3D" ;
ohc_3D:units = "10^12 J m-2" ;
float lon(lon) ;
lon:axis = "X" ;
lon:bounds = "lon_bnds" ;
lon:units = "degrees" ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:modulo = 360. ;
lon:point_spacing = "even" ;
float lon_bnds(lon, bnds) ;
When I try and load one of the variables using the standard_name, I get a constraint error:
with iris.FUTURE.context(cell_datetime_objects=True):
cube1 = iris.load_cube('my_file.nc', 'ocean_heat_content_3D')
ConstraintMismatchError Traceback (most recent call last)
<ipython-input-19-f8f3a453fedb> in <module>()
1 with iris.FUTURE.context(cell_datetime_objects=True):
----> 2 cube1 = iris.load_cube(fname, 'ocean_heat_content_3D')
/g/data/r87/dbi599/miniconda2/envs/default/lib/python2.7/site-packages/iris/__init__.pyc in load_cube(uris, constraint, callback)
341 raise iris.exceptions.ConstraintMismatchError(str(e))
342 except ValueError:
--> 343 raise iris.exceptions.ConstraintMismatchError('no cubes found')
344
345 return cube
ConstraintMismatchError: no cubes found
but everything works fine using the long_name.
This is the first time using the standard_name has failed for me, so I'm wondering if the problem is the number in the standard_name? Otherwise, I can't think of any reason for this error?