[cmor] 154/190: WIP: more python3
Alastair McKinstry
mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:49 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 0525734c5376cb0459ea1423038d005b9b4fcb02
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Fri Jun 14 15:41:58 2013 +0100
WIP: more python3
---
debian/patches/python3.patch | 1723 ++++++++++++++++++++++++++++++++++++++-
debian/patches/shlib-link.patch | 2 +-
2 files changed, 1699 insertions(+), 26 deletions(-)
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index f8951b2..451e2d5 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -5,8 +5,8 @@ Forwarded: no
Index: cmor-2.8.3/Lib/git2svn.py
===================================================================
---- cmor-2.8.3.orig/Lib/git2svn.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Lib/git2svn.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Lib/git2svn.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Lib/git2svn.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,3 +1,4 @@
+from __future__ import print_function
import os,sys
@@ -33,8 +33,8 @@ Index: cmor-2.8.3/Lib/git2svn.py
os.popen(cmd).readlines()
Index: cmor-2.8.3/Lib/pywrapper.py
===================================================================
---- cmor-2.8.3.orig/Lib/pywrapper.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Lib/pywrapper.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Lib/pywrapper.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Lib/pywrapper.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,4 +1,3 @@
-
import cmor_const,numpy,os,_cmor
@@ -708,8 +708,8 @@ Index: cmor-2.8.3/Lib/pywrapper.py
if (file_name is False):
Index: cmor-2.8.3/Lib/__init__.py
===================================================================
---- cmor-2.8.3.orig/Lib/__init__.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Lib/__init__.py 2013-06-13 17:07:11.000000000 +0100
+--- cmor-2.8.3.orig/Lib/__init__.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Lib/__init__.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,9 +1,9 @@
-from cmor_const import *
-
@@ -728,8 +728,8 @@ Index: cmor-2.8.3/Lib/__init__.py
pass
Index: cmor-2.8.3/Lib/check_CMOR_compliant.py
===================================================================
---- cmor-2.8.3.orig/Lib/check_CMOR_compliant.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Lib/check_CMOR_compliant.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Lib/check_CMOR_compliant.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Lib/check_CMOR_compliant.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cdms2
@@ -1152,8 +1152,8 @@ Index: cmor-2.8.3/Lib/check_CMOR_compliant.py
Index: cmor-2.8.3/Test/check_results.py
===================================================================
---- cmor-2.8.3.orig/Test/check_results.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Test/check_results.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Test/check_results.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Test/check_results.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,3 +1,4 @@
+from __future__ import print_function
from out_files import out
@@ -1203,8 +1203,8 @@ Index: cmor-2.8.3/Test/check_results.py
+ 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-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Test/cmor_speed_and_compression_01.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Test/cmor_speed_and_compression_01.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Test/cmor_speed_and_compression_01.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,11 +1,13 @@
+from __future__ import print_function
import cmor,numpy,sys,os
@@ -1282,8 +1282,8 @@ Index: cmor-2.8.3/Test/cmor_speed_and_compression_01.py
f.close()
Index: cmor-2.8.3/setup.py.in
===================================================================
---- cmor-2.8.3.orig/setup.py.in 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/setup.py.in 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/setup.py.in 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/setup.py.in 2013-06-13 17:25:44.000000000 +0100
@@ -1,8 +1,10 @@
+from __future__ import print_function # to be python2/python3 agnostic
import numpy
@@ -1316,8 +1316,8 @@ Index: cmor-2.8.3/setup.py.in
version='2.0',
Index: cmor-2.8.3/Test/cmor_speed_and_compression_02.py
===================================================================
---- cmor-2.8.3.orig/Test/cmor_speed_and_compression_02.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Test/cmor_speed_and_compression_02.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Test/cmor_speed_and_compression_02.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Test/cmor_speed_and_compression_02.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,8 +1,9 @@
+from __future__ import print_function
import cmor,numpy,sys,os
@@ -1390,8 +1390,8 @@ Index: cmor-2.8.3/Test/cmor_speed_and_compression_02.py
f.close()
Index: cmor-2.8.3/Test/cmor_speed_and_compression.py
===================================================================
---- cmor-2.8.3.orig/Test/cmor_speed_and_compression.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Test/cmor_speed_and_compression.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Test/cmor_speed_and_compression.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Test/cmor_speed_and_compression.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor,numpy,sys,os
@@ -1453,8 +1453,8 @@ Index: cmor-2.8.3/Test/cmor_speed_and_compression.py
f.close()
Index: cmor-2.8.3/Test/jamie_hybrid_height.py
===================================================================
---- cmor-2.8.3.orig/Test/jamie_hybrid_height.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Test/jamie_hybrid_height.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Test/jamie_hybrid_height.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Test/jamie_hybrid_height.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
@@ -1491,8 +1491,8 @@ Index: cmor-2.8.3/Test/jamie_hybrid_height.py
Index: cmor-2.8.3/Test/nc2asc.py
===================================================================
---- cmor-2.8.3.orig/Test/nc2asc.py 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Test/nc2asc.py 2013-06-13 16:53:22.000000000 +0100
+--- cmor-2.8.3.orig/Test/nc2asc.py 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Test/nc2asc.py 2013-06-13 17:25:44.000000000 +0100
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
@@ -1584,18 +1584,1691 @@ Index: cmor-2.8.3/Test/nc2asc.py
f.close()
Index: cmor-2.8.3/Src/_cmormodule.c
===================================================================
---- cmor-2.8.3.orig/Src/_cmormodule.c 2013-06-13 16:11:43.000000000 +0100
-+++ cmor-2.8.3/Src/_cmormodule.c 2013-06-13 17:07:39.000000000 +0100
-@@ -2,6 +2,12 @@
+--- cmor-2.8.3.orig/Src/_cmormodule.c 2013-06-13 17:25:44.000000000 +0100
++++ cmor-2.8.3/Src/_cmormodule.c 2013-06-14 15:40:21.000000000 +0100
+@@ -2,6 +2,26 @@
#include "numpy/arrayobject.h"
#include "cmor.h"
++
+#if PY_MAJOR_VERSION >= 3
+#define PyInt_AsLong PyLong_AsLong
+#define PyInt_FromLong PyLong_FromLong
+#define PyString_AsString PyBytes_AsString
+#endif
+
++
++struct module_state {
++ PyObject *error;
++};
++
++
++#if PY_MAJOR_VERSION >= 3
++#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
++#else
++#define GETSTATE(m) (&_state)
++static struct module_state _state;
++#endif
++
static PyObject *
PyCMOR_get_original_shape(PyObject *self,PyObject *args)
{
+@@ -799,11 +819,62 @@
+ {NULL, NULL} /*sentinel */
+ };
+
+-PyMODINIT_FUNC init_cmor(void)
++#if PY_MAJOR_VERSION >= 3
++
++static int MyExtract_traverse(PyObject *m, visitproc visit, void *arg) {
++ Py_VISIT(GETSTATE(m)->error);
++ return 0;
++}
++
++static int MyExtract_clear(PyObject *m) {
++ Py_CLEAR(GETSTATE(m)->error);
++ return 0;
++}
++
++static struct PyModuleDef moduledef = {
++ PyModuleDef_HEAD_INIT,
++ "_cmor",
++ NULL,
++ sizeof(struct module_state),
++ MyExtractMethods,
++ NULL,
++ MyExtract_traverse,
++ MyExtract_clear,
++ NULL
++};
++
++
++#define INITERROR return NULL
++
++PyObject * PyInit_cmor(void)
++
++#else
++#define INITERROR return
++
++void init_cmor(void)
++#endif
++
+ {
+- (void) Py_InitModule("_cmor", MyExtractMethods);
++#if PY_MAJOR_VERSION >= 3
++ PyObject *module = PyModule_Create(&moduledef);
++#else
++ PyObject *module = Py_InitModule("_cmor", MyExtractMethods);
++#endif
+ import_array();
+-
++
++ if (module == NULL)
++ INITERROR;
++ struct module_state *st = GETSTATE(module);
++
++ st->error = PyErr_NewException("_cmor.Error", NULL, NULL);
++ if (st->error == NULL) {
++ Py_DECREF(module);
++ INITERROR;
++ }
++
++#if PY_MAJOR_VERSION >= 3
++ return module;
++#endif
+ }
+
+ /* int main(int argc,char **argv) */
+Index: cmor-2.8.3/Test/test_compression.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_compression.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_compression.py 2013-06-13 17:48:58.000000000 +0100
+@@ -1,8 +1,9 @@
++from __future__ import print_function
+ import sys,os
+ try:
+ import cdms2
+ except:
+- print 'This test requires cdms2 for I/O'
++ print('This test requires cdms2 for I/O')
+ sys.exit()
+
+ import cmor,numpy
+@@ -44,12 +45,12 @@
+ #Now creates a dummy HUGE axis for resizing s as really big
+ factor = 100
+ nt = s.shape[0]*factor
+-print 'nt is:',nt
++print('nt is:',nt)
+ t = numpy.arange(nt)
+
+ tmp = cmor.axis('time',coord_vals=t,units=Saxes[0].units,cell_bounds=numpy.arange(nt+1))
+ axes.insert(0,tmp)
+-print axes
++print(axes)
+ var_id1 = cmor.variable(s.id,s.units,axes)
+ ## the one with 2 at the end is compressed
+ var_id2 = cmor.variable(s.id,s.units,axes)
+@@ -58,7 +59,7 @@
+ s=numpy.resize(s,sh)
+ #s=numpy.where(numpy.greater(s,100.),100,s)
+ s=numpy.random.random(s.shape)*100.
+-print s.shape
++print(s.shape)
+ cmor.write(var_id1,s)
+ cmor.close(var_id1)
+ cmor.write(var_id2,s)
+Index: cmor-2.8.3/Test/test_grid_stub_jamie.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_grid_stub_jamie.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_grid_stub_jamie.py 2013-06-13 17:50:47.000000000 +0100
+@@ -71,7 +71,7 @@
+ try:
+ grid([[1], [2]])
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals('error axes list/array must be 1D', str(e))
+
+ def test_error_on_axis_ids(self):
+@@ -80,7 +80,7 @@
+ try:
+ grid(axis_ids)
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals('Error could not convert axis_ids list to a numpy array',
+ str(e))
+
+@@ -88,14 +88,14 @@
+ try:
+ grid([0], latitude = numpy.arange(2))
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals("Error could not convert longitude to a numpy array", str(e))
+
+ def test_error_longitude_no_latitude(self):
+ try:
+ grid([0], longitude = numpy.arange(2))
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals("latitude and longitude must be BOTH an array or None", str(e))
+
+ def test_error_type_lats(self):
+@@ -104,7 +104,7 @@
+ try:
+ grid([0, 11], latitude = lats, longitude = lons)
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals('Error could not convert latitude to a numpy array', str(e))
+ def test_error_type_lons(self):
+ lats = numpy.arange(2*3).reshape(2,3)
+@@ -112,7 +112,7 @@
+ try:
+ grid([0, 1], latitude = lats, longitude = lons)
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals('Error could not convert longitude to a numpy array', str(e))
+ def test_error_rank_lons(self):
+ axis_ids = [1, 2]
+@@ -121,7 +121,7 @@
+ try:
+ grid(axis_ids, latitude = lats, longitude = lons)
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals("longitude's rank does not match number of axes passed via axis_ids", str(e))
+
+ def test_error_rank_lats(self):
+@@ -131,7 +131,7 @@
+ try:
+ grid(axis_ids, latitude = lats, longitude = lons)
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals("latitude's rank does not match number of axes passed via axis_ids", str(e))
+
+ def test_error_rank_lat_verts(self): # this test may be fragile?
+@@ -143,7 +143,7 @@
+ grid(axis_ids, latitude = lats, longitude = lons,
+ latitude_vertices = lat_verts)
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals("latitude_vertices's rank does not match number of axes passed via axis_ids +1 (for vertices)",
+ str(e))
+
+@@ -156,7 +156,7 @@
+ grid(axis_ids, latitude = lats, longitude = lons,
+ longitude_vertices = lon_verts)
+ self.fail('should raise exception')
+- except Exception, e:
++ except Exception as e:
+ self.assertEquals("longitude_vertices's rank does not match number of axes passed via axis_ids +1 (for vertices)",
+ str(e))
+
+Index: cmor-2.8.3/Test/test_python_2Gb_file.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_2Gb_file.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_2Gb_file.py 2013-06-13 17:51:42.000000000 +0100
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor,numpy
+
+
+@@ -37,12 +37,12 @@
+ data = numpy.random.random((nlev,nlat,nlon))*30+273.15
+
+ for i in range(ntimes):
+- if i%10==0 : print 'Writing time:',i
++ if i%10==0 : printi(' Writing time:',i)
+ cmor.write(var,data,time_vals=numpy.array([float(i),]),time_bnds=numpy.array([i,i+1.]))
+
+-print cmor.close(var_id=var,file_name=True)
++print(cmor.close(var_id=var,file_name=True))
+ cmor.close()
+
+
+
+-print 'hello'
++print('hello')
+Index: cmor-2.8.3/Test/test_python_2Gb_slice.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_2Gb_slice.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_2Gb_slice.py 2013-06-13 17:52:28.000000000 +0100
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor,numpy
+
+
+@@ -20,7 +20,7 @@
+
+ levs = numpy.array([1000.,925,900,850,800,700,600,500,400,300,250,200,150,100,75,70,50,30,20,10,7.5,5,2.5,1])
+ alllevs = numpy.arange(1000,0,-dlev).tolist()
+-print len(alllevs)
++print(len(alllevs))
+
+ cmor.setup(inpath='.',netcdf_file_action=cmor.CMOR_REPLACE)
+ cmor.dataset('historical', 'ukmo', 'pcmdi-10b HadCM3', 'gregorian',model_id='pcmdi-10b',outpath='Test',forcing='N/A', parent_experiment_id="lgm", parent_experiment_rip="r1i1p1",contact="Bruce Bochy",branch_time=0,institute_id="yep")
+@@ -40,12 +40,12 @@
+ data = numpy.random.random((nlev,nlat,nlon))*30+273.15
+
+ for i in range(ntimes):
+- if i%10==0 : print 'Writing time:',i
++ if i%10==0 : print('Writing time:',i)
+ cmor.write(var,data,time_vals=numpy.array([float(i),]),time_bnds=numpy.array([i,i+1.]))
+
+-print cmor.close(var_id=var,file_name=True)
++print(cmor.close(var_id=var,file_name=True))
+ cmor.close()
+
+
+
+-print 'hello'
++print('hello')
+Index: cmor-2.8.3/Test/test_python_3hr.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_3hr.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_3hr.py 2013-06-13 17:53:03.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ error_flag = cmor.setup(inpath='Test', netcdf_file_action=cmor.CMOR_REPLACE)
+@@ -39,7 +40,7 @@
+
+ igrid = cmor.grid(axis_ids=[iloc,itm])
+
+-print igrid
++print(igrid)
+
+ ilat = cmor.time_varying_grid_coordinate(igrid,table_entry='latitude',units='degrees_north')
+ ilon = cmor.time_varying_grid_coordinate(igrid,table_entry='longitude',units='degrees_east')
+Index: cmor-2.8.3/Test/test_python_appending.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_appending.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_appending.py 2013-06-13 18:02:45.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ nlat = 90
+@@ -13,7 +14,7 @@
+ bnds_req=numpy.array(bnds_req)
+ bnds_req.shape=(7,2)
+
+- print bnds_req[-2], bnds_req.shape
++ print(bnds_req[-2], bnds_req.shape)
+
+ levs=[]
+
+@@ -22,14 +23,14 @@
+
+ levs=numpy.array(levs)
+
+- print levs
++ print(levs)
+
+ ipth="Test"
+ if append_to is None:
+ mode = cmor.CMOR_REPLACE
+ else:
+ mode = cmor.CMOR_APPEND
+- print 'Mode in python:',mode
++ print('Mode in python:',mode)
+ cmor.setup(inpath=ipth,
+ set_verbosity=cmor.CMOR_NORMAL,
+ netcdf_file_action = mode,
+@@ -65,22 +66,22 @@
+ #itim = cmor.axis(table_entry='time',units='month since 2008',coord_vals=numpy.arange(0,12,1))
+ ilat = cmor.axis(table_entry='latitude',coord_vals=lats,units='degrees_north',cell_bounds=bnds_lat)
+ ilon = cmor.axis(table_entry='longitude',coord_vals=lons,units='degrees_east',cell_bounds=bnds_lon)
+- print 'so far',itim,ilat,ilon
++ print('so far',itim,ilat,ilon)
+ ilev = cmor.axis(table_entry="plevs",coord_vals=plevs,units="Pa")
+
+ iv = cmor.variable(table_entry='ta',axis_ids=numpy.array((itim,ilev,ilat,ilon)),units='K')
+
+ #cmor.write(iv,data)
+ if append_to is None:
+- print 'time:',time_vals
+- print 'bnds:',cell_bounds
++ print('time:',time_vals)
++ print('bnds:',cell_bounds)
+ cmor.write(iv,data,time_vals=time_vals,time_bnds=cell_bounds)#,file_suffix="with-appending")
+ else:
+- print 'Ok writing with a suffix',append_to
++ print('Ok writing with a suffix',append_to)
+ cmor.write(iv,data,time_vals=time_vals,file_suffix=append_to,time_bnds=cell_bounds)
+- print 'and back'
++ print('and back')
+ file = cmor.close(iv,file_name=True)
+- print 'Ok dumped to:',file
++ print('Ok dumped to:',file)
+ cmor.close()
+ return file
+
+@@ -90,6 +91,6 @@
+
+
+ f1 = mywrite(data = data[:6], time_vals = numpy.arange(0,6,1),cell_bounds=numpy.arange(0,7,1))
+-print 'First part: ',f1
++print('First part: ',f1)
+ f2 = mywrite(data = data[6:], time_vals = numpy.arange(6,12,1), cell_bounds=numpy.arange(6,13,1), append_to=f1)
+-print f2
++print(f2)
+Index: cmor-2.8.3/Test/test_python_bad_date.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_bad_date.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_bad_date.py 2013-06-13 18:03:43.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -22,16 +23,16 @@
+ tbnds = list(tvals)
+ tbnds.append(43200)
+ tbnds=numpy.array(tbnds)-3.
+- print "tvals:",tvals
+- print "tbnds:",tbnds
++ print("tvals:",tvals)
++ print("tbnds:",tbnds)
+ import cdtime
+ tunits='hours since 209-01-01 06:00:00'
+ t1=cdtime.reltime(tvals[0],tunits)
+ t2=cdtime.reltime(tvals[-1],tunits)
+ t3=cdtime.reltime(tbnds[-1],tunits)
+- print t1.tocomp(),t1.tocomp(cdtime.Calendar360)
+- print t2.tocomp(),t2.tocomp(cdtime.Calendar360)
+- print t3.tocomp(),t3.tocomp(cdtime.Calendar360)
++ print(t1.tocomp(),t1.tocomp(cdtime.Calendar360))
++ print(t2.tocomp(),t2.tocomp(cdtime.Calendar360))
++ print(t3.tocomp(),t3.tocomp(cdtime.Calendar360))
+
+ axes = [ {'table_entry': 'time1',
+ 'units': tunits,
+@@ -85,7 +86,7 @@
+ cmor_initialisation()
+ values,axes = setup_data()
+ vid = cmor_define_and_write(values, axes)
+- print cmor.close(var_id=vid,file_name=True)
++ print(cmor.close(var_id=vid,file_name=True))
+
+ if __name__ == '__main__':
+
+Index: cmor-2.8.3/Test/test_python_bentley_01.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_bentley_01.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_bentley_01.py 2013-06-13 18:05:35.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+ import cdtime
+@@ -26,7 +27,7 @@
+ 'coord_vals': [0]},
+ {'table_entry': 'hybrid_height',
+ 'units': 'm',
+- 'coord_vals': range(2),
++ 'coord_vals': list(range(2)),
+ 'cell_bounds': [[x-0.5, x+0.5] for x in range(2)],
+ },
+ ]
+@@ -45,7 +46,7 @@
+
+ igrid = cmor.grid([axis_ids[1]], [0.], [0.])
+ cmor.zfactor(axis_ids[2], 'b', axis_ids = [axis_ids[2]],
+- zfactor_values = range(2),
++ zfactor_values = list(range(2)),
+ zfactor_bounds = [[x-0.5, x+0.5] for x in range(2)])
+
+ cmor.zfactor(axis_ids[2], 'orog', 'm', axis_ids = [igrid],
+@@ -62,7 +63,7 @@
+ for time in [x * 1800./ 86400 for x in range(48)]:
+ time += 1./3600./24.
+ tr = cdtime.reltime(time,axes[0]["units"])
+- print "Writing: %.03f" % time,"|",tr.tocomp(cdtime.Calendar360),"|",tr.tocomp()
++ print("Writing: %.03f" % time,"|",tr.tocomp(cdtime.Calendar360),"|",tr.tocomp())
+ cmor.write(varid, values, time_vals = [time])
+ return varid
+
+@@ -73,7 +74,7 @@
+ values, axes = setup_data()
+ varid = cmor_define_and_write(values, axes)
+ fname = cmor.close(varid, file_name = True)
+- print "Done:",fname
++ print("Done:",fname)
+
+
+ if __name__ == '__main__':
+Index: cmor-2.8.3/Test/test_python_bounds_request.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_bounds_request.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_bounds_request.py 2013-06-13 18:06:24.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ breq = "100000. 80000. 80000. 68000. 68000. 56000. 56000. 44000. 44000. 31000. 31000. 18000. 18000. 0.".split()
+@@ -9,7 +10,7 @@
+ bnds_req=numpy.array(bnds_req)
+ bnds_req.shape=(7,2)
+
+-print bnds_req[-2], bnds_req.shape
++print( bnds_req[-2], bnds_req.shape)
+
+ levs=[]
+
+@@ -18,7 +19,7 @@
+
+ levs=numpy.array(levs)
+
+-print levs
++print(levs)
+
+ ipth="Test"
+ cmor.setup(inpath=ipth,
+@@ -51,7 +52,7 @@
+ itim = cmor.axis(table_entry='time',coord_vals=numpy.arange(0,ntime,1),units='month since 2008')
+ ilat = cmor.axis(table_entry='latitude',coord_vals=lats,units='degrees_north')
+ ilon = cmor.axis(table_entry='longitude',coord_vals=lons,units='degrees_east')
+-print 'so far',itim,ilat,ilon
++print('so far',itim,ilat,ilon)
+ ilev = cmor.axis(table_entry="pressure2",coord_vals=levs,cell_bounds=bnds_req,units="Pa")
+
+ iv = cmor.variable(table_entry='ta',axis_ids=numpy.array((itim,ilev,ilat,ilon)),units='K')
+Index: cmor-2.8.3/Test/test_python_cfmip_site_axis_test.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_cfmip_site_axis_test.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_cfmip_site_axis_test.py 2013-06-13 18:09:55.000000000 +0100
+@@ -28,6 +28,7 @@
+ lev:formula_terms = "a: lev b: b orog: orog";
+ ...
+ '''
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -64,41 +65,41 @@
+ # Create CMOR axes and grids
+ table_id = cmor.load_table('CMIP5_cfSites')
+ taxis_id = cmor.axis('time1', units='days since 2000-01-01 00:00:00') #, length=1, interval='30 minutes')
+- print 'ok: created time axis'
++ print('ok: created time axis')
+
+ saxis_id = cmor.axis('site', units='1', coord_vals=[1,2,3])
+- print 'ok: created site axis',saxis_id
++ print('ok: created site axis',saxis_id)
+
+ zaxis_id = cmor.axis('hybrid_height', units='m', coord_vals=[1.0], cell_bounds=[0.0,2.0])
+- print 'ok: created height axis',zaxis_id
++ print('ok: created height axis',zaxis_id)
+
+ # Create zfactors for b and orog for hybrid height axis.
+ # Where do these get used, if anywhere?
+ bfact_id = cmor.zfactor(zaxis_id, 'b', '1', [zaxis_id], 'd', zfactor_values=[1.0],
+ zfactor_bounds=[0.0,2.0])
+- print 'ok: created b zfactors'
++ print('ok: created b zfactors')
+
+ # Create grid object to link site-dimensioned variables to (lat,long).
+ # Need to make CMIP5_grids the current MIP table for this to work.
+ table_id = cmor.load_table('CMIP5_grids')
+ gaxis_id = cmor.grid([saxis_id], site_lats, site_lons)
+- print 'ok: created site grid'
++ print('ok: created site grid')
+
+ # Create CMOR variable for cloud area fraction: MIP name = 'cl', STASH = m01s02i261*100
+ table_id = cmor.load_table('CMIP5_cfSites')
+ var_id = cmor.variable('cl', '%', [taxis_id, gaxis_id, zaxis_id], type='f',
+ missing_value=-99.0, original_name='STASH m01s02i261*100')
+- print 'ok: created variable for "cl"'
++ print('ok: created variable for "cl"')
+
+ ofact_id = cmor.zfactor(zaxis_id, 'orog', 'm', [gaxis_id], 'd',
+ zfactor_values=[123.0])
+- print 'ok: created orog zfactors'
++ print('ok: created orog zfactors')
+ # Write some data to this variable. First convert raw data to numpy arrays.
+ shape = (1, 3, 1)
+ data = numpy.array([10, 20, 30], dtype=numpy.float32)
+ data = data.reshape(shape)
+ cmor.write(var_id, data, time_vals=[1.0])
+- print 'ok: wrote variable data'
++ print('ok: wrote variable data')
+
+ # Close CMOR.
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_clim_bounds.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_clim_bounds.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_clim_bounds.py 2013-06-13 18:12:32.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -37,7 +38,7 @@
+
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+Index: cmor-2.8.3/Test/test_python_clim_bounds_02.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_clim_bounds_02.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_clim_bounds_02.py 2013-06-13 18:10:40.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -50,7 +51,7 @@
+
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+Index: cmor-2.8.3/Test/test_python_clim_bounds_03.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_clim_bounds_03.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_clim_bounds_03.py 2013-06-13 18:11:33.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -50,7 +51,7 @@
+
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+@@ -62,7 +63,7 @@
+ history = 'variable history',
+ missing_value = -99
+ )
+- print values.shape
++ print(values.shape)
+
+ cmor.write(varid, values)#, ntimes_passed=1)
+
+Index: cmor-2.8.3/Test/test_python_clim_bounds_04.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_clim_bounds_04.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_clim_bounds_04.py 2013-06-13 18:12:00.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -50,7 +51,7 @@
+ [45959, 52925]],}
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+Index: cmor-2.8.3/Test/test_python_YYYMMDDHH_exp_fmt.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_YYYMMDDHH_exp_fmt.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_YYYMMDDHH_exp_fmt.py 2013-06-13 19:49:42.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+
+ def path_test():
+@@ -32,7 +33,7 @@
+ cmor.write(varid, [273])
+ path=cmor.close(varid, file_name=True)
+
+- print "Saved file: ",path
++ print("Saved file: ",path)
+
+ if __name__ == '__main__':
+ path_test()
+Index: cmor-2.8.3/Test/test_python_direct_calls.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_direct_calls.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_direct_calls.py 2013-06-13 18:25:28.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+ import cmor._cmor
+ import os
+@@ -32,7 +33,7 @@
+ a = cmor._cmor.load_table("Tables/CMIP5_Omon")
+ tables.append(a)
+ tables.append(cmor._cmor.load_table("Tables/CMIP5_Amon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+
+ axes=[]
+@@ -48,7 +49,7 @@
+ myaxes[2] = cmor._cmor.axis(id,units,lon,alons,'d',bnds_lon,2,interval)
+ id="plevs"
+ units="Pa"
+-print plevs.astype("d")
++print(plevs.astype("d"))
+ myaxes[3] = cmor._cmor.axis(id,units,lev2,plevs.astype("d"),'d',None,0,interval)
+
+
+@@ -75,31 +76,31 @@
+ myaxes2[2] = myaxes[1];
+ myaxes2[3] = myaxes[2];
+
+-print 'ok doing the vars thing'
++print('ok doing the vars thing')
+ myvars[0] = cmor._cmor.variable(entry2d[0],units2d[0],3,myaxes,'d',None,dtmp2,positive2d[0],varin2d[0],"no history","no future")
+-print 'vars 2'
++print('vars 2')
+ myvars[1] = cmor._cmor.variable(entry3d[2],units3d[2],4,myaxes2,'d',None,dtmp2,"",varin3d[2],"no history","no future")
+-print 'vars 2'
++print('vars 2')
+
+ myaxes2[1] = myaxes[4];
+ myvars[2] = cmor._cmor.variable(entry3d[0],units3d[0],4,myaxes2,'d',None,dtmp2,"",varin3d[0],"no history","no future")
+
+-print 'vars 2'
++print('vars 2')
+
+-print 'zfact',type(numpy.array(myaxes2[1])),type(myaxes2)
++print('zfact',type(numpy.array(myaxes2[1])),type(myaxes2))
+
+ myvars[3] = cmor._cmor.zfactor(int(myaxes2[1]),"p0","Pa",0,None,'d',p0,None)
+-print 'zfact',myaxes2[1]
++print('zfact',myaxes2[1])
+ myvars[3] = cmor._cmor.zfactor(int(myaxes2[1]),"b","",1,myaxes2[1],'d',b_coeff,b_coeff_bnds)
+-print 'zfact',myaxes2[1]
++print('zfact',myaxes2[1])
+ myvars[3] = cmor._cmor.zfactor(int(myaxes2[1]),"a","",1,myaxes2[1],'d',a_coeff,a_coeff_bnds)
+ #/* printf("defining ap\n"); */
+ #/* for(i=0;i<5;i++) {a_coeff[i]*=1.e3;printf("sending acoef: %i, %lf\n",i,a_coeff[i]);} */
+ #/* for(i=0;i<6;i++) {a_coeff_bnds[i]*=1.e5;printf("sending acoef: %i, %lf\n",i,a_coeff_bnds[i]);} */
+ #/* ierr = cmor_zfactor(&myvars[3],myaxes2[1],"ap","hPa",1,&myaxes2[1],'d',&a_coeff,&a_coeff_bnds); */
+-print 'zfact before last'
++print('zfact before last')
+ myvars[3] = cmor._cmor.zfactor(int(myaxes2[1]),"ps","hPa",3,myaxes,'d',None,None)
+-print 'zfact last'
++print('zfact last')
+
+ # /* ok here we decalre a variable for region axis testing */
+ cmor.set_table(tables[0])
+@@ -114,7 +115,7 @@
+
+ for i in range(ntimes):
+ data2d = read_2d_input_files(i, varin2d[0], lat,lon)
+- print 'writing time',i,data2d.shape,data2d,numpy.average(data2d)
++ print('writing time',i,data2d.shape,data2d,numpy.average(data2d))
+ cmor._cmor.write(myvars[0],numpy.ravel(data2d),data2d.dtype.char,"",1,None,None,None);
+
+ cmor._cmor.close(None,0,0)
+Index: cmor-2.8.3/Test/test_python_fx.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_fx.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_fx.py 2013-06-13 18:26:36.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -45,4 +46,4 @@
+ fnm = cmor.close(varid,file_name=True)
+ cmor.close()
+ return fnm
+-print test_mode(cmor.CMOR_REPLACE)
++print(test_mode(cmor.CMOR_REPLACE))
+Index: cmor-2.8.3/Test/test_python_grid_and_ocn_sigma.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_grid_and_ocn_sigma.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_grid_and_ocn_sigma.py 2013-06-13 18:28:16.000000000 +0100
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor,numpy
+ import os
+ ntimes=2
+@@ -43,7 +43,7 @@
+ lat_vertices[j,i,1] = lat_coords[j,i]-delta_lat;
+ lat_vertices[j,i,2] = lat_coords[j,i];
+ lat_vertices[j,i,3] = lat_coords[j,i]+delta_lat;
+- print lat_vertices.min(),'---------------------'
++ print(lat_vertices.min(),'---------------------')
+ return x,y,lon_coords,lat_coords,lon_vertices,lat_vertices
+
+
+@@ -86,12 +86,12 @@
+ a = cmor.load_table("Tables/CMIP5_grids")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP5_Omon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+ x,y,lon_coords,lat_coords,lon_vertices,lat_vertices = gen_irreg_grid(lon,lat)
+-print lon_vertices.shape,lat_vertices.shape,x.shape,y.shape
++print(lon_vertices.shape,lat_vertices.shape,x.shape,y.shape)
+
+ myaxes[1] = cmor.axis(table_entry = 'y',
+ units = 'm',
+@@ -100,13 +100,13 @@
+ units = 'm',
+ coord_vals = x)
+
+-print 'lons:',lon_vertices.shape,lon_coords.shape
++print('lons:',lon_vertices.shape,lon_coords.shape)
+ grid_id = cmor.grid(axis_ids = myaxes[:2],
+ latitude = lat_coords,
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ ## mapnm = 'lambert_conformal_conic'
+@@ -127,19 +127,19 @@
+ # Now sets up the ocn sigma stuff
+ levs=-numpy.arange(lev)/float(lev+1.)
+ blevs=-numpy.arange(lev+1)/float(lev+1.)
+-print 'Defining zlevs'
++print('Defining zlevs')
+ myaxes[4] = cmor.axis(table_entry='ocean_sigma',coord_vals=levs,cell_bounds=blevs,units='1')
+
+-print 'definnig zfactor depth',myaxes[2]
++print('definnig zfactor depth',myaxes[2])
+ depth = numpy.random.random((lon,lat))*5000.
+-print 'Depth:',depth.shape,depth.dtype
++prints( 'Depth:',depth.shape,depth.dtype)
+ idpth = cmor.zfactor(zaxis_id=myaxes[4],units='m',zfactor_name='depth',axis_ids=numpy.array([myaxes[2],]),zfactor_values=depth)
+
+-print 'defining zfactor eta'
++print('defining zfactor eta')
+ ieta = cmor.zfactor(zaxis_id=myaxes[4],units='m',zfactor_name='eta',axis_ids=[myaxes[2],myaxes[3]])
+-print 'ieta:',ieta
++print('ieta:',ieta)
+ pass_axes = [myaxes[4],myaxes[2],myaxes[3]]
+-print 'defining variable'
++print('defining variable')
+ myvars[0] = cmor.variable( table_entry = 'thetao',
+ units = 'K',
+ axis_ids = pass_axes,
+@@ -154,8 +154,8 @@
+ eta = numpy.random.random((lon,lat,ntimes))*10000.
+ #print 'writing time: ',i,data3d.shape,data3d
+ #print Time[i],bnds_time[2*i:2*i+2]
+- print 'Writing time',i,'for var',data3d.shape
++ print('Writing time',i,'for var',data3d.shape)
+ cmor.write(myvars[0],data3d,1,time_vals=Time[i],time_bnds=bnds_time[2*i:2*i+2])
+- print 'Writing time',i,'for eta'
++ print('Writing time',i,'for eta')
+ cmor.write(ieta,eta,1,time_vals=Time[i],time_bnds=bnds_time[2*i:2*i+2],store_with=myvars[0])
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_index_coord.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_index_coord.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_index_coord.py 2013-06-13 18:28:55.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ ipth="Test"
+@@ -41,4 +42,4 @@
+ cmor.write(iv,data)
+
+ f1 = cmor.close(iv,file_name=True)
+-print f1
++print(f1)
+Index: cmor-2.8.3/Test/test_python_jamie_10.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_jamie_10.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_jamie_10.py 2013-06-13 18:29:38.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -37,7 +38,7 @@
+
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+Index: cmor-2.8.3/Test/test_python_jamie_12.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_jamie_12.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_jamie_12.py 2013-06-13 18:30:07.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -9,7 +9,7 @@
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+- print 'MY:cmor.axis calls complete'
++ print('MY:cmor.axis calls complete')
+ return axis_ids
+
+ def define_write_var(axis_ids, entry, unit, values):
+Index: cmor-2.8.3/Test/test_python_jamie_2.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_jamie_2.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_jamie_2.py 2013-06-13 19:25:02.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+
+ def multi_call_test():
+@@ -31,15 +32,15 @@
+ axis_ids.append(axis_id)
+ varid = cmor.variable('ts', 'K', axis_ids)
+ cmor.write(varid, [275], time_vals = [15], time_bnds = [ [0,30] ])
+- print 'First write worked as expected'
++ print('First write worked as expected')
+ try:
+ cmor.write(varid, [275], time_vals = [15], time_bnds = [ [0], [30] ])
+- raise Exception,"We shouldn't be getting in here"
++ raise Exception("We shouldn't be getting in here")
+ except:
+- print 'Second write that should have failed did fail, good!'
++ print('Second write that should have failed did fail, good!')
+ pass
+ cmor.close(varid)
+- print 'Success'
++ print('Success')
+
+
+ if __name__ == '__main__':
+Index: cmor-2.8.3/Test/test_python_jamie_6.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_jamie_6.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_jamie_6.py 2013-06-13 19:25:53.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ error_flag = cmor.setup(inpath='Test', netcdf_file_action=cmor.CMOR_REPLACE)
+@@ -106,7 +107,7 @@
+ units='m' ,
+ zfactor_values = data2d)
+ else:
+- print 'yep working case'
++ print('yep working case')
+ ilev = cmor.axis(
+ table_entry='standard_sigma',
+ units='1',
+Index: cmor-2.8.3/Test/test_python_jamie_8.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_jamie_8.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_jamie_8.py 2013-06-13 19:26:29.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -9,7 +9,7 @@
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+- print 'cmor.axis calls complete'
++ print('cmor.axis calls complete')
+ return axis_ids
+
+ def define_write_var(axis_ids, entry, unit, values):
+@@ -19,11 +19,11 @@
+ missing_value = -99
+ )
+
+- print 'cmor.variable call complete'
++ print('cmor.variable call complete')
+
+ cmor.write(varid, values, time_vals = [15.0], time_bnds = [0., 30.0])
+
+- print 'cmor.write call complete'
++ print('cmor.write call complete')
+
+
+ def cmor_ini():
+Index: cmor-2.8.3/Test/test_python_jamie_9.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_jamie_9.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_jamie_9.py 2013-06-13 19:26:54.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -37,7 +38,7 @@
+
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+Index: cmor-2.8.3/Test/test_python_jamie_site_surface.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_jamie_site_surface.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_jamie_site_surface.py 2013-06-13 19:27:23.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -55,7 +56,7 @@
+ cmor_initialisation()
+ values, axes = setup_data()
+ cmor_define_and_write(values, axes)
+- print cmor.close(file_name=True)
++ print(cmor.close(file_name=True))
+
+ if __name__ == '__main__':
+
+Index: cmor-2.8.3/Test/test_python_joerg_10.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_10.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_10.py 2013-06-13 19:28:21.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -42,7 +43,7 @@
+ a = cmor.load_table("Tables/CMIP5_grids")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP5_Omon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+@@ -62,7 +63,7 @@
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ ## mapnm = 'lambert_conformal_conic'
+@@ -83,7 +84,7 @@
+
+ pass_axes = [myaxes[3],myaxes[2]]
+
+-print 'ok going to cmorvar'
++print('ok going to cmorvar')
+ myvars[0] = cmor.variable( table_entry = 'calc',
+ units = 'mol m-3',
+ axis_ids = pass_axes,
+@@ -97,7 +98,7 @@
+ data2d_1 = read_2d_input_files(i, varin2d[0], lat,lon)
+ data2d_2 = read_2d_input_files(i+1, varin2d[0], lat,lon)
+ data2d=numpy.array((data2d_1,data2d_2))
+- print 'writing time: ',i,data2d.shape,data2d
+- print Time[i:i+2],bnds_time[2*i:2*i+4]
++ print('writing time: ',i,data2d.shape,data2d)
++ print(Time[i:i+2],bnds_time[2*i:2*i+4])
+ cmor.write(myvars[0],data2d,2,time_vals=numpy.arange(i,i+2),time_bnds=numpy.arange(i,i+3))
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_joerg_11.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_11.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_11.py 2013-06-13 19:29:05.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -41,7 +42,7 @@
+ a = cmor.load_table("Tables/CMIP5_grids")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP5_Omon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+@@ -61,7 +62,7 @@
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ ## mapnm = 'lambert_conformal_conic'
+@@ -85,7 +86,7 @@
+
+ pass_axes = [myaxes[3],myaxes[4]]
+
+-print 'ok going to cmorvar'
++print('ok going to cmorvar')
+ myvars[0] = cmor.variable( table_entry = 'mfo',
+ units = 'kg s-1',
+ axis_ids = pass_axes,
+@@ -94,7 +95,7 @@
+ )
+ for i in range(ntimes):
+ data2d = numpy.random.random((1,15))
+- print 'writing time: ',i,data2d.shape,data2d
+- print Time[i],bnds_time[2*i:2*i+2]
++ print('writing time: ',i,data2d.shape,data2d)
++ print(Time[i],bnds_time[2*i:2*i+2] )
+ cmor.write(myvars[0],data2d,1,time_vals=Time[i],time_bnds=bnds_time[2*i:2*i+2])
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_joerg_12.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_12.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_12.py 2013-06-13 19:29:49.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -41,7 +42,7 @@
+ a = cmor.load_table("Tables/CMIP5_grids")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP5_Lmon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+@@ -61,7 +62,7 @@
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ ## mapnm = 'lambert_conformal_conic'
+@@ -85,7 +86,7 @@
+
+ pass_axes = [myaxes[2],myaxes[3],myaxes[4]]
+
+-print 'ok going to cmorvar'
++print('ok going to cmorvar')
+ myvars[0] = cmor.variable( table_entry = 'landCoverFrac',
+ units = '%',
+ axis_ids = pass_axes,
+@@ -94,7 +95,7 @@
+ )
+ for i in range(ntimes):
+ data2d = numpy.random.random((3,4,3))
+- print 'writing time: ',i,data2d.shape,data2d
+- print Time[i],bnds_time[2*i:2*i+2]
++ print('writing time: ',i,data2d.shape,data2d)
++ print(Time[i],bnds_time[2*i:2*i+2] )
+ cmor.write(myvars[0],data2d,1,time_vals=Time[i],time_bnds=bnds_time[2*i:2*i+2])
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_joerg_2.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_2.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_2.py 2013-06-13 19:36:45.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -57,7 +58,7 @@
+ 'coord_vals': levels},
+ ]
+
+- values = numpy.array(range(len(levels)), numpy.float32)+195
++ values = numpy.array(list(range(len(levels))), numpy.float32)+195
+ axis_ids = list()
+ for axis in axes:
+ axis_id = cmor.axis(**axis)
+@@ -70,7 +71,7 @@
+ history = 'variable history',
+ missing_value = -99
+ )
+- print 'suffix is:',suffix
++ print('suffix is:',suffix)
+ cmor.write(varid, values, time_vals = [i], time_bnds = [ [i,i+1] ],file_suffix=suffix)
+
+ fnm = cmor.close(varid,file_name=True)
+@@ -79,7 +80,7 @@
+
+ fnm=''
+ for i in range(5):
+- print i,fnm
++ print(i,fnm)
+ if i==0:
+ mode = cmor.CMOR_REPLACE
+ else:
+Index: cmor-2.8.3/Test/test_python_joerg_3.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_3.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_3.py 2013-06-13 19:37:54.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ ntimes=1
+@@ -127,24 +128,24 @@
+ for i in range(4):
+ tval = [i/4.+d]
+ tbnd = [i/4.+d-.125,i/4.+d+.125]
+- print 'writing time:',i,i/4.,file_suffix1
++ print('writing time:',i,i/4.,file_suffix1)
+ data=numpy.random.random((ntimes,nlev,nlat,nlon))*30.+273
+ data=data.astype("f")
+ cmor.write(ivar1,data,time_vals=tval,time_bnds=tbnd,file_suffix=file_suffix1)
+- print 'wrote var 1 time:',i
++ print('wrote var 1 time:',i)
+ data=numpy.random.random((ntimes,nlev,nlat,nlon))
+ data=data.astype("f")
+ cmor.write(ivar2,data,time_vals=tval,time_bnds=tbnd,file_suffix=file_suffix2)
+- print 'wrote var 2 time:',i
++ print('wrote var 2 time:',i)
+ data=numpy.random.random((ntimes,nlat,nlon))*8.+96300.
+ data=data.astype("f")
+ cmor.write(ips1,data,store_with=ivar1,ntimes_passed=1,time_vals=tval,time_bnds=tbnd)
+- print 'wrote ps in var 1 time:',i
++ print('wrote ps in var 1 time:',i)
+ cmor.write(ips2,data,store_with=ivar2,ntimes_passed=1,time_vals=tval,time_bnds=tbnd)
+- print 'wrote ps in var 2 time:',i
++ print('wrote ps in var 2 time:',i)
+ file_suffix1=cmor.close(ivar1,True)
+ file_suffix2=cmor.close(ivar2,True)
+- print 'File:',file_suffix1,file_suffix2
++ print('File:',file_suffix1,file_suffix2)
+ cmor.close()
+-print cmor.close(ivar1,True)
++print(cmor.close(ivar1,True))
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_joerg_8.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_8.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_8.py 2013-06-13 19:38:58.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -41,7 +42,7 @@
+ a = cmor.load_table("Tables/CMIP5_grids")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP5_Omon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+@@ -61,7 +62,7 @@
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ ## mapnm = 'lambert_conformal_conic'
+@@ -82,7 +83,7 @@
+
+ pass_axes = [myaxes[3],myaxes[2]]
+
+-print 'ok going to cmorvar'
++print('ok going to cmorvar')
+ myvars[0] = cmor.variable( table_entry = 'epc100',
+ units = 'mol m-2 s-1',
+ axis_ids = pass_axes,
+@@ -93,7 +94,7 @@
+ )
+ for i in range(ntimes):
+ data2d = read_2d_input_files(i, varin2d[0], lat,lon)
+- print 'writing time: ',i,data2d.shape,data2d
+- print Time[i],bnds_time[2*i:2*i+2]
++ print('writing time: ',i,data2d.shape,data2d)
++ print(Time[i],bnds_time[2*i:2*i+2] )
+ cmor.write(myvars[0],data2d,1,time_vals=Time[i],time_bnds=bnds_time[2*i:2*i+2])
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_joerg_9.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_9.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_9.py 2013-06-13 19:39:26.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy,cdms2
+
+ f=cdms2.open("Test/GR30s_halo.nc")
+@@ -75,7 +76,7 @@
+
+ fnm=""
+ for i in range(ntimes):
+- print 'writing time:',time_vals[i],bnds_time[i:i+2]
++ print('writing time:',time_vals[i],bnds_time[i:i+2])
+ data = numpy.random.random((nlon,nlat))
+ error_flag = cmor.write(
+ var_id = var_ids,
+@@ -86,6 +87,6 @@
+ time_bnds = bnds_time[i:i+2])
+
+ fnm = cmor.close(var_ids,file_name=True,preserve=True)
+- print 'dumped to:',fnm
++ print('dumped to:',fnm)
+
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_joerg_tim2_clim.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_joerg_tim2_clim.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_joerg_tim2_clim.py 2013-06-13 19:40:30.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -40,12 +41,12 @@
+
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+ for var, units, value in (('difvso', 'm2 s-1', 274.),):
+- values = numpy.ones(map(lambda x: len(x["coord_vals"]),axes))*value
++ values = numpy.ones([len(x["coord_vals"]) for x in axes])*value
+ varid = cmor.variable(var,
+ units,
+ axis_ids,
+Index: cmor-2.8.3/Test/test_python_max_variables_2.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_max_variables_2.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_max_variables_2.py 2013-06-13 19:41:09.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ error_flag = cmor.setup(inpath='Test', netcdf_file_action=cmor.CMOR_REPLACE)
+@@ -84,11 +85,11 @@
+
+ if (it == ntimes-1) :
+ fnm = cmor.close(var3d_ids, True)
+- print it,fnm
++ print(it,fnm)
+ else:
+ if (it%50)== 0:
+ fnm = cmor.close(var3d_ids, True, True)
+- print it,fnm
++ print(it,fnm)
+ else:
+ ierr = cmor.close(var3d_ids, False, True)
+
+Index: cmor-2.8.3/Test/test_python_memory_check.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_memory_check.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_memory_check.py 2013-06-13 19:41:47.000000000 +0100
+@@ -5,7 +5,7 @@
+
+ Memory stats are taken from http://code.activestate.com/recipes/286222/
+ '''
+-
++from __future__ import print_function
+ import os
+
+ _proc_status = '/proc/%d/status' % os.getpid()
+@@ -124,7 +124,7 @@
+ cmor.write(varid, [275])
+ mem,res,stk = memory_usage(sys.stdout,mem,res,stk)
+ #mem,res,stk = memory_usage(sys.stdout,memi,resi,stki)
+- print '---'
++ print('---')
+
+ cmor.close(varid)
+
+Index: cmor-2.8.3/Test/test_python_open_close_cmor_multiple.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_open_close_cmor_multiple.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_open_close_cmor_multiple.py 2013-06-13 19:42:31.000000000 +0100
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor,numpy
+
+
+@@ -50,10 +50,10 @@
+
+ cmor.write(var,data)
+ path=cmor.close(var, file_name=True)
+- print 'Saved in:',path
++ print('Saved in:',path)
+
+ cmor.close()
+
+
+
+-print 'hello'
++print('hello')
+Index: cmor-2.8.3/Test/test_python_reverted_lats.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_reverted_lats.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_reverted_lats.py 2013-06-13 19:43:13.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor,numpy
+
+ nlat = 10
+@@ -34,7 +35,7 @@
+ cmor.write(ivar,data,ntimes_passed=1,time_vals=[0.],time_bnds=[0.,1.])
+ fnm = cmor.close(ivar,file_name=True)
+
+-print '*******************************'
++print('*******************************')
+
+ ivar2 = cmor.variable(table_entry='tasmin',units='K',axis_ids=[itim,ilat2,ilon])
+ cmor.write(ivar2,data,ntimes_passed=1,time_vals=[1.],time_bnds=[1.,2.])
+Index: cmor-2.8.3/Test/test_python_singleton_anywhere_in_table_def.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_singleton_anywhere_in_table_def.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_singleton_anywhere_in_table_def.py 2013-06-13 19:44:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -56,7 +56,7 @@
+ tscl=2.e-2
+
+ tables.append(cmor.load_table("/git/cmip5-cmor-tables/Tables/%s" % t))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+@@ -76,7 +76,7 @@
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ mapnm = 'lambert_conformal_conic'
+@@ -107,8 +107,8 @@
+ ntimes=2
+ for i in range(ntimes):
+ data2d = read_2d_input_files(i, varin2d[0], lat,lon)*1.E-6
+- print 'writing time: ',i,data2d.shape#,data2d
++ print('writing time: ',i,data2d.shape)#,data2d)
+ #print Time[i],bnds_time[2*i:2*i+2]
+ cmor.write(myvars[0],data2d,1,time_vals=Time[i]*tscl,time_bnds=tscl*bnds_time[2*i:2*i+2])
+- print 'wrote'
++ print('wrote')
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_singleton_string.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_singleton_string.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_singleton_string.py 2013-06-13 19:45:10.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -56,7 +56,7 @@
+ tscl=3.5e-4
+
+ tables.append(cmor.load_table("/git/cmip5-cmor-tables/Tables/%s" % t))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+@@ -76,7 +76,7 @@
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ mapnm = 'lambert_conformal_conic'
+@@ -107,8 +107,8 @@
+ ntimes=2
+ for i in range(ntimes):
+ data2d = read_2d_input_files(i, varin2d[0], lat,lon)*1.E-6
+- print 'writing time: ',i,data2d.shape#,data2d
+- print Time[i],bnds_time[2*i:2*i+2]
++ print('writing time: ',i,data2d.shape)#,data2d)
++ print(Time[i],bnds_time[2*i:2*i+2] )
+ cmor.write(myvars[0],data2d,1,time_vals=Time[i],time_bnds=bnds_time[2*i:2*i+2])
+- print 'wrote'
++ print('wrote')
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_stephanie_6hrPlev_minutes.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_stephanie_6hrPlev_minutes.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_stephanie_6hrPlev_minutes.py 2013-06-13 19:45:40.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -37,7 +38,7 @@
+
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:',axis
++ print('doing:',axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+Index: cmor-2.8.3/Test/test_python_user_interface_00.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_user_interface_00.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_user_interface_00.py 2013-06-13 19:46:54.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -40,18 +41,18 @@
+ a = cmor.load_table(os.path.join(ipth,"../Tables/CMIP5_Omon"))
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP5_Amon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ axes=[]
+ id="time"
+ units="months since 1980"
+-print 'time bounds:',bnds_time
++print('time bounds:',bnds_time)
+ # ok we need to make the bounds 2D because the cmor module "undoes this"
+ bnds_time = numpy.reshape(bnds_time,(bnds_time.shape[0]/2,2))
+ bnds_lat = numpy.reshape(bnds_lat,(bnds_lat.shape[0]/2,2))
+ bnds_lon = numpy.reshape(bnds_lon,(bnds_lon.shape[0]/2,2))
+ myaxes[0] = cmor.axis(id,coord_vals=Time,units=units,cell_bounds=bnds_time,interval="1 month")
+-print 'time bounds:',bnds_time
++print('time bounds:',bnds_time)
+ id='latitude'
+ units="degrees_north"
+ interval=""
+@@ -87,30 +88,30 @@
+ myaxes2[2] = myaxes[1];
+ myaxes2[3] = myaxes[2];
+
+-print 'ok doing the vars thing',positive2d[0]
++print('ok doing the vars thing',positive2d[0])
+ myvars[0] = cmor.variable(entry2d[0],units2d[0],myaxes[:3],'d',missing_value=None,tolerance=dtmp2,positive=positive2d[0],original_name=varin2d[0],history="no history",comment="no future")
+-print 'vars 2'
++print('vars 2')
+ myvars[1] = cmor.variable(entry3d[2],units3d[2],myaxes2[:4],'d',original_name = varin3d[2])
+-print 'vars 2'
++print('vars 2')
+
+ myaxes2[1] = myaxes[4];
+ myvars[2] = cmor.variable(entry3d[0],units3d[0],myaxes2[:4],'d',original_name = varin3d[0])
+
+-print 'vars 2'
++print('vars 2')
+
+
+ myvars[3] = cmor.zfactor(int(myaxes2[1]),"p0","Pa",None,'d',p0)
+-print 'zfact',myaxes2[1]
++print('zfact',myaxes2[1])
+ myvars[3] = cmor.zfactor(int(myaxes2[1]),"b","",myaxes2[1],'d',b_coeff,b_coeff_bnds)
+-print 'zfact',myaxes2[1]
++print('zfact',myaxes2[1])
+ myvars[3] = cmor.zfactor(int(myaxes2[1]),"a","",myaxes2[1],'d',a_coeff,a_coeff_bnds)
+ #/* printf("defining ap\n"); */
+ #/* for(i=0;i<5;i++) {a_coeff[i]*=1.e3;printf("sending acoef: %i, %lf\n",i,a_coeff[i]);} */
+ #/* for(i=0;i<6;i++) {a_coeff_bnds[i]*=1.e5;printf("sending acoef: %i, %lf\n",i,a_coeff_bnds[i]);} */
+ #/* ierr = cmor_zfactor(&myvars[3],myaxes2[1],"ap","hPa",1,&myaxes2[1],'d',&a_coeff,&a_coeff_bnds); */
+-print 'zfact before last'
++print('zfact before last')
+ myvars[3] = cmor.zfactor(zaxis_id = myaxes2[1],zfactor_name = "ps",units = "hPa",axis_ids = myaxes[:3],type = 'd')
+-print 'zfact last'
++print('zfact last')
+
+ # /* ok here we decalre a variable for region axis testing */
+ cmor.set_table(tables[0])
+@@ -125,7 +126,7 @@
+
+ for i in range(ntimes):
+ data2d = read_2d_input_files(i, varin2d[0], lat,lon)
+- print 'writing time: ',i,data2d.shape,data2d
++ print('writing time: ',i,data2d.shape,data2d)
+ cmor.write(myvars[0],data2d,1)
+
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_user_interface_01.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_user_interface_01.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_user_interface_01.py 2013-06-13 19:47:29.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ from test_python_common import * # common subroutines
+
+ import cmor._cmor
+@@ -41,7 +42,7 @@
+ a = cmor.load_table("Tables/CMIP5_grids")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP5_Amon"))
+-print 'Tables ids:',tables
++print('Tables ids:',tables)
+
+ cmor.set_table(tables[0])
+
+@@ -61,7 +62,7 @@
+ longitude = lon_coords,
+ latitude_vertices = lat_vertices,
+ longitude_vertices = lon_vertices)
+-print 'got grid_id:',grid_id
++print('got grid_id:',grid_id)
+ myaxes[2] = grid_id
+
+ mapnm = 'lambert_conformal_conic'
+@@ -91,7 +92,7 @@
+ )
+ for i in range(ntimes):
+ data2d = read_2d_input_files(i, varin2d[0], lat,lon)
+- print 'writing time: ',i,data2d.shape,data2d
+- print Time[i],bnds_time[2*i:2*i+2]
++ print('writing time: ',i,data2d.shape,data2d)
++ print(Time[i],bnds_time[2*i:2*i+2] )
+ cmor.write(myvars[0],data2d,1,time_vals=Time[i],time_bnds=bnds_time[2*i:2*i+2])
+ cmor.close()
+Index: cmor-2.8.3/Test/test_python_user_interface_03.py
+===================================================================
+--- cmor-2.8.3.orig/Test/test_python_user_interface_03.py 2013-06-13 17:09:53.000000000 +0100
++++ cmor-2.8.3/Test/test_python_user_interface_03.py 2013-06-13 19:48:37.000000000 +0100
+@@ -1,11 +1,12 @@
++from __future__ import print_functon
+ import numpy
+ import cmor
+
+-print 'Done importing'
++print('Done importing')
+ try:
+ import cdms2
+ except:
+- print "This test code needs cdms2 interface for i/0"
++ print("This test code needs cdms2 interface for i/0")
+ import sys
+ sys.exit()
+ import os
+@@ -44,7 +45,7 @@
+ id=cmor.axis(table_entry='latitude',units=ax.units,coord_vals=ax[:],cell_bounds=ax.getBounds())
+ else:
+ id=cmor.axis(table_entry=str(ax.id),units=ax.units,coord_vals=ax[:],cell_bounds=ax.getBounds())
+- print i,'units:',ax.units, ax[0]
++ print(i,'units:',ax.units, ax[0])
+ axes.append(id)
+ var = cmor.variable(table_entry = data.id,
+ units = data.units,
+@@ -84,13 +85,13 @@
+
+
+ for var in ['tas',]:
+- print 'Testing var:',var
++ print('Testing var:',var)
+ orders = ['tyx...','txy...','ytx...','yxt...','xyt...','xty...',]
+ for o in orders:
+- print '\tordering:',o
++ print('\tordering:',o)
+ data,data_ordered = read_input(var,order=o)
+ prep_cmor()
+- print data.shape
++ print(data.shape)
+ var_id = prep_var(data)
+ df = data.filled(data.missing_value)
+ cmor.write(var_id,df)
+@@ -100,8 +101,8 @@
+ if not numpy.allclose(s,data_ordered):
+ raise "Error reordering: %s"%o
+ else:
+- print 'order: %s, passed' % o
++ print('order: %s, passed' % o)
+ f.close()
+-print 'Done'
++print('Done')
+ #cmor.close()
+-print 'Finito'
++print('Finito')
diff --git a/debian/patches/shlib-link.patch b/debian/patches/shlib-link.patch
index d6ed3fc..e1530ea 100644
--- a/debian/patches/shlib-link.patch
+++ b/debian/patches/shlib-link.patch
@@ -29,7 +29,7 @@ Index: cmor-2.8.3/Makefile.in
+PIC_OBJS = $(patsubst %.c, %.pic_o, $(LIBSOURCES)) $(patsubst %.f90,%.pic_o, $(LIBFSOURCES))
+
+%.pic_o: %.c
-+ @CC@ @CPPFLAGS@ -fPIC -c -o $@ @DEBUG@ @MACROS@ @CFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @ZFLAGS@ $<
++ @CC@ @CPPFLAGS@ -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 - -fPIC -c -o $@ @DEBUG@ @MACROS@ @CFLAGS@ @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @ZFLAGS@ $<
+
+%.pic_o: %.f90
+ @FC@ -c -o $@ -fPIC @FCFLAGS@ @DEBUG@ @MACROS@ $<
--
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