[cmor] 142/190: WIP: python3

Alastair McKinstry mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository cmor.

commit 44bf7ebb2402fd0452e1e4938322a713fd8145e9
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Wed Jun 12 11:21:18 2013 +0100

    WIP: python3
---
 debian/control               |    2 +
 debian/patches/python3.patch | 1068 ++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series        |    1 +
 3 files changed, 1071 insertions(+)

diff --git a/debian/control b/debian/control
index 947b0d7..3ca5c60 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,8 @@ Maintainer: Alastair McKinstry <mckinstry at debian.org>
 Build-Depends: debhelper (>= 9), dh-buildinfo, libossp-uuid-dev, libudunits2-dev, libnetcdf-dev, uuid-dev, python-all-dev (>= 2.6.6-3~), python-setuptools (>= 0.6b3), libgfortran3, automake, python-numpy, gfortran, python3-numpy, python3-all-dev, python3-setuptools
 Build-Conflicts: libcmor2
 Standards-Version: 3.9.4
+X-Python-Version: >= 2.6
+X-Python3-Version: >= 3.2
 Homepage:  http://www2-pcmdi.llnl.gov/cmor
 
 Package: libcmor2
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..c67a7ca
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,1068 @@
+Author: Alastair McKinstry <mckinstry at debian.org>
+Description: Fixes needed to make code python2/3 compatible. NOTE: INCOMPLETE
+Last-Updated: 2013-06-12
+Forwarded: no
+
+Index: cmor-2.8.3/setup.py
+===================================================================
+--- cmor-2.8.3.orig/setup.py	2013-06-11 10:55:03.000000000 +0100
++++ cmor-2.8.3/setup.py	2013-06-11 12:02:51.000000000 +0100
+@@ -3,6 +3,8 @@
+ #from numpy.distutils.ccompiler import CCompiler
+ import os,sys,string
+ 
++from __future__ import print_function
++
+ include_dirs = [numpy.lib.utils.get_include(),"include","include/cdTime"]
+ 
+ library_dirs = [ os.path.join("/usr","lib") ,'.']
+@@ -38,12 +40,12 @@
+       ld.append(p)
+ include_dirs=ld
+ 
+-print 'Setting up python module with:'
+-print 'libraries:',libraries
+-print 'libdir:',library_dirs
+-print 'incdir',include_dirs
+-print 'src:',srcfiles
+-print 'macros:',macros
++print('Setting up python module with:')
++print('libraries:',libraries)
++print('libdir:',library_dirs)
++print('incdir',include_dirs)
++print('src:',srcfiles)
++print('macros:',macros)
+ 
+ setup (name = "CMOR",
+        version='2.0',
+Index: cmor-2.8.3/Lib/git2svn.py
+===================================================================
+--- cmor-2.8.3.orig/Lib/git2svn.py	2013-06-10 22:15:22.000000000 +0100
++++ cmor-2.8.3/Lib/git2svn.py	2013-06-11 12:18:40.000000000 +0100
+@@ -1,5 +1,7 @@
+ import os,sys
+ 
++from __future__ import print_function
++
+ svn=sys.argv[1]
+ 
+ git = os.popen("git status").readlines()
+@@ -17,15 +19,15 @@
+ 
+ for f in modfiles+newfiles:
+     cmd = "cp -pf %s %s/%s" % (f,svn,f)
+-    print 'Cp:',cmd
++    print('Cp:',cmd)
+     os.popen(cmd).readlines()
+ 
+ for f in newfiles:
+     cmd = "cd %s ; svn add %s" % (svn,f)
+-    print 'svn add :',cmd
++    print('svn add :',cmd)
+     os.popen(cmd).readlines()
+ 
+ for f in delfiles:
+     cmd = "cd %s ; svn delete --force %s" % (svn,f)
+-    print 'svn del :',cmd
++    print('svn del :',cmd)
+     os.popen(cmd).readlines()
+Index: cmor-2.8.3/Lib/pywrapper.py
+===================================================================
+--- cmor-2.8.3.orig/Lib/pywrapper.py	2013-06-10 22:15:22.000000000 +0100
++++ cmor-2.8.3/Lib/pywrapper.py	2013-06-12 05:42:31.000000000 +0100
+@@ -37,25 +37,25 @@
+     missing_value : scalar that is used to indicate missing data for this variable.  It must be the same type as the data that will be passed to cmor_write.  This missing_value will in general be replaced by a standard missing_value specified in the MIP table.  If there are no missing data, and the user chooses not to declare the missing value, then this argument may be either omitted or assigned the value 'none' (i.e., missing_value='none').
+     """
+     if not isinstance(table_entry,str):
+-        raise Exception, "Error you must pass a string for the variable table_entry"
++        raise Exception("Error you must pass a string for the variable table_entry")
+     
+     if not isinstance(units,str):
+-        raise Exception, "Error you must pass a string for the variable units"
++        raise Exception("Error you must pass a string for the variable units")
+     if not isinstance(type,str):
+-        raise Exception, "error tpye must a a string"
++        raise Exception("error tpye must a a string")
+     type = type.lower()
+     if type == 's':
+         type ='c'
+     if not type in ["c","d","f","l","i"]:
+-        raise Exception, 'error unknown type: "%s", must be one of: "c","d","f","l","i"'
++        raise Exception('error unknown type: "%s", must be one of: "c","d","f","l","i"')
+ 
+     if not isinstance(grid_id,(int,numpy.int,numpy.int32)):
+-        raise Exception, "error grid_id must be an integer"
++        raise Exception("error grid_id must be an integer")
+     grid_id = int(grid_id)
+ 
+     if missing_value is not None:
+         if not isinstance(missing_value,(float,int,numpy.float,numpy.float32,numpy.int,numpy.int32)):
+-            raise Exception, "error missing_value must be a number, you passed: %s" % type(missing_value)
++            raise Exception("error missing_value must be a number, you passed: %s" % type(missing_value))
+         missing_value = float(missing_value)
+         
+     return _cmor.time_varying_grid_coordinate(grid_id,table_entry,units,type,missing_value)
+@@ -68,7 +68,7 @@
+         try:
+             vals = numpy.ascontiguousarray(vals.filled())
+         except:
+-            raise Exception, "Error could not convert %s to a numpy array" % message
++            raise Exception("Error could not convert %s to a numpy array" % message)
+         
+     return vals
+ 
+@@ -92,32 +92,32 @@
+     elif isinstance(axis_ids,(list,tuple)):
+         axis_ids = numpy.ascontiguousarray(axis_ids)
+     elif not isinstance(axis_ids, numpy.ndarray):
+-        raise Exception, "Error could not convert axis_ids list to a numpy array"
++        raise Exception("Error could not convert axis_ids list to a numpy array")
+ 
+     if numpy.rank(axis_ids)>1:
+-        raise Exception, "error axes list/array must be 1D"
++        raise Exception("error axes list/array must be 1D")
+ 
+     if latitude is not None:
+         latitude = _to_numpy(latitude, 'latitude')
+             
+         if numpy.rank(latitude)!=len(axis_ids):
+-            raise Exception, "latitude's rank does not match number of axes passed via axis_ids"
++            raise Exception("latitude's rank does not match number of axes passed via axis_ids")
+ 
+         type = latitude.dtype.char
+         nvert = 0
+         if not type in ['d','f','i','l']:
+-            raise Exception, "latitude array must be of type 'd','f','l' or 'i'"
++            raise Exception("latitude array must be of type 'd','f','l' or 'i'")
+ 
+         longitude = _to_numpy(longitude, 'longitude')
+ 
+         if numpy.rank(longitude)!=len(axis_ids):
+-            raise Exception, "longitude's rank does not match number of axes passed via axis_ids"
++            raise Exception("longitude's rank does not match number of axes passed via axis_ids")
+         
+-    ##     print 'longitude type:',longitude.dtype.char
++    ##     print('longitude type:',longitude.dtype.char)
+         if longitude.dtype.char!=type:
+             longitude = longitude.astype(type)
+     elif longitude is not None:
+-        raise Exception, "latitude and longitude must be BOTH an array or None"
++        raise Exception("latitude and longitude must be BOTH an array or None")
+     else:
+         type='f'
+         if nvertices is None :
+@@ -129,19 +129,19 @@
+         latitude_vertices = _to_numpy(latitude_vertices, 'latitude_vertices')
+ 
+         if numpy.rank(latitude_vertices)!=len(axis_ids)+1:
+-            raise Exception, "latitude_vertices's rank does not match number of axes passed via axis_ids +1 (for vertices)"
+-##         print 'latitude_vert type:',latitude_vertices.dtype.char
++            raise Exception("latitude_vertices's rank does not match number of axes passed via axis_ids +1 (for vertices)")
++##         print('latitude_vert type:',latitude_vertices.dtype.char)
+         if latitude_vertices.dtype.char!=type:
+             latitude_vertices = latitude_vertices.astype(type)
+         nvert = latitude_vertices.shape[-1]
+         if nvertices is not None:
+             if nvert!=nvertices:
+-                raise Exception,"you passed nvertices as: %i, but from your latitude_vertices it seems to be: %i" % (nvertices,nvert)
++                raise Exception("you passed nvertices as: %i, but from your latitude_vertices it seems to be: %i" % (nvertices,nvert))
+         
+     if longitude_vertices is not None:
+         longitude_vertices = _to_numpy(longitude_vertices, 'longitude_vertices')
+         if numpy.rank(longitude_vertices)!=len(axis_ids)+1:
+-            raise Exception, "longitude_vertices's rank does not match number of axes passed via axis_ids +1 (for vertices)"
++            raise Exception("longitude_vertices's rank does not match number of axes passed via axis_ids +1 (for vertices)")
+ ##         print 'longitude_vert type:',longitude_vertices.dtype.char
+         if longitude_vertices.dtype.char!=type:
+             longitude_vertices = longitude_vertices.astype(type)
+@@ -149,10 +149,10 @@
+         if latitude_vertices is None:
+             nvert = nvert2
+         elif nvert!=nvert2:
+-            raise Exception, "error in shape longitude_vertices and latitude_vertices seem to have different # of vertices: %i vs %i, %s" % (nvert,nvert2, str(longitude_vertices.shape ))
++            raise Exception("error in shape longitude_vertices and latitude_vertices seem to have different # of vertices: %i vs %i, %s" % (nvert,nvert2, str(longitude_vertices.shape )))
+         if nvertices is not None:
+             if nvert!=nvertices:
+-                raise Exception,"you passed nvertices as: %i, but from your longitude_vertices it seems to be: %i" % (nvertices,nvert)
++                raise Exception("you passed nvertices as: %i, but from your longitude_vertices it seems to be: %i" % (nvertices,nvert))
+ 
+         
+ ##     if area is not None:
+@@ -160,9 +160,9 @@
+ ##             try:
+ ##                 area = numpy.ascontiguousarray(area.filled())
+ ##             except:
+-##                 raise Exception, "Error could not convert area to a numpy array"
++##                 raise Exception("Error could not convert area to a numpy array")
+ ##             if numpy.rank(area)!=len(axis_ids):
+-##                 raise Exception, "area's rank does not match number of axes passed via axis_ids"
++##                 raise Exception("area's rank does not match number of axes passed via axis_ids")
+ ##         if area.dtype.char!=type:
+ ##             area = area.astype(type)
+     n = len(axis_ids)
+@@ -182,9 +182,9 @@
+        parameter_units  :: array/list of parameter units  in the same order of parameter_names (ignored if parameter_names is ditcionary)
+     """
+     if not isinstance(grid_id,(numpy.int32,int,long)):
+-        raise Exception, "grid_id must be an integer: %s"%type(grid_id)
++        raise Exception("grid_id must be an integer: %s"%type(grid_id))
+     if not isinstance(mapping_name,str):
+-        raise Exception, "mapping name must be a string"
++        raise Exception("mapping name must be a string")
+ 
+     if isinstance(parameter_names,dict):
+         pnams = []
+@@ -196,12 +196,12 @@
+             if isinstance(val,dict):
+                 ks = val.keys()
+                 if not 'value' in ks or not 'units' in ks:
+-                    raise Exception, "error parameter_names key '%s' dictionary does not contain both 'units' and 'value' keys" % k
++                    raise Exception("error parameter_names key '%s' dictionary does not contain both 'units' and 'value' keys" % k)
+                 pvals.append(val['value'])
+                 punit.append(val['units'])
+             elif isinstance(val,(list,tuple)):
+                 if len(val)>2:
+-                    raise Exception, "parameter_names '%s' as more than 2 values" % k
++                    raise Exception("parameter_names '%s' as more than 2 values" % k)
+                 for v in val:
+                     if isinstance(v,str):
+                         punit.append(v)
+@@ -210,20 +210,20 @@
+                     except:
+                         pass
+                 if len(pvals)!=len(punits) or len(pvals)!=len(pnams):
+-                    raise Exception, "could not figure out values for parameter_name: '%s' " % k
++                    raise Exception("could not figure out values for parameter_name: '%s' " % k)
+             else:
+-                raise Exception, "could not figure out values for parameter_name: '%s' " % k
++                raise Exception("could not figure out values for parameter_name: '%s' " % k)
+     elif isinstance(parameter_names,(list,tuple)):
+         pnms = list(parameter_names)
+         # now do code for parameter_units
+         if parameter_values is None:
+-            raise Exception, "you must pass a list or array for parameter_values"
++            raise Exception("you must pass a list or array for parameter_values")
+         if parameter_units is None:
+-            raise Exception, "you must pass a list for parameter_units"
++            raise Exception("you must pass a list for parameter_units")
+         if not isinstance(parameter_units,(list,tuple)):
+-            raise Exception, "you must pass a list for parameter_units"
++            raise Exception("you must pass a list for parameter_units")
+         if len(parameter_units)!=len(pnms):
+-            raise Exception, "length of parameter_units list does not match length of parameter_names"
++            raise Exception("length of parameter_units list does not match length of parameter_names")
+         punit = list(parameter_units)
+         if isinstance(parameter_values,(list,tuple)):
+             pvals = list(parameter_values)
+@@ -231,11 +231,11 @@
+             try:
+                 pvals = numpy.ascontiguousarray(parameter_values.filled())
+             except:
+-                raise Exception, "Error could not convert parameter_values to a numpy array"
++                raise Exception("Error could not convert parameter_values to a numpy array")
+         if len(pvals) != len(parameter_names):
+-            raise Exception, "length of parameter_values list does not match length of parameter_names"
++            raise Exception("length of parameter_values list does not match length of parameter_names")
+     else:
+-        raise Exception, "parameter_names must be either dictionary or list"
++        raise Exception("parameter_names must be either dictionary or list")
+ 
+     pvals = numpy.ascontiguousarray(pvals).astype('d')
+     return _cmor.set_grid_mapping(grid_id,mapping_name,pnms,pvals,punit)
+@@ -255,11 +255,11 @@
+     interval: a string used for time axes only (???)
+     """
+     if not isinstance(table_entry,str):
+-        raise Exception, "You need to pass a table_entry to match in the cmor table"
++        raise Exception("You need to pass a table_entry to match in the cmor table")
+ 
+     if coord_vals is None:
+         if cell_bounds is not None:
+-            raise Exception, "you passed cell_bounds but no coords"
++            raise Exception("you passed cell_bounds but no coords")
+     else:
+         if has_cdms2 and isinstance(coord_vals,cdms2.axis.TransientAxis):
+             if units is None:
+@@ -286,10 +286,10 @@
+             coord_vals = numpy.ascontiguousarray(coord_vals.filled())
+ 
+         if not isinstance(coord_vals,numpy.ndarray):
+-            raise Exception, "Error coord_vals must be an array or cdms2 axis or list/tuple"
++            raise Exception("Error coord_vals must be an array or cdms2 axis or list/tuple")
+ 
+         if numpy.rank(coord_vals)>1:
+-            raise Exception, "Error, you must pass a 1D array!"
++            raise Exception("Error, you must pass a 1D array!")
+ 
+     if numpy.ma.isMA(cell_bounds):
+         cell_bounds = numpy.ascontiguousarray(cell_bounds.filled())
+@@ -304,18 +304,18 @@
+         
+     if cell_bounds is not None:
+         if numpy.rank(cell_bounds)>2:
+-            raise Exception, "Error cell_bounds rank must be at most 2"
++            raise Exception("Error cell_bounds rank must be at most 2")
+         if numpy.rank(cell_bounds)==2:
+             if cell_bounds.shape[0]!=coord_vals.shape[0]:
+-                raise Exception, "Error, coord_vals and cell_bounds do not have the same length"
++                raise Exception("Error, coord_vals and cell_bounds do not have the same length")
+             if cell_bounds.shape[1]!=2:
+-                raise Exception, "Error, cell_bounds' second dimension must be of length 2"
++                raise Exception("Error, cell_bounds' second dimension must be of length 2")
+             cbnds = 2
+             cell_bounds = numpy.ascontiguousarray(numpy.ravel(cell_bounds))
+         else:
+             cbnds = 1
+             if len(cell_bounds)!=len(coord_vals)+1:
+-                raise Exception, "error cell_bounds are %i long and axes coord_vals are %i long this is not consistent" % (len(cell_bounds),len(coord_vals))
++                raise Exception("error cell_bounds are %i long and axes coord_vals are %i long this is not consistent" % (len(cell_bounds),len(coord_vals)))
+     else:
+         cbnds = 0
+ 
+@@ -324,7 +324,7 @@
+         type = coord_vals.dtype.char[0]
+ 
+         if not type in ['i','l','f','d','S']:
+-            raise Exception, "error allowed data type are: i,l,f,d or S"
++            raise Exception("error allowed data type are: i,l,f,d or S")
+ 
+         if type == 'S':
+             type = 'c'
+@@ -344,7 +344,7 @@
+             
+     if units is None:
+         if coord_vals is not None:
+-            raise Exception, "Error you need to provide the units your coord_vals are in"
++            raise Exception("Error you need to provide the units your coord_vals are in")
+         else:
+             units = "1"
+     
+@@ -359,26 +359,26 @@
+ def variable(table_entry,units,axis_ids,type='f',missing_value=None,tolerance = 1.e-4,positive=None,original_name=None,history=None,comment=None):
+     
+     if not isinstance(table_entry,str):
+-        raise Exception, "Error you must pass a string for the variable table_entry"
++        raise Exception("Error you must pass a string for the variable table_entry")
+     
+     if not isinstance(units,str):
+-        raise Exception, "Error you must pass a string for the variable units"
++        raise Exception("Error you must pass a string for the variable units")
+ 
+     if original_name is not None:
+         if not isinstance(original_name,str):
+-            raise Exception, "Error you must pass a string for the variable original_name"
++            raise Exception("Error you must pass a string for the variable original_name")
+     else:
+         original_name = ""
+         
+     if history is not None:
+         if not isinstance(history,str):
+-            raise Exception, "Error you must pass a string for the variable history"
++            raise Exception("Error you must pass a string for the variable history")
+     else:
+         history = ""
+         
+     if comment is not None:
+         if not isinstance(comment,str):
+-            raise Exception, "Error you must pass a string for the variable comment"
++            raise Exception("Error you must pass a string for the variable comment")
+     else:
+         comment = ""
+         
+@@ -391,18 +391,18 @@
+     elif isinstance(axis_ids,(list,tuple)):
+         axis_ids = numpy.ascontiguousarray(axis_ids)
+     elif not isinstance(axis_ids, numpy.ndarray):
+-        raise Exception, "Error could not convert axis_ids list to a numpy array"
++        raise Exception("Error could not convert axis_ids list to a numpy array")
+ 
+     if numpy.rank(axis_ids)>1:
+-        raise Exception, "error axis_ids list/array must be 1D"
++        raise Exception("error axis_ids list/array must be 1D")
+ 
+     if not isinstance(type,str):
+-        raise Exception, "error tpye must a a string"
++        raise Exception("error tpye must a a string")
+     type = type.lower()
+     if type == 's':
+         type ='c'
+     if not type in ["c","d","f","l","i"]:
+-        raise Exception, 'error unknown type: "%s", must be one of: "c","d","f","l","i"'
++        raise Exception('error unknown type: "%s", must be one of: "c","d","f","l","i"')
+ 
+     ndims = len(axis_ids)
+ 
+@@ -422,13 +422,13 @@
+         comment = str(comment)
+ 
+     if not isinstance(tolerance,(float,int,numpy.float,numpy.float32,numpy.int,numpy.int32)):
+-        raise Exception, "error tolerance must be a number"
++        raise Exception("error tolerance must be a number")
+ 
+     tolerance = float(tolerance)
+ 
+     if missing_value is not None:
+         if not isinstance(missing_value,(float,int,numpy.float,numpy.float32,numpy.int,numpy.int32)):
+-            raise Exception, "error missing_value must be a number, you passed: %s" % repr(missing_value)
++            raise Exception("error missing_value must be a number, you passed: %s" % repr(missing_value))
+ 
+         missing_value = float(missing_value)
+ 
+@@ -438,14 +438,14 @@
+ def zfactor(zaxis_id,zfactor_name,units="",axis_ids=None,type=None,zfactor_values=None,zfactor_bounds=None):
+ 
+     if not isinstance(zaxis_id,(int,numpy.int,numpy.int32)):
+-        raise Exception, "error zaxis_id must be a number"
++        raise Exception("error zaxis_id must be a number")
+     zaxis_id = int(zaxis_id)
+ 
+     if not isinstance(zfactor_name,str):
+-        raise Exception, "Error you must pass a string for the variable zfactor_name"
++        raise Exception("Error you must pass a string for the variable zfactor_name")
+     
+     if not isinstance(units,str):
+-        raise Exception, "Error you must pass a string for the variable units"
++        raise Exception("Error you must pass a string for the variable units")
+ 
+     if numpy.ma.isMA(axis_ids):
+         axis_ids = numpy.ascontiguousarray(axis_ids.filled())
+@@ -462,10 +462,10 @@
+     elif isinstance(axis_ids,(int,numpy.int,numpy.int32)):
+         axis_ids = numpy.array([axis_ids,])
+     elif not isinstance(axis_ids, numpy.ndarray):
+-        raise Exception, "Error could not convert axis_ids list to a numpy array"
++        raise Exception("Error could not convert axis_ids list to a numpy array")
+ 
+     if numpy.rank(axis_ids)>1:
+-        raise Exception, "error axis_ids list/array must be 1D"
++        raise Exception("error axis_ids list/array must be 1D")
+ 
+     if axis_ids is None:
+         ndims = 0
+@@ -474,9 +474,9 @@
+         ndims = len(axis_ids)
+ 
+ ##     if ndims>1 and zfactor_values is not None:
+-##         raise Exception, "Error you can only pass zfactor_values for zfactor with rank <=1"
++##         raise Exception("Error you can only pass zfactor_values for zfactor with rank <=1")
+ ##     if ndims>1 and zfactor_bounds is not None:
+-##         raise Exception, "Error you can only pass zfactor_bounds for zfactor with rank <=1"
++##         raise Exception("Error you can only pass zfactor_bounds for zfactor with rank <=1")
+ 
+     if zfactor_values is not None:
+         if isinstance(zfactor_values,(float,int,numpy.float,numpy.float32,numpy.int,numpy.int32)):
+@@ -490,7 +490,7 @@
+         elif isinstance(zfactor_values,(list,tuple)):
+             zfactor_values = numpy.ascontiguousarray(zfactor_values)
+         elif not isinstance(zfactor_values, numpy.ndarray):
+-            raise Exception, "Error could not convert zfactor_values to a numpy array"
++            raise Exception("Error could not convert zfactor_values to a numpy array")
+ 
+         if type is None:
+             try:
+@@ -501,18 +501,18 @@
+                 elif isinstance(zfactor_values,(int,numpy.int,numpy.int32)):
+                     type = 'd'
+                 else:
+-                    raise Exception, "Error unknown type for zfactor_values: %s" % repr(zfactor_values)
++                    raise Exception("Error unknown type for zfactor_values: %s" % repr(zfactor_values))
+     elif type is None:
+         type='d'
+         
+         
+     if not isinstance(type,str):
+-        raise Exception, "error tpye must a a string"
++        raise Exception("error tpye must a a string")
+     type = type.lower()
+     if type == 's':
+         type ='c'
+     if not type in ["c","d","f","l","i"]:
+-        raise Exception, 'error unknown type: "%s", must be one of: "c","d","f","l","i"'
++        raise Exception('error unknown type: "%s", must be one of: "c","d","f","l","i"')
+     
+     if zfactor_bounds is not None:
+         if numpy.ma.isMA(zfactor_bounds):
+@@ -524,19 +524,19 @@
+         elif isinstance(zfactor_bounds,(list,tuple)):
+             zfactor_bounds = numpy.ascontiguousarray(zfactor_bounds)
+         elif not isinstance(zfactor_bounds, numpy.ndarray):
+-            raise Exception, "Error could not convert zfactor_bounds to a numpy array"
++            raise Exception("Error could not convert zfactor_bounds to a numpy array")
+         if numpy.rank(zfactor_bounds)>2:
+-            raise Exception, "error zfactor_bounds must be rank 2 at most"
++            raise Exception("error zfactor_bounds must be rank 2 at most")
+         elif numpy.rank(zfactor_bounds)==2:
+             if zfactor_bounds.shape[1]!=2:
+-                raise Exception, "error zfactor_bounds' 2nd dimension must be of length 2"
++                raise Exception("error zfactor_bounds' 2nd dimension must be of length 2")
+             bnds =[]
+             b = zfactor_bounds[0]
+             for i in range(zfactor_bounds.shape[0]):
+                 b = zfactor_bounds[i]
+                 bnds.append(b[0])
+                 if (i<zfactor_bounds.shape[0]-1) and (b[1]!=zfactor_bounds[i+1][0]):
+-                    raise Exception, "error zfactor_bounds have gaps between them"
++                    raise Exception("error zfactor_bounds have gaps between them")
+             bnds.append(zfactor_bounds[-1][1])
+             zfactor_bounds=numpy.array(bnds)
+     axis_ids = axis_ids.astype('i')
+@@ -551,15 +551,15 @@
+     ierr = write(var_id,data,ntimes_passed=None,file_suffix="",time_vals=None,time_bnds=None,store_with=None
+     """
+     if not isinstance(var_id,(int,numpy.int,numpy.int32)):
+-        raise Exception, "error var_id must be an integer"
++        raise Exception("error var_id must be an integer")
+     var_id = int(var_id)
+ 
+     if not isinstance(file_suffix,str):
+-        raise Exception,  "Error file_suffix must be a string"
++        raise Exception("Error file_suffix must be a string")
+ 
+     if store_with is not None:
+         if not isinstance(store_with,(int,numpy.int,numpy.int32)):
+-            raise Exception, "error store_with must be an integer"
++            raise Exception("error store_with must be an integer")
+         store_with = int(store_with)
+ 
+     if numpy.ma.isMA(data):
+@@ -573,7 +573,7 @@
+     elif isinstance(data,(list,tuple)):
+         data = numpy.ascontiguousarray(data)
+     elif not isinstance(data, numpy.ndarray):
+-            raise Exception, "Error could not convert data to a numpy array"
++            raise Exception("Error could not convert data to a numpy array")
+ 
+ 
+     if time_vals is None:
+@@ -594,12 +594,12 @@
+         try:
+             time_vals = numpy.ascontiguousarray(time_vals)
+         except:
+-            raise Exception, "Error could not convert time_vals to a numpy array"
++            raise Exception("Error could not convert time_vals to a numpy array")
+ 
+     if time_vals is not None:
+         type = time_vals.dtype.char
+         if not type in ['f','d','i','l']:
+-            raise Exception, "Error time_vals type must one of: 'f','d','i','l', please convert first"
++            raise Exception("Error time_vals type must one of: 'f','d','i','l', please convert first")
+         time_vals=time_vals.astype("d")
+        
+ 
+@@ -609,7 +609,7 @@
+         else:
+             ntimes_passed = len(time_vals)
+     if not isinstance(ntimes_passed,(int,numpy.int,numpy.int32)):
+-        raise Exception, "error ntimes_passed must be an integer"
++        raise Exception("error ntimes_passed must be an integer")
+     ntimes_passed = int(ntimes_passed)
+ 
+ 
+@@ -627,7 +627,7 @@
+         if goodshape[i]!=0:
+             if sh[j]!=goodshape[i]:
+                 if goodshape[i]!=1:
+-                    raise Exception,"error your data shape (%s) does not match the expect variable shape (%s)" % (str(osh),str(ogoodshape))
++                    raise Exception("error your data shape (%s) does not match the expect variable shape (%s)" % (str(osh),str(ogoodshape)))
+             j+=1
+         elif ntimes_passed!=1:
+             j+=1
+@@ -649,13 +649,13 @@
+         elif isinstance(time_bnds,(list,tuple)):
+             time_bnds = numpy.ascontiguousarray(time_bnds)
+         elif not isinstance(time_bnds, numpy.ndarray):
+-            raise Exception, "Error could not convert time_bnds to a numpy array"
++            raise Exception("Error could not convert time_bnds to a numpy array")
+ 
+         if numpy.rank(time_bnds)>2:
+-            raise Exception, "bounds rank cannot be greater than 2"
++            raise Exception("bounds rank cannot be greater than 2")
+         elif numpy.rank(time_bnds)==2:
+             if time_bnds.shape[1]!=2:
+-                raise Exception, "error time_bnds' 2nd dimension must be of length 2"
++                raise Exception("error time_bnds' 2nd dimension must be of length 2")
+             bnds =[]
+             if time_bnds.shape[0] > 1:
+                 _check_time_bounds_contiguous(time_bnds)
+@@ -669,7 +669,7 @@
+             else:
+                 ltv=len(time_vals)
+             if len(time_bnds)!=ltv+1:
+-                raise Exception,"error time_bnds if 1D must be 1 elt greater than time_vals, you have %i vs %i" % (len(time_bnds),ltv)
++                raise Exception("error time_bnds if 1D must be 1 elt greater than time_vals, you have %i vs %i" % (len(time_bnds),ltv))
+             bnds=[]
+             for i in range(ltv):
+                 bnds.append([time_bnds[i],time_bnds[i+1]])
+@@ -680,12 +680,12 @@
+     if time_bnds is not None:
+         type = time_bnds.dtype.char
+         if not type in ['f','d','i','l']:
+-            raise Exception, "Error time_bnds type must one of: 'f','d','i','l', please convert first"
++            raise Exception("Error time_bnds type must one of: 'f','d','i','l', please convert first")
+         time_bnds=time_bnds.astype("d")
+ 
+     type = data.dtype.char
+     if not type in ['f','d','i','l']:
+-        raise Exception, "Error data type must one of: 'f','d','i','l', please convert first"
++        raise Exception("Error data type must one of: 'f','d','i','l', please convert first")
+ 
+     return _cmor.write(var_id,data,type,file_suffix,ntimes_passed,time_vals,time_bnds,store_with)
+ 
+@@ -696,7 +696,7 @@
+     for i in range(time_bnds.shape[0] - 1 ):
+         b = time_bnds[i]
+         if b[1]!=time_bnds[i+1][0]:
+-            raise Exception, "error time_bnds have gaps between them"
++            raise Exception("error time_bnds have gaps between them")
+ 
+ def _flatten_time_bounds(time_bnds):
+     '''
+@@ -721,21 +721,21 @@
+     create_subdirectories: 1 to create subdirectories structure, 0 to dump files directly where cmor_dataset tells to
+ """
+     if not isinstance(exit_control,int) or not exit_control in [ cmor_const.CMOR_EXIT_ON_WARNING, cmor_const.CMOR_EXIT_ON_MAJOR, cmor_const.CMOR_NORMAL]:
+-        raise Exception, "exit_control must an integer valid values are: CMOR_EXIT_ON_WARNING, CMOR_EXIT_ON_MAJOR, CMOR_NORMAL"
++        raise Exception("exit_control must an integer valid values are: CMOR_EXIT_ON_WARNING, CMOR_EXIT_ON_MAJOR, CMOR_NORMAL")
+ 
+     if not isinstance(netcdf_file_action,int) or not netcdf_file_action in [ cmor_const.CMOR_PRESERVE, cmor_const.CMOR_APPEND, cmor_const.CMOR_REPLACE, cmor_const.CMOR_PRESERVE_3, cmor_const.CMOR_APPEND_3, cmor_const.CMOR_REPLACE_3,cmor_const.CMOR_PRESERVE_4, cmor_const.CMOR_APPEND_4, cmor_const.CMOR_REPLACE_4 ]:
+-        raise Exception, "netcdf_file_action must be an integer. Valid values are: CMOR_PRESERVE, CMOR_APPEND, CMOR_REPLACE, CMOR_PRESERVE_3, CMOR_APPEND_3 or CMOR_REPLACE_3, CMOR_PRESERVE_4, CMOR_APPEND_4 or CMOR_REPLACE_4"
++        raise Exception("netcdf_file_action must be an integer. Valid values are: CMOR_PRESERVE, CMOR_APPEND, CMOR_REPLACE, CMOR_PRESERVE_3, CMOR_APPEND_3 or CMOR_REPLACE_3, CMOR_PRESERVE_4, CMOR_APPEND_4 or CMOR_REPLACE_4")
+ 
+     if not isinstance(set_verbosity,int) or not set_verbosity in [ cmor_const.CMOR_QUIET, cmor_const.CMOR_NORMAL]:
+-        raise Exception, "set_verbosity must an integer valid values are: CMOR_QUIET, CMOR_NORMAL"
++        raise Exception("set_verbosity must an integer valid values are: CMOR_QUIET, CMOR_NORMAL")
+ 
+     if not isinstance(inpath,str) and not os.path.exists(inpath):
+-        raise Exception, "path must be a Valid path"
++        raise Exception("path must be a Valid path")
+     if logfile is None:
+         logfile = ""
+ 
+     if not create_subdirectories in [0,1]:
+-        raise Exception, "create_subdirectories must be 0 or 1"
++        raise Exception("create_subdirectories must be 0 or 1")
+     return _cmor.setup(inpath,netcdf_file_action,set_verbosity,exit_control,logfile,create_subdirectories)
+ 
+ def load_table(table):
+@@ -744,7 +744,7 @@
+     load_table(table)
+     """
+     if not isinstance(table,str):
+-        raise Exception, "Error, must pass a string"
++        raise Exception("Error, must pass a string")
+ ##     if not os.path.exists(table):
+ ##         raise Exception, "Error, the table you specified (%s) does not exists" % table
+     return _cmor.load_table(table)
+@@ -782,7 +782,7 @@
+         if not isinstance(st,str):
+             for o in dir():
+                 if locals()[o] is st:
+-                    raise Exception, "Error argument %s must be a string" % o
++                    raise Exception("Error argument %s must be a string" % o)
+ 
+     calendar = calendar.lower()
+     
+@@ -790,7 +790,7 @@
+         if not isinstance(i,int):
+             for o in dir():
+                 if locals()[o] is i:
+-                    raise Exception, "Error argument %s must be an integer" % o
++                    raise Exception("Error argument %s must be an integer" % o)
+     if isinstance(month_lengths,(list,tuple)):
+         month_lengths = numpy.array(month_lengths)
+     elif has_cdms2 and cdms2.isVariable(month_lengths):
+@@ -802,26 +802,26 @@
+         
+     if isinstance(month_lengths,numpy.ndarray):
+         if not numpy.rank(month_lengths)==1:
+-            raise Exception, "Error month_lengths must be 1D"
++            raise Exception("Error month_lengths must be 1D")
+         if len(month_lengths)!=12:
+-            raise Exception, "Error month_lengths must have 12 elements exactly"
++            raise Exception("Error month_lengths must have 12 elements exactly")
+         months_lengths = numpy.ascontiguousarray(month_lengths)
+     elif month_lengths is not None:
+-        raise Exception, "Error month_lengths must be a 12 elts array or list"
++        raise Exception("Error month_lengths must be a 12 elts array or list")
+     if initialization_method is not None:
+         if not isinstance(initialization_method,int):
+-            raise Exception, "initialization_method must be an int"
++            raise Exception("initialization_method must be an int")
+     else:
+         initialization_method=0
+     if physics_version is not None:
+         if not isinstance(physics_version,int):
+-            raise Exception, "physics_version must be an int"
++            raise Exception("physics_version must be an int")
+     else:
+         physics_version=0
+ 
+     if branch_time is not None:
+         if not isinstance(branch_time,(float,int,numpy.float,numpy.float32,numpy.int,numpy.int32)):
+-            raise Exception,"branch_time must be a float"
++            raise Exception("branch_time must be a float")
+         else:
+             branch_time=float(branch_time)
+ 
+@@ -829,7 +829,7 @@
+ 
+ def set_table(table):
+     if not isinstance(table,int):
+-        raise Exception, "error you need to pass and integer as the table id"
++        raise Exception("error you need to pass and integer as the table id")
+     return _cmor.set_table(table)
+ 
+ def close(var_id=None,file_name=False, preserve=False):
+@@ -842,7 +842,7 @@
+       [preserve] True/False (default False) if True: close the file but preserve the var definition in CMOR to write more data with this variable (into a new file)
+       """
+     if var_id is not None and not isinstance(var_id,int):
+-        raise Exception, "Error var_id must be None or a integer"
++        raise Exception("Error var_id must be None or a integer")
+ 
+     if (preserve is False):
+         if (file_name is False):
+Index: cmor-2.8.3/Lib/__init__.py
+===================================================================
+--- cmor-2.8.3.orig/Lib/__init__.py	2013-06-10 22:15:22.000000000 +0100
++++ cmor-2.8.3/Lib/__init__.py	2013-06-12 09:28:51.000000000 +0100
+@@ -1,9 +1,11 @@
+ from cmor_const import *
+ 
++from __future__ import print_function
++
+ from pywrapper import axis,variable,write,setup,load_table,dataset,set_table,zfactor,close,grid,set_grid_mapping,time_varying_grid_coordinate,set_cur_dataset_attribute,get_cur_dataset_attribute,has_cur_dataset_attribute,create_output_path,set_variable_attribute,get_variable_attribute,has_variable_attribute
+ 
+ try:
+   from check_CMOR_compliant import checkCMOR
+ except Exception,err:
+-  print err
++  print(err)
+   pass
+Index: cmor-2.8.3/Lib/check_CMOR_compliant.py
+===================================================================
+--- cmor-2.8.3.orig/Lib/check_CMOR_compliant.py	2013-06-10 22:15:22.000000000 +0100
++++ cmor-2.8.3/Lib/check_CMOR_compliant.py	2013-06-12 09:33:54.000000000 +0100
+@@ -8,6 +8,8 @@
+ import time
+ VERBOSE=-999
+ 
++from __future__ import print_function
++
+ #ok now we are going online to pull the file that has the control md5s
+ try:
+     f=open("Tables/md5s")
+@@ -53,11 +55,11 @@
+         color=34
+     else:
+         return
+-    print >> fout, "%c[%d;%d;%dm" % (0X1B,2,color,47)
++    print("%c[%d;%d;%dm" % (0X1B,2,color,47),file=fout)
+     return
+ 
+ def delcoloring(fout):
+-    print >> fout,"%c[%dm" % (0X1B,0)
++    print("%c[%dm" % (0X1B,0), file=fout)
+     return
+     
+ def manageLog(fout,error,*msg_bits):
+@@ -67,35 +69,35 @@
+         msg+=" "+str(m)
+     msg=msg.lstrip()
+         
+-##     print >>fout, 'No error is:',noerror
++##     print( 'No error is:',noerror,file=fout)
+     if error == cmor.CMOR_CRITICAL:
+         raise CMORError,[msg,]
+     elif error == VERBOSE:
+         fout.write( msg)
+         if msg_bits[-1]!="":
+-            print >> fout
++            print(file=fout)
+         return
+         
+     addcoloring(fout,error)
+-    print >>fout, '@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%'
+-    print >>fout, '@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%'
++    print('@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%',file=fout)
++    print('@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%',file=fout)
+     if error == cmor.CMOR_NORMAL:
+-        print >>fout, '@#%@#%@#%@#%@#%           ERROR          %@#%@#%@#%@#%@#%@#%@#%'
++        print('@#%@#%@#%@#%@#%           ERROR          %@#%@#%@#%@#%@#%@#%@#%',file=fout)
+     elif error == cmor.CMOR_WARNING:
+-        print >>fout, '@#%@#%@#%@#%@#%          WARNING         %@#%@#%@#%@#%@#%@#%@#%'
+-    print >>fout, '@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%'
+-    print >>fout, '@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%'
++        print('@#%@#%@#%@#%@#%          WARNING         %@#%@#%@#%@#%@#%@#%@#%',file=fout)
++    print('@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%',file=fout)
++    print('@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%',file=fout)
+     delcoloring(fout)
+-    print >>fout
++    print(file=fout)
+     addcoloring(fout,error)
+-    print >>fout, msg
++    print(msg,file=fout)
+     delcoloring(fout)
+-    print >>fout
++    print(file=fout)
+     addcoloring(fout,error)
+-    print >>fout, '@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%'
+-    print >>fout, '@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%'
++    print('@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%',file=fout)
++    print('@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%@#%',file=fout)
+     delcoloring(fout)
+-    print >>fout
++    print(file=fout)
+     return 1
+ 
+ def split_expt_ids(val):
+@@ -160,7 +162,7 @@
+             e[entry_type]={}
+         e[entry_type][entry]=e[entry_type].get(entry,{})
+             
+-##         print >>fout, e[entry_type][entry]
++##         print(e[entry_type][entry],file=fout)
+         cont=1
+         while cont:
+             l = ln.pop(0)[:-1]
+@@ -176,26 +178,26 @@
+             sp=l.split(':')
+             kw=sp[0].strip()
+             val=":".join(sp[1:]).split('!')[0].strip()
+-            ## print  'dic is:',e[entry_type][entry]
++            ## print('dic is:',e[entry_type][entry])
+             if e[entry_type][entry].has_key(kw):
+                 if kw in lists_kw:
+                     e[entry_type][entry][kw]="".join(e[entry_type][entry][kw])
+                 e[entry_type][entry][kw]+=' '+val
+             else:
+                 e[entry_type][entry][kw]=val
+-##             print >>fout, 'After:',e[entry_type][entry][kw]
++##             print('After:',e[entry_type][entry][kw],file=fout)
+             if kw in lists_kw:
+-##                 print >>fout, 'splitting:',kw,e[entry_type][entry][kw].split()
++##                 print('splitting:',kw,e[entry_type][entry][kw].split(),file=fout)
+                 e[entry_type][entry][kw]=e[entry_type][entry][kw].split()
+             if len(ln)==0:
+                 cont=0
+     e['general']=gen_attributes
+ ##     for type in e.keys():
+-##         print >>fout, 'Type:',type
++##         print('Type:',type,file=fout)
+ ##         for k in e[type].keys():
+-##             print >>fout, '\t Entry:',k
++##             print('\t Entry:',k,file=fout)
+ ##             for a in e[type][k].keys():
+-##                 print >>fout, '\t\t',a,':',e[type][k][a]
++##                 print('\t\t',a,':',e[type][k][a],file=fout)
+     return e
+ 
+ 
+@@ -264,7 +266,7 @@
+         manageLog(fout,VERBOSE, 'Checking file argument',IPCC_std_axes)
+         manageLog(fout,VERBOSE, 'Checking path structure for path:',pthroot)
+         manageLog(fout,VERBOSE, 'Checking file structure for file:',fnm)
+-        print >> fout, 'Checking the file starts with variable name'
++        print('Checking the file starts with variable name',file=fout)
+         ok = False
+         for v in IPCC_std_vars:
+             n = len(v)
+@@ -538,7 +540,7 @@
+             else:
+                 spoffset=0
+                 
+-            print len(sp)
++            print(len(sp))
+             if len(sp)<n:
+                 nerr+=manageLog(fout, noerror, 'your file name does not seem to match the profile: varid_tableid_modelid_exptid_rid[iid][pid][_startdate-enddate][_suffix][_clim].nc')
+                 
+@@ -970,7 +972,7 @@
+                 gnm=nm
+                 manageLog(fout,VERBOSE, '\tChecking special case %s, i.e' % (nm),'')
+                 tmpax=V.getLevel()
+-                print>>fout,  tmpax.id,tmpax.standard_name
++                print(tmpax.id,tmpax.standard_name,file=fout)
+                 for x in Axes.keys():
+                     tmp=Axes[x].get('standard_name',None)
+                     if tmp is not None: tmp=tmp.strip()
+@@ -1089,7 +1091,7 @@
+                 manageLog(fout,VERBOSE, r,'')
+                 val=getattr(ax,r,None)
+                 if val is None:
+-                    print >>fout
++                    print(file=fout)
+                     nerr+=manageLog(fout, noerror, 'attribute '+r+' is required for axis '+ax.id)
+                 if r!='units':
+                     good_val=Axes[nm].get(r,None)
+@@ -1097,8 +1099,8 @@
+                         if val!=good_val:
+                             nerr+=manageLog(fout, noerror, 'axis attribute '+r+' should be: '+str(good_val)+' but is:'+str(val))
+                 if r=='formula_terms':
+-                    print 'Formula:',Axes[anm]['formula'],val
+-            print >>fout
++                    print('Formula:',Axes[anm]['formula'],val,file=fout)
++            print(file=fout)
+             if not 'units' in Axes[nm].get('ignored',[]):
+                 if not 'units' in Axes[nm].get('optional',[]) or ('units' in Axes[nm].get('optional',[]) and hasattr(ax,'units')):
+                     if not ax.isTime():
+@@ -1200,7 +1202,7 @@
+                 manageLog(fout,VERBOSE, '\t\tChecking that the latitude are in degrees (not rads)')
+                 min,max=genutil.minmax(ax[:])
+                 if 0.<max-min<3.2:
+-                    print ax[:]
++                    print(ax[:])
+                     nerr+=manageLog(fout, noerror, 'latitude must be stored in degree span is:'+str(max-min)+' looks like rad')
+             elif ax.isTime() and len(ax[:])>1:
+                 manageLog(fout,VERBOSE, '\t\tChecking for axis attribute')
+@@ -1212,7 +1214,7 @@
+                 manageLog(fout,VERBOSE, '\t\tView calendar attribute: ','')
+                 c=getattr(ax,'calendar',None)
+                 if c is None:
+-                    print >>fout
++                    print(file=fout)
+                     nerr+=manageLog(fout, noerror, 'calendar attribute must be defined on time axis')
+                 else:
+                     manageLog(fout,VERBOSE, c)
+@@ -1345,7 +1347,7 @@
+                                 else:
+                                     c=ax.getCalendar()
+ 
+-##                                 print 'Used calendar:',c
++##                                 print('Used calendar:',c,file=fout)
+                                 beg=cdtime.reltime(b[0],ax.units).tocomp(c)
+                                 end=cdtime.reltime(b[1],ax.units).tocomp(c)
+                                 mid=cdtime.reltime(ax[ib],ax.units).tocomp(c)
+Index: cmor-2.8.3/Test/check_results.py
+===================================================================
+--- cmor-2.8.3.orig/Test/check_results.py	2013-06-10 22:15:22.000000000 +0100
++++ cmor-2.8.3/Test/check_results.py	2013-06-12 09:50:00.000000000 +0100
+@@ -2,6 +2,8 @@
+ from in_files import input_tables
+ import sys,os
+ 
++from __future__ import print_function
++
+ import cmor
+ 
+ test = sys.argv[1]
+@@ -10,7 +12,7 @@
+ if test[-4:].lower()=='.f90':
+     test=test[:-4]
+ 
+-print 'Checking results for:',test
++print('Checking results for:',test)
+ 
+ outfiles = out.get(test,[])
+ intables = input_tables.get(test,['IPCC_test_table_A',])
+@@ -22,12 +24,12 @@
+ 
+ nfiles = 0
+ 
+-print 'files:',outfiles
++print('files:',outfiles)
+ gotfiles=[]
+ missing=[]
+ for f in outfiles:
+     if f is None:
+-        print 'No checking'
++        prints('uNo checking')
+         sys.exit()
+     tables=[]
+     for t in intables:
+@@ -39,13 +41,13 @@
+     if os.path.exists(fnm):
+         nfiles+=1
+         gotfiles.append(fnm)
+-        print 'Checking output file:',f
++        print('Checking output file:',f)
+         cmor.checkCMOR(sys.stdout,fnm,tbl,other_tables=tables)
+-        print '----------------------- Success ------------------------------'
++        print('----------------------- Success ------------------------------')
+         os.remove(fnm)
+     else:
+         missing.append(fnm)
+ if nfiles == 0 and outfiles!=[]:
+-    raise CMORResultCheckError,["Error could not find any output file for test: Test/%s.f90" % (test),]
++    raise CMORResultCheckError(["Error could not find any output file for test: Test/%s.f90" % (test),])
+ elif nfiles!=len(outfiles):
+-    raise CMORResultCheckError,["Error checking output files for test: Test/%s.f90 we could only find %i files when %i were expected.\n\n Expected files: \n\t%s\n\nPresent files: \n\t%s\n\nMissing files: \n\t%s\n" % (test,nfiles,len(outfiles),repr(outfiles),repr(gotfiles),repr(missing)),]
++    raise CMORResultCheckError(["Error checking output files for test: Test/%s.f90 we could only find %i files when %i were expected.\n\n Expected files: \n\t%s\n\nPresent files: \n\t%s\n\nMissing files: \n\t%s\n" % (test,nfiles,len(outfiles),repr(outfiles),repr(gotfiles),repr(missing)),])
+Index: cmor-2.8.3/Test/cmor_speed_and_compression_01.py
+===================================================================
+--- cmor-2.8.3.orig/Test/cmor_speed_and_compression_01.py	2013-06-10 22:15:22.000000000 +0100
++++ cmor-2.8.3/Test/cmor_speed_and_compression_01.py	2013-06-12 10:12:42.000000000 +0100
+@@ -1,11 +1,13 @@
+ import cmor,numpy,sys,os
++
++from __future__ import print_function # Work with both python2 and python3
+ try:
+     import cdms2
+     cdms2.setNetcdfShuffleFlag(0)
+     cdms2.setNetcdfDeflateFlag(0)
+     cdms2.setNetcdfDeflateLevelFlag(0)
+ except:
+-    print "This test code needs a recent cdms2 interface for i/0"
++    print("This test code needs a recent cdms2 interface for i/0")
+     sys.exit()
+ 
+ if len(sys.argv)>1:
+@@ -52,7 +54,7 @@
+ 
+ tables=[]
+ tables.append(cmor.load_table("mytable"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+ 
+ 
+ ## read in data, just one slice
+@@ -98,11 +100,11 @@
+ mincdms=1000
+ c0=st
+ f=cdms2.open("Test/crap.nc","w")
+-#print 'Time:',i
+-print s.filled().shape
++#print('Time:',i)
++print(s.filled().shape)
+ cmor.write(myvars[0],s.filled(),ntimes_passed=ntimes)
+ c=time.time()
+-#print 'cmor write time:',c-c0
++#printi('cmor write time:',c-c0)
+ totcmor+=c-c0
+ if maxcmor<c-c0:
+     maxcmor=c-c0
+@@ -111,7 +113,7 @@
+ c0=c
+ f.write(s,id=varout)
+ c=time.time()
+-#print 'cdms time:',c-c0
++#print('cdms time:',c-c0)
+ totcdms+=c-c0
+ if maxcdms<c-c0:
+     maxcdms=c-c0
+@@ -124,12 +126,12 @@
+ import cdtime,os
+ ltime = cdtime.reltime(ntimes-1,'month since 1980').tocomp()
+ lcmor = os.stat("Test/CMIP5/output/PCMDI/GICCM1/lgm/mon/atmos/tas/r1i1p1/tas_Amon_GICCM1_lgm_r1i1p1_198401-198412.nc")[6]
+-print 'level:',level,"shuffle:",shuffle
+-print 'total cmor:',totcmor,mincmor,totcmor/ntimes,maxcmor,lcmor
++print('level:',level,"shuffle:",shuffle)
++print('total cmor:',totcmor,mincmor,totcmor/ntimes,maxcmor,lcmor)
+ lcdms = os.stat("Test/crap.nc")[6]
+-print 'total cdms:',totcdms,mincdms,totcdms/ntimes,maxcdms,lcdms
+-print 'Size diff:',float(lcmor)/float(lcdms)
+-print 'speed diff:', totcmor/totcdms
++print('total cdms:',totcdms,mincdms,totcdms/ntimes,maxcdms,lcdms)
++print('Size diff:',float(lcmor)/float(lcdms))
++print('speed diff:', totcmor/totcdms)
+ 
+ if os.path.exists("summary.txt"):
+     f = open("summary.txt")
+@@ -144,7 +146,7 @@
+ for i in range(10):
+     a = dic.get((i,0),"N/A")
+     b = dic.get((i,1),"N/A")
+-    print 'Level: ',i,"no suffle:",a,"shuffle",b
++    print('Level: ',i,"no suffle:",a,"shuffle",b)
+ f=open("summary.txt","w")
+ f.write(repr(dic))
+ f.close()
diff --git a/debian/patches/series b/debian/patches/series
index fed549d..a90e748 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ debug-test.patch
 ld-no-add-needed.patch
 destdir.patch
 cmor_ver.patch
+python3.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cmor.git



More information about the debian-science-commits mailing list