From a925cb1bc5ef8e0e48085e4ecc09775a1b24c333 Mon Sep 17 00:00:00 2001 From: MartinDix Date: Mon, 11 Jul 2016 12:35:30 +1000 Subject: [PATCH] Add NETCDF4_CLASSIC to the check for formats that don't support int64 and uint --- lib/iris/fileformats/netcdf.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/iris/fileformats/netcdf.py b/lib/iris/fileformats/netcdf.py index b04e58503b..9a7e1801e1 100644 --- a/lib/iris/fileformats/netcdf.py +++ b/lib/iris/fileformats/netcdf.py @@ -1244,12 +1244,13 @@ def _cf_coord_identity(self, coord): return coord.standard_name, coord.long_name, units def _ensure_valid_dtype(self, values, src_name, src_object): - # NetCDF3 does not support int64 or unsigned ints, so we check - # if we can store them as int32 instead. + # NetCDF3 and NetCDF4 classic do not support int64 or unsigned ints, + # so we check if we can store them as int32 instead. if ((np.issubdtype(values.dtype, np.int64) or np.issubdtype(values.dtype, np.unsignedinteger)) and self._dataset.file_format in ('NETCDF3_CLASSIC', - 'NETCDF3_64BIT')): + 'NETCDF3_64BIT', + 'NETCDF4_CLASSIC')): # Cast to an integer type supported by netCDF3. if not np.can_cast(values.max(), np.int32) or \ not np.can_cast(values.min(), np.int32):