[cmor] 05/10: refresh patches
Alastair McKinstry
mckinstry at moszumanska.debian.org
Mon Jul 31 06:35:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository cmor.
commit 5bcd6012ae67350e84255eeba8811162d7a02cb5
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Sat Jul 29 20:24:29 2017 +0100
refresh patches
---
debian/patches/cmor_ver.patch | 10 +-
debian/patches/destdir.patch | 12 +-
debian/patches/disable_tests.patch | 37 +-
debian/patches/makefile-fix.patch | 17 +-
debian/patches/pkgconfig.patch | 12 +-
debian/patches/python3.patch | 4763 ++++++++++++++++--------------------
debian/patches/shlib-link.patch | 30 +-
7 files changed, 2100 insertions(+), 2781 deletions(-)
diff --git a/debian/patches/cmor_ver.patch b/debian/patches/cmor_ver.patch
index 5291bb0..086c916 100644
--- a/debian/patches/cmor_ver.patch
+++ b/debian/patches/cmor_ver.patch
@@ -3,10 +3,10 @@ Description: Add symbol versioning file.
Last-Updated: 2013-06-11
Forwarded: no
-Index: cmor-3.1.2/cmor.ver
+Index: cmor-3.2.5/cmor.ver
===================================================================
--- /dev/null
-+++ cmor-3.1.2/cmor.ver
++++ cmor-3.2.5/cmor.ver
@@ -0,0 +1,7 @@
+CMOR_2.0.0 {
+ global:
@@ -15,10 +15,10 @@ Index: cmor-3.1.2/cmor.ver
+ Cd*;
+ local: *;
+};
-Index: cmor-3.1.2/configure.ac
+Index: cmor-3.2.5/configure.ac
===================================================================
---- cmor-3.1.2.orig/configure.ac
-+++ cmor-3.1.2/configure.ac
+--- cmor-3.2.5.orig/configure.ac
++++ cmor-3.2.5/configure.ac
@@ -23,7 +23,7 @@ esac
CMOR_VERSION=${PACKAGE_VERSION}" (commit: ${GIT_TAG})"
diff --git a/debian/patches/destdir.patch b/debian/patches/destdir.patch
index 7e97197..2282a7e 100644
--- a/debian/patches/destdir.patch
+++ b/debian/patches/destdir.patch
@@ -3,11 +3,11 @@ Description: Add DESTDIR support for installing.
Last-Updated: 2013-06-11
Forwarded: no
-Index: cmor-3.1.2/Makefile.in
+Index: cmor-3.2.5/Makefile.in
===================================================================
---- cmor-3.1.2.orig/Makefile.in
-+++ cmor-3.1.2/Makefile.in
-@@ -130,19 +130,19 @@ distclean: clean
+--- cmor-3.2.5.orig/Makefile.in
++++ cmor-3.2.5/Makefile.in
+@@ -133,19 +133,19 @@ distclean: clean
@echo "Completely cleaning [$(WHEREAMI)]..."
@rm -f $(DISTFILES)
install: cmor
@@ -39,10 +39,10 @@ Index: cmor-3.1.2/Makefile.in
backup: clean
@echo "Creating full backup tar file..."
@(cd ..; \
-@@ -159,7 +159,7 @@ test_C: cmor
- @rm -f test_cat_unique ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_unit_cat_unique.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDLDFLAGS@ @LDFLAGS@ -o test_unit_cat_unique @VERB@; ./test_unit_cat_unique @VERB@;
+@@ -166,7 +166,7 @@ endif
python:
@echo "Building Python interface"
+ @if [ ! -d "${PYTHONPATH}" ]; then mkdir -p ${PYTHONPATH}; fi
- @${PYTHONEXEC} setup.py install @CDATPREFIX@
+ @${PYTHONEXEC} setup.py install --prefix=${DESTDIR}${PREFIX}
test_a_python:
diff --git a/debian/patches/disable_tests.patch b/debian/patches/disable_tests.patch
index 970489a..f5c612f 100644
--- a/debian/patches/disable_tests.patch
+++ b/debian/patches/disable_tests.patch
@@ -3,11 +3,11 @@ Description: Disable broken tests
Last-Updated: 2016-12-19
Forwarded: no
-Index: cmor-3.2.1/Makefile.in
+Index: cmor-3.2.5/Makefile.in
===================================================================
---- cmor-3.2.1.orig/Makefile.in
-+++ cmor-3.2.1/Makefile.in
-@@ -256,7 +256,7 @@ test_fortran_old_cmor_tables: cmor Table
+--- cmor-3.2.5.orig/Makefile.in
++++ cmor-3.2.5/Makefile.in
+@@ -268,7 +268,7 @@ test_fortran_old_cmor_tables: cmor Table
@env TEST_NAME="main_prog" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@env TEST_NAME="test_any_from_asc_i" INPUT_FILE="Test/tas_mytest_3d_i.input" make test_case_old_cmor_tables
@env TEST_NAME="mytest_4d_r" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@@ -16,7 +16,7 @@ Index: cmor-3.2.1/Makefile.in
@env TEST_NAME="test_3h" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@env TEST_NAME="test_dimensionless" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@env TEST_NAME="test_fortran_example_00" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
-@@ -265,7 +265,7 @@ test_fortran_old_cmor_tables: cmor Table
+@@ -277,7 +277,7 @@ test_fortran_old_cmor_tables: cmor Table
@env TEST_NAME="test_region" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@env TEST_NAME="test_sigma" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@env TEST_NAME="test_singleton" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@@ -25,21 +25,12 @@ Index: cmor-3.2.1/Makefile.in
@env TEST_NAME="mytest_4d_r_big_array" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@env TEST_NAME="mytest_4d_d_big_array_2" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
@env TEST_NAME="mytest_4d_d_big_array_3" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
-@@ -292,7 +292,7 @@ test_fortran: cmor Tables
- @env TEST_NAME="main_prog" INPUT_FILE="Test/noinput" make test_case
- @env TEST_NAME="test_any_from_asc_i" INPUT_FILE="Test/tas_mytest_3d_i.input" make test_case
- @env TEST_NAME="mytest_4d_r" INPUT_FILE="Test/noinput" make test_case
-- @env TEST_NAME="rewrite_harvardf_data" INPUT_FILE="Test/noinput" make test_case
-+ # @env TEST_NAME="rewrite_harvardf_data" INPUT_FILE="Test/noinput" make test_case
- @env TEST_NAME="test_3h" INPUT_FILE="Test/noinput" make test_case
- @env TEST_NAME="test_dimensionless" INPUT_FILE="Test/noinput" make test_case
- @env TEST_NAME="test_fortran_example_00" INPUT_FILE="Test/noinput" make test_case
-@@ -300,7 +300,7 @@ test_fortran: cmor Tables
- @env TEST_NAME="test_station_data" INPUT_FILE="Test/noinput" make test_case
- @env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro.txt" make test_case
- @env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro_1.txt" make test_case
-- @env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro_2.txt" make test_case
-+ # @env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro_2.txt" make test_case
- @env TEST_NAME="test_cmor_grid_time_varying" INPUT_FILE="Test/alejandro.txt" make test_case
- @env TEST_NAME="test_cmor_grid_time_varying" INPUT_FILE="Test/alejandro_1.txt" make test_case
- @env TEST_NAME="test_region" INPUT_FILE="Test/noinput" make test_case
+@@ -312,7 +312,7 @@ test_fortran: cmor
+ env TEST_NAME="test_station_data" INPUT_FILE="Test/noinput" make test_case
+ env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro.txt" make test_case
+ env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro_1.txt" make test_case
+- env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro_2.txt" make test_case
++ # env TEST_NAME="test_cmor_grid_alejandro" INPUT_FILE="Test/alejandro_2.txt" make test_case
+ env TEST_NAME="test_cmor_grid_time_varying" INPUT_FILE="Test/alejandro.txt" make test_case
+ env TEST_NAME="test_cmor_grid_time_varying" INPUT_FILE="Test/alejandro_1.txt" make test_case
+ env TEST_NAME="test_region" INPUT_FILE="Test/noinput" make test_case
diff --git a/debian/patches/makefile-fix.patch b/debian/patches/makefile-fix.patch
index 6bf7863..ee9702e 100644
--- a/debian/patches/makefile-fix.patch
+++ b/debian/patches/makefile-fix.patch
@@ -3,11 +3,11 @@ Description: Need to ensure Tables is made before test_fortran is run
Last-Updated: 2010-10-26
Forwarded: no
-Index: cmor-3.1.2/Makefile.in
+Index: cmor-3.2.5/Makefile.in
===================================================================
---- cmor-3.1.2.orig/Makefile.in
-+++ cmor-3.1.2/Makefile.in
-@@ -239,7 +239,7 @@ test_case_old_cmor_tables:
+--- cmor-3.2.5.orig/Makefile.in
++++ cmor-3.2.5/Makefile.in
+@@ -251,7 +251,7 @@ test_case_old_cmor_tables:
ifeq (@MAKEDEPPYTHON@,python)
@env TEST_NAME="Test/check_results.py old_cmor_tables_${TEST_NAME}" make test_a_python
endif
@@ -16,12 +16,3 @@ Index: cmor-3.1.2/Makefile.in
@env TEST_NAME="test_any_from_asc" INPUT_FILE="Test/tas_3D_noreorder.input" make test_case_old_cmor_tables
@env TEST_NAME="test_any_from_asc" INPUT_FILE="Test/3D_txy.input" make test_case_old_cmor_tables
@env TEST_NAME="test_any_from_asc" INPUT_FILE="Test/3D_txy_split_lon.input" make test_case_old_cmor_tables
-@@ -275,7 +275,7 @@ test_fortran_old_cmor_tables: cmor
- @env TEST_NAME="test_lots_of_variables" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
- @env TEST_NAME="test_shrt_exp_nm_set_att_initi" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
- @env TEST_NAME="test_sophie" INPUT_FILE="Test/noinput" make test_case_old_cmor_tables
--test_fortran: cmor
-+test_fortran: cmor Tables
- @env TEST_NAME="test_any_from_asc" INPUT_FILE="Test/tas_3D_noreorder.input" make test_case
- @env TEST_NAME="test_any_from_asc" INPUT_FILE="Test/3D_txy.input" make test_case
- @env TEST_NAME="test_any_from_asc" INPUT_FILE="Test/3D_txy_split_lon.input" make test_case
diff --git a/debian/patches/pkgconfig.patch b/debian/patches/pkgconfig.patch
index bb7c165..c0b115a 100644
--- a/debian/patches/pkgconfig.patch
+++ b/debian/patches/pkgconfig.patch
@@ -3,10 +3,10 @@ Description: Add FFlags, includedir, fix for directories needed for C;
Last-Updated: 2013-06-10
Forwarded: no
-Index: cmor-3.1/cmor.pc.in
+Index: cmor-3.2.5/cmor.pc.in
===================================================================
--- /dev/null
-+++ cmor-3.1/cmor.pc.in
++++ cmor-3.2.5/cmor.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=${prefix}
@@ -21,11 +21,11 @@ Index: cmor-3.1/cmor.pc.in
+CFlags: -I${prefix}/include
+CFlags: -I${includedir} -I${includedir}/cdTime
+Requires: udunits netcdf ossp-uuid
-Index: cmor-3.1/configure.ac
+Index: cmor-3.2.5/configure.ac
===================================================================
---- cmor-3.1.orig/configure.ac
-+++ cmor-3.1/configure.ac
-@@ -182,7 +182,7 @@ if [ test ${with_uuidb} != "-yes" ] ; th
+--- cmor-3.2.5.orig/configure.ac
++++ cmor-3.2.5/configure.ac
+@@ -183,7 +183,7 @@ if [ test ${with_uuidb} != "-yes" ] ; th
UUIDFLAGS=""
fi
else
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index 0058a60..0ee9e57 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -1,40 +1,12 @@
Author: Alastair McKinstry <mckinstry at debian.org>
Description: Fixes needed to make code python2/3 compatible. NOTE: INCOMPLETE
-Last-Updated: 2016-12-19
+Last-Updated: 2017-07-29
Forwarded: no
-Index: cmor-3.2.1/Lib/git2svn.py
+Index: cmor-3.2.5/Lib/pywrapper.py
===================================================================
---- cmor-3.2.1.orig/Lib/git2svn.py
-+++ cmor-3.2.1/Lib/git2svn.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import os,sys
-
- svn=sys.argv[1]
-@@ -17,15 +18,15 @@ for l in git:
-
- 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-3.2.1/Lib/pywrapper.py
-===================================================================
---- cmor-3.2.1.orig/Lib/pywrapper.py
-+++ cmor-3.2.1/Lib/pywrapper.py
+--- cmor-3.2.5.orig/Lib/pywrapper.py
++++ cmor-3.2.5/Lib/pywrapper.py
@@ -1,9 +1,9 @@
import numpy
import os
@@ -48,692 +20,80 @@ Index: cmor-3.2.1/Lib/pywrapper.py
try:
import cdtime
-@@ -46,26 +46,26 @@ def time_varying_grid_coordinate(grid_id
- 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 type not 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)
-@@ -78,7 +78,7 @@ def _to_numpy(vals, message):
- 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
-
-@@ -102,32 +102,32 @@ def grid(axis_ids,latitude=None,longitud
- 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.ndim(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.ndim(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.ndim(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
- 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 :
-@@ -139,19 +139,19 @@ def grid(axis_ids,latitude=None,longitud
- latitude_vertices = _to_numpy(latitude_vertices, 'latitude_vertices')
-
- if numpy.ndim(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)"
-+ 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.ndim(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)
-@@ -159,10 +159,10 @@ def grid(axis_ids,latitude=None,longitud
- 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:
-@@ -170,9 +170,9 @@ def grid(axis_ids,latitude=None,longitud
- ## 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)
-@@ -191,27 +191,31 @@ def set_grid_mapping(grid_id,mapping_nam
- parameter_values :: array/list of parameter values in the same order of parameter_names (ignored if parameter_names is ditcionary)
- 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)
-+ try:
-+ if not isinstance(grid_id,(numpy.int32,int,long)):
-+ raise Exception("grid_id must be an integer: %s"%type(grid_id))
-+ except NameError:
-+ if not isinstance(grid_id,(numpy.int32,int)):
-+ 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 = []
+@@ -234,11 +234,11 @@ def set_grid_mapping(grid_id, mapping_na
+ pnms = []
pvals = []
punit = []
- for k in parameter_names.keys():
+ for k in list(parameter_names.keys()):
- pnams.append(k)
+ pnms.append(k)
val = parameter_names[k]
- if isinstance(val,dict):
+ if isinstance(val, dict):
- ks = val.keys()
+ ks = list(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)
-@@ -220,20 +224,20 @@ def set_grid_mapping(grid_id,mapping_nam
- 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)
-@@ -241,11 +245,11 @@ def set_grid_mapping(grid_id,mapping_nam
- 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)
-@@ -265,11 +269,11 @@ def axis(table_entry,units=None,length=N
- 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:
-@@ -296,10 +300,10 @@ def axis(table_entry,units=None,length=N
- 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.ndim(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())
-@@ -314,18 +318,18 @@ def axis(table_entry,units=None,length=N
-
- if cell_bounds is not None:
- if numpy.ndim(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.ndim(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
-
-@@ -334,7 +338,7 @@ def axis(table_entry,units=None,length=N
- 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'
-@@ -354,7 +358,7 @@ def axis(table_entry,units=None,length=N
-
- 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"
-
-@@ -369,26 +373,26 @@ def axis(table_entry,units=None,length=N
- 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 = ""
-
-@@ -401,18 +405,18 @@ def variable(table_entry,units,axis_ids,
- 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.ndim(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)
-
-@@ -432,13 +436,13 @@ def variable(table_entry,units,axis_ids,
- 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)
-
-@@ -448,14 +452,14 @@ def variable(table_entry,units,axis_ids,
- 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())
-@@ -472,10 +476,10 @@ def zfactor(zaxis_id,zfactor_name,units=
- 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.ndim(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
-@@ -484,9 +488,9 @@ def zfactor(zaxis_id,zfactor_name,units=
- 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)):
-@@ -500,7 +504,7 @@ def zfactor(zaxis_id,zfactor_name,units=
- 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:
-@@ -511,18 +515,18 @@ def zfactor(zaxis_id,zfactor_name,units=
- 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):
-@@ -534,19 +538,19 @@ def zfactor(zaxis_id,zfactor_name,units=
- 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.ndim(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.ndim(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')
-@@ -561,15 +565,15 @@ def write(var_id,data,ntimes_passed=None
- 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):
-@@ -583,7 +587,7 @@ def write(var_id,data,ntimes_passed=None
- 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:
-@@ -604,12 +608,12 @@ def write(var_id,data,ntimes_passed=None
- 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")
-
-
-@@ -619,7 +623,7 @@ def write(var_id,data,ntimes_passed=None
- 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)
-
-
-@@ -637,7 +641,7 @@ def write(var_id,data,ntimes_passed=None
- if goodshape[i]!=0:
- if sh[j]!=goodshape[i]:
- if goodshape[i]!=1:
-- raise Exception,"Error: your data shape (%s) does not match the expected variable shape (%s)\nCheck your variable dimensions before caling cmor_write" % (str(osh),str(ogoodshape))
-+ raise Exception("Error: your data shape (%s) does not match the expected variable shape (%s)\nCheck your variable dimensions before caling cmor_write" % (str(osh),str(ogoodshape)))
- j+=1
- elif ntimes_passed!=1:
- j+=1
-@@ -659,13 +663,13 @@ def write(var_id,data,ntimes_passed=None
- 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.ndim(time_bnds)>2:
-- raise Exception, "bounds rank cannot be greater than 2"
-+ raise Exception("bounds rank cannot be greater than 2")
- elif numpy.ndim(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)
-@@ -679,7 +683,7 @@ def write(var_id,data,ntimes_passed=None
- 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]])
-@@ -690,12 +694,12 @@ def write(var_id,data,ntimes_passed=None
- 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,ntimes_passed,time_vals,time_bnds,store_with)
-
-@@ -706,7 +710,7 @@ def _check_time_bounds_contiguous(time_b
- 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):
- '''
-@@ -731,21 +735,21 @@ def setup(inpath='.',netcdf_file_action=
- 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):
-@@ -754,9 +758,9 @@ def load_table(table):
- 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
-+## raise Exception("Error, the table you specified (%s) does not exists" % table)
- return _cmor.load_table(table)
-
- def dataset_json(rcfile):
-@@ -765,14 +769,14 @@ def dataset_json(rcfile):
- dataset_json(rcfile)
- """
- if not isinstance(rcfile,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
-+## raise Exception("Error, the table you specified (%s) does not exists" % table)
- return _cmor.dataset_json(rcfile)
-
- 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):
-@@ -785,7 +789,7 @@ def close(var_id=None,file_name=False, p
- [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-3.2.1/Test/check_results.py
-===================================================================
---- cmor-3.2.1.orig/Test/check_results.py
-+++ cmor-3.2.1/Test/check_results.py
-@@ -1,3 +1,4 @@
+ raise Exception(
+ "error parameter_names key '%s' dictionary does not contain both 'units' and 'value' keys" %
+Index: cmor-3.2.5/Test/check_results.py
+===================================================================
+--- cmor-3.2.5.orig/Test/check_results.py
++++ cmor-3.2.5/Test/check_results.py
+@@ -1,5 +1,6 @@
+-from out_files import out
+-from in_files import input_tables
+from __future__ import print_function
- from out_files import out
- from in_files import input_tables
- import sys,os
-@@ -10,7 +11,7 @@ test = os.path.split(test)[1]
- if test[-4:].lower()=='.f90':
- test=test[:-4]
++from .out_files import out
++from .in_files import input_tables
+ import sys
+ import os
--print 'Checking results for:',test
-+print('Checking results for:',test)
+@@ -11,7 +12,7 @@ test = os.path.split(test)[1]
+ if test[-4:].lower() == '.f90':
+ test = test[:-4]
- outfiles = out.get(test,[])
- intables = input_tables.get(test,['IPCC_test_table_A',])
-@@ -22,12 +23,12 @@ class CMORResultCheckError(Exception):
+-print 'Checking results for:', test
++print ('Checking results for:', test)
+
+ outfiles = out.get(test, [])
+ intables = input_tables.get(test, ['IPCC_test_table_A', ])
+@@ -24,12 +25,12 @@ class CMORResultCheckError(Exception):
nfiles = 0
--print 'files:',outfiles
-+print('files:',outfiles)
- gotfiles=[]
- missing=[]
+-print 'files:', outfiles
++print ('files:', outfiles)
+ gotfiles = []
+ missing = []
for f in outfiles:
if f is None:
- print 'No checking'
-+ prints('uNo checking')
++ print ('No checking')
sys.exit()
- tables=[]
+ tables = []
for t in intables:
-@@ -39,13 +40,13 @@ for f in outfiles:
+@@ -41,9 +42,9 @@ for f in outfiles:
if os.path.exists(fnm):
- nfiles+=1
+ 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 '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)
++ 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-3.2.1/setup.py.in
-===================================================================
---- cmor-3.2.1.orig/setup.py.in
-+++ cmor-3.2.1/setup.py.in
+Index: cmor-3.2.5/setup.py.in
+===================================================================
+--- cmor-3.2.5.orig/setup.py.in
++++ cmor-3.2.5/setup.py.in
@@ -1,3 +1,5 @@
+
+from __future__ import print_function # to be python2/python3 agnostic
import numpy
+ # do not push to master
from numpy.distutils.core import setup, Extension
- #from numpy.distutils.ccompiler import CCompiler
-@@ -40,12 +42,12 @@ for p in include_dirs:
+@@ -45,12 +47,12 @@ for p in include_dirs:
ld.append(p)
include_dirs=ld
@@ -752,145 +112,10 @@ Index: cmor-3.2.1/setup.py.in
setup (name = "CMOR",
version='3.2',
-Index: cmor-3.2.1/Test/cmor_speed_and_compression_02.py
-===================================================================
---- cmor-3.2.1.orig/Test/cmor_speed_and_compression_02.py
-+++ cmor-3.2.1/Test/cmor_speed_and_compression_02.py
-@@ -5,7 +5,7 @@ today = strftime("%Y%m%d", localtime())
- try:
- import cdms2
- except:
-- print "This test code needs cdms2 interface for i/0"
-+ print ("This test code needs cdms2 interface for i/0")
- sys.exit()
-
- cdms2.setNetcdfShuffleFlag(0)
-@@ -55,7 +55,7 @@ cmor.dataset(
-
- tables=[]
- tables.append(cmor.load_table("mytable"))
--print 'Tables ids:',tables
-+print('Tables ids:',tables)
-
-
- ## read in data, just one slice
-@@ -78,7 +78,7 @@ except:
- except:
- missing_value=None
-
--print 'Missing:',type(missing_value),missing_value
-+print('Missing:',type(missing_value),missing_value)
- #missing_value = -999.
- myaxes[0] = cmor.axis(table_entry = 'latitude',
- units = 'degrees_north',
-@@ -118,7 +118,7 @@ c0=st
- f=cdms2.open("Test/crap.nc","w")
- step=10
- for i in range(0,ntimes,step):
-- print 'Time:',i
-+ print('Time:',i)
- j1=i
- j2=i+step
- cmor.write(myvars[0],s[j1:j2].filled(),step,file_suffix="speed-comp-02")
-@@ -157,15 +157,15 @@ cmor.close()
- import cdtime,os
- ltime = cdtime.reltime(Tim[ntimes-1],Tim.units).tocomp()
- ftime = cdtime.reltime(Tim[0],Tim.units).tocomp()
--print ftime,ltime
--print (var,var,ftime.year,ftime.month,ltime.year,ltime.month)
-+print(ftime,ltime)
-+print((var,var,ftime.year,ftime.month,ltime.year,ltime.month))
- lcmor = os.stat("Test/IPCC_Fourth_Assessment/output/INSTITUTE_ID/pcmdi-09a/mon/REALM/%s/r1/%s_A1_pcmdi-09a_r1_%i%.2i-%i%.2i_speed-comp-02.nc" % (var,var,ftime.year,ftime.month,ltime.year,ltime.month))[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")
-@@ -180,7 +180,7 @@ dic[(level,shuffle)]=(float(lcmor)/float
- 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()
-Index: cmor-3.2.1/Test/cmor_speed_and_compression.py
-===================================================================
---- cmor-3.2.1.orig/Test/cmor_speed_and_compression.py
-+++ cmor-3.2.1/Test/cmor_speed_and_compression.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy,sys,os
- from time import localtime, strftime
- today = strftime("%Y%m%d", localtime())
-@@ -8,7 +9,7 @@ try:
- 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/O")
- sys.exit()
-
- if len(sys.argv)>1:
-@@ -41,7 +42,7 @@ cmor.dataset_json("Test/common_user_inpu
-
- tables=[]
- tables.append(cmor.load_table("mytable"))
--print 'Tables ids:',tables
-+print('Tables ids:',tables)
-
-
- ## read in data, just one slice
-@@ -89,7 +90,7 @@ mincdms=1000
- c0=st
- s2=s*1
- sh=list(s.shape)
--print 'shape:',sh
-+print('shape:',sh)
- sh.insert(0,1)
- s2=MV2.reshape(s2,sh)
- s2.setAxis(1,s.getLatitude())
-@@ -127,12 +128,12 @@ import cdtime,os
- ltime = cdtime.reltime(ntimes-1,'month since 1980').tocomp()
- #lcmor = os.stat("CMIP6/CMIP/CSIRO-BOM/NICAM/piControl/r1i1p1f1/Amon/tas/gn/v%s/tas_Amon_piControl_NICAM_r1i1p1f1_gn_198001-%i%.2i.nc" % (today,ltime.year,ltime.month))[6]
- lcmor = os.stat("CMIP6/ISMIP6/PCMDI/PCMDI-test-1-0/piControl-withism/r11i1p1f1/Amon/tas/gr/v%s/tas_Amon_piControl-withism_PCMDI-test-1-0_r11i1p1f1_gr_198001-%i%.2i.nc" % (today,ltime.year,ltime.month))[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")
-@@ -147,7 +148,7 @@ dic[(level,shuffle)]=(float(lcmor)/float
- 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()
-Index: cmor-3.2.1/Test/jamie_hybrid_height.py
+Index: cmor-3.2.5/Test/jamie_hybrid_height.py
===================================================================
---- cmor-3.2.1.orig/Test/jamie_hybrid_height.py
-+++ cmor-3.2.1/Test/jamie_hybrid_height.py
+--- cmor-3.2.5.orig/Test/jamie_hybrid_height.py
++++ cmor-3.2.5/Test/jamie_hybrid_height.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
@@ -898,549 +123,242 @@ Index: cmor-3.2.1/Test/jamie_hybrid_height.py
import cmor
import numpy
-@@ -36,22 +36,22 @@ def main():
+@@ -37,23 +37,23 @@ def main():
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
- print 'cmor.axis calls complete'
+ print ('cmor.axis calls complete')
- cmor.zfactor(axis_ids[3], 'b', '', axis_ids[3:4], 'd', [0., 0.5], [[0., 0.25], [0.25, 1.]])
- cmor.zfactor(axis_ids[3], 'orog', 'm', axis_ids[1:3], 'd', [[0.]])
+ cmor.zfactor(axis_ids[3], 'b', '', axis_ids[3:4],
+ 'd', [0., 0.5], [[0., 0.25], [0.25, 1.]])
+ cmor.zfactor(axis_ids[3], 'orog', 'm', axis_ids[1:3], 'd', [[0.]])
- print 'cmor.zfactor calls complete'
+ print ('cmor.zfactor calls complete')
varid = cmor.variable('ua',
'm s-1',
axis_ids,
- missing_value = -99
+ missing_value=-99
)
- print 'cmor.variable call complete'
+ print ('cmor.variable call complete')
-
- cmor.write(varid, values, time_vals = [6.0], time_bnds = [3., 12.])
+
+ cmor.write(varid, values, time_vals=[6.0], time_bnds=[3., 12.])
- print 'cmor.write call complete'
+ print ('cmor.write call complete')
cmor.close()
-
-Index: cmor-3.2.1/Test/nc2asc.py
-===================================================================
---- cmor-3.2.1.orig/Test/nc2asc.py
-+++ cmor-3.2.1/Test/nc2asc.py
-@@ -1,5 +1,5 @@
- #!/usr/bin/env python
--
-+from __future__ import print_function
- import cdms2,sys, genutil
- cdms2.setAutoBounds('on')
-
-@@ -20,18 +20,18 @@ else:
- f=cdms2.open(fnm)
-
- ntimes= 3
--print 'var:',var
-+print('var:',var)
- #s=f(var,time=slice(0,3),latitude=(-20,20),order=order,squeeze=1)
- if order is not None:
- if order.find('z')>-1:
- s=f(var,time=slice(0,ntimes),order=order,squeeze=1,longitude=(-180,180,'con'),level=slice(5,12))
-- print s.getLevel()[:]
-+ print(s.getLevel()[:])
- else:
- s=f(var,time=slice(0,ntimes),order=order,squeeze=1,longitude=(-180,180,'con'))
- else:
- s=f(var,time=slice(0,ntimes),squeeze=1)
- #s=s[:,::4,::4]
--print 'Read in',s.shape
-+print('Read in',s.shape)
- try:
- p=s.getLevel()
- p.id='pressure'
-@@ -44,41 +44,41 @@ f.close()
- f=open(fout,'w')
-
- ndim=s.rank()
--print 'Dumping'
--print >>f, s.id
--print >>f, s.units
--print >>f, ndim
-+print('Dumping')
-+print(s.id, file=f)
-+print(s.units, file=f)
-+print(ndimi, file=f)
-
- for i in range(ndim):
- ax=s.getAxis(i)
-- print >>f, len(ax)
-+ print(len(ax), file=f)
-
- for i in range(ndim):
- ax=s.getAxis(i)
- if ax.isLatitude():
-- print >>f, 'latitude'
-+ print('latitude', file=f)
- elif ax.isLongitude():
-- print >>f,'longitude'
-+ print('longitude', file=f)
- else:
-- print >>f, ax.id
-- print >>f, ax.units
-- print ax.id
-- print ax.units
-+ print(ax.id, file=f)
-+ print(ax.units, file=f)
-+ print(ax.id)
-+ print(ax.units)
- for j in ax[:]:
-- print >>f, j,
-- print >>f
-+ print(j, file=f)
-+ print(file=f)
- for j in ax.getBounds().flat[:]:
-- print >>f, j,
-- print >>f
-+ print(j, file=f)
-+ print(file=f)
- f.flush()
-
- s=s.filled(120).astype(type)
- s=s.flat
- j=0
- for i in s[:]:
-- print >>f, i,
-+ print(i, file=f)
- j+=1
--print >>f
--print j,s[-1]
-+print(file=f)
-+print(j,s[-1])
-
- f.close()
-Index: cmor-3.2.1/Test/test_compression.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_compression.py
-+++ cmor-3.2.1/Test/test_compression.py
-@@ -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
-@@ -34,12 +35,12 @@ for ax in Saxes[1:]:
- #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)
-@@ -48,7 +49,7 @@ sh[0]=nt
- s=numpy.resize(s,sh)
- #s=numpy.where(numpy.greater(s,100.),100,s)
- s=numpy.random.random(s.shape)*10000.
--print s.shape
-+print (s.shape)
- cmor.write(var_id1,s)
- cmor.close(var_id1)
- cmor.write(var_id2,s)
-Index: cmor-3.2.1/Test/test_grid_stub_jamie.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_grid_stub_jamie.py
-+++ cmor-3.2.1/Test/test_grid_stub_jamie.py
-@@ -71,7 +71,7 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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 @@ class TestGridCallErrors(unittest.TestCa
- 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-3.2.1/Test/test_python_2Gb_file.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_2Gb_file.py
-+++ cmor-3.2.1/Test/test_python_2Gb_file.py
-@@ -1,4 +1,4 @@
--
-+from __future__ import print_function
- import cmor,numpy
-
-
-@@ -36,12 +36,12 @@ ntimes=250
- 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-3.2.1/Test/test_python_2Gb_slice.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_2Gb_slice.py
-+++ cmor-3.2.1/Test/test_python_2Gb_slice.py
-@@ -1,4 +1,4 @@
--
-+from __future__ import print_function
- import cmor,numpy
-
-
-@@ -20,7 +20,7 @@ blons = numpy.arange(0,360.+dlon,dlon)
-
- 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,.5,.1])
- alllevs = numpy.arange(1000,0,-dlev).tolist()
--print len(alllevs)
-+print(len(alllevs))
-
- cmor.setup(inpath='Tables', netcdf_file_action=cmor.CMOR_REPLACE)
- cmor.dataset_json("Test/common_user_input.json")
-@@ -37,19 +37,19 @@ axes=[itim,ilev,ilat,ilon]
-
- var = cmor.variable(table_entry='ta',units='K',axis_ids=axes)
-
--print "allocating mem for data"
-+print ("allocating mem for data")
- data = numpy.random.random((nlev,nlat,nlon))*30+273.15
--print "moving on to writing"
-+print ("moving on to writing")
-
- for i in range(ntimes):
-- print 'Writing time:',i
-+ print ('Writing time:',i)
- cmor.write(var,data,time_vals=numpy.array([float(i),]),time_bnds=numpy.array([i,i+1.]))
--print "closing var"
--print cmor.close(var_id=var,file_name=True)
--print "closing cmor"
-+print ("closing var")
-+print (cmor.close(var_id=var,file_name=True))
-+print ("closing cmor")
- cmor.close()
--print "done"
-+print ("done")
-
-
--print 'hello'
-+print ('hello')
-Index: cmor-3.2.1/Test/test_python_3hr.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_3hr.py
-+++ cmor-3.2.1/Test/test_python_3hr.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy
-
- error_flag = cmor.setup(inpath='Tables', netcdf_file_action=cmor.CMOR_REPLACE)
-@@ -22,7 +23,7 @@ iloc = cmor.axis("location",units="1",co
-
- 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-3.2.1/Test/test_python_appending.py
+Index: cmor-3.2.5/Test/test_python_appending.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_appending.py
-+++ cmor-3.2.1/Test/test_python_appending.py
+--- cmor-3.2.5.orig/Test/test_python_appending.py
++++ cmor-3.2.5/Test/test_python_appending.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
- import cmor,numpy
+ import cmor
+ import numpy
- nlat = 90
-@@ -13,7 +14,7 @@ def mywrite(data = None, time_vals = Non
- bnds_req=numpy.array(bnds_req)
- bnds_req.shape=(7,2)
+@@ -15,7 +16,7 @@ def mywrite(data=None, time_vals=None, a
+ 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=[]
+ levs = []
-@@ -22,14 +23,14 @@ def mywrite(data = None, time_vals = Non
+@@ -24,14 +25,14 @@ def mywrite(data=None, time_vals=None, a
- levs=numpy.array(levs)
+ levs = numpy.array(levs)
- print levs
-+ print(levs)
++ print (levs)
- ipth="Test"
+ 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)
+- print 'Mode in python:', mode
++ print ('Mode in python:', mode)
cmor.setup(inpath=ipth,
set_verbosity=cmor.CMOR_NORMAL,
- netcdf_file_action = mode,
-@@ -54,22 +55,22 @@ def mywrite(data = None, time_vals = Non
- #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="plev19",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)
+ netcdf_file_action=mode,
+@@ -64,7 +65,7 @@ def mywrite(data=None, time_vals=None, a
+ 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="plev19", coord_vals=plevs, units="Pa")
+
+ iv = cmor.variable(
+@@ -73,21 +74,21 @@ def mywrite(data=None, time_vals=None, a
+
+ # 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")
+- print 'time:', time_vals
+- print 'bnds:', cell_bounds
++ print ('time:', time_vals)
++ print ('bnds:', cell_bounds)
+ # ,file_suffix="with-appending")
+ cmor.write(iv, data, time_vals=time_vals, time_bnds=cell_bounds)
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 '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)
+ file = cmor.close(iv, file_name=True)
+- print 'Ok dumped to:', file
++ print ('Ok dumped to:', file)
cmor.close()
return file
-@@ -79,6 +80,6 @@ data = numpy.random.random((ntime,19,nla
+@@ -98,7 +99,7 @@ data = numpy.random.random((ntime, 19, n
-
- 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)
+ 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-3.2.1/Test/test_python_bad_date.py
++print (f2)
+Index: cmor-3.2.5/Test/test_python_bad_date.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_bad_date.py
-+++ cmor-3.2.1/Test/test_python_bad_date.py
+--- cmor-3.2.5.orig/Test/test_python_bad_date.py
++++ cmor-3.2.5/Test/test_python_bad_date.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor
import numpy
-@@ -22,16 +23,16 @@ def setup_data():
+@@ -24,16 +25,16 @@ def setup_data():
tbnds = list(tvals)
tbnds.append(43200)
- tbnds=numpy.array(tbnds)-3.
-- print "tvals:",tvals
-- print "tbnds:",tbnds
-+ print("tvals:",tvals)
-+ print("tbnds:",tbnds)
+ 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 @@ def main():
+ 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,
+@@ -87,7 +88,7 @@ def main():
cmor_initialisation()
- values,axes = setup_data()
+ 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__':
+- print cmor.close(var_id=vid, file_name=True)
++ print (cmor.close(var_id=vid, file_name=True))
+
-Index: cmor-3.2.1/Test/test_python_bentley_01.py
+ if __name__ == '__main__':
+Index: cmor-3.2.5/Test/test_python_bentley_01.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_bentley_01.py
-+++ cmor-3.2.1/Test/test_python_bentley_01.py
+--- cmor-3.2.5.orig/Test/test_python_bentley_01.py
++++ cmor-3.2.5/Test/test_python_bentley_01.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor
import numpy
import cdtime
-@@ -26,7 +27,7 @@ def setup_data():
- '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 @@ def cmor_define_and_write(values, axes):
+@@ -28,7 +29,7 @@ def setup_data():
+ '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)],
+ },
+ ]
+@@ -48,7 +49,7 @@ def cmor_define_and_write(values, axes):
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 @@ def cmor_define_and_write(values, axes):
- 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])
+ 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],
+@@ -65,7 +66,7 @@ def cmor_define_and_write(values, axes):
+ 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 @@ def main():
+@@ -76,7 +77,7 @@ def main():
values, axes = setup_data()
varid = cmor_define_and_write(values, axes)
- fname = cmor.close(varid, file_name = True)
-- print "Done:",fname
-+ print("Done:",fname)
+ fname = cmor.close(varid, file_name=True)
+- print "Done:", fname
++ print ("Done:", fname)
+
-
if __name__ == '__main__':
-Index: cmor-3.2.1/Test/test_python_bounds_request.py
+Index: cmor-3.2.5/Test/test_python_bounds_request.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_bounds_request.py
-+++ cmor-3.2.1/Test/test_python_bounds_request.py
+--- cmor-3.2.5.orig/Test/test_python_bounds_request.py
++++ cmor-3.2.5/Test/test_python_bounds_request.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
- import cmor,numpy
+ import cmor
+ import numpy
- breq = "100000. 80000. 80000. 68000. 68000. 56000. 56000. 44000. 44000. 31000. 31000. 18000. 18000. 0.".split()
-@@ -9,7 +10,7 @@ for b in breq:
- bnds_req=numpy.array(bnds_req)
- bnds_req.shape=(7,2)
+@@ -10,7 +11,7 @@ for b in breq:
+ 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=[]
+ levs = []
-@@ -18,7 +19,7 @@ for b in bnds_req:
+@@ -19,7 +20,7 @@ for b in bnds_req:
- levs=numpy.array(levs)
+ levs = numpy.array(levs)
-print levs
+print(levs)
cmor.setup(inpath="Tables",
set_verbosity=cmor.CMOR_NORMAL,
-@@ -44,8 +45,8 @@ data = numpy.random.random((ntime,7,nlat
- 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
+@@ -57,8 +58,8 @@ ilon = cmor.axis(
+ table_entry='longitude',
+ coord_vals=lons,
+ units='degrees_east')
+-print 'so far', itim, ilat, ilon
-print bnds_req
-+print ('so far',itim,ilat,ilon)
++print ('so far', itim, ilat, ilon)
+print (bnds_req)
- 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-3.2.1/Test/test_python_cfmip_site_axis_test.py
+ ilev = cmor.axis(
+ table_entry="pressure2",
+ coord_vals=levs,
+Index: cmor-3.2.5/Test/test_python_cfmip_site_axis_test.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_cfmip_site_axis_test.py
-+++ cmor-3.2.1/Test/test_python_cfmip_site_axis_test.py
+--- cmor-3.2.5.orig/Test/test_python_cfmip_site_axis_test.py
++++ cmor-3.2.5/Test/test_python_cfmip_site_axis_test.py
@@ -28,6 +28,7 @@ variables:
lev:formula_terms = "a: lev b: b orog: orog";
...
@@ -1449,428 +367,236 @@ Index: cmor-3.2.1/Test/test_python_cfmip_site_axis_test.py
import cmor
import numpy
-@@ -57,41 +58,41 @@ if __name__ == '__main__' :
- # Create CMOR axes and grids
- table_id = cmor.load_table('CMIP6_cfSites.json')
- 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 CMIP6_grids the current MIP table for this to work.
- table_id = cmor.load_table('CMIP6_grids.json')
- 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('CMIP6_cfSites.json')
- 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-3.2.1/Test/test_python_clim_bounds.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_clim_bounds.py
-+++ cmor-3.2.1/Test/test_python_clim_bounds.py
+@@ -61,10 +62,10 @@ if __name__ == '__main__':
+ table_id = cmor.load_table('CMIP6_CFsubhr.json')
+ # , length=1, interval='30 minutes')
+ taxis_id = cmor.axis('time1', units='days since 2000-01-01 00:00:00')
+- 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',
+@@ -73,36 +74,36 @@ if __name__ == '__main__':
+ 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 CMIP6_grids the current MIP table for this to work.
+ table_id = cmor.load_table('CMIP6_grids.json')
+ 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('CMIP6_CFsubhr.json')
+ 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-3.2.5/Test/test_python_clim_bounds.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_clim_bounds.py
++++ cmor-3.2.5/Test/test_python_clim_bounds.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import cmor
import numpy
-@@ -37,7 +38,7 @@ def main():
+@@ -38,7 +39,7 @@ def main():
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print('doing:',axis)
+- print 'doing:', axis
++ print ('doing:', axis)
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
-Index: cmor-3.2.1/Test/test_python_clim_bounds_02.py
+Index: cmor-3.2.5/Test/test_python_clim_bounds_02.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_clim_bounds_02.py
-+++ cmor-3.2.1/Test/test_python_clim_bounds_02.py
+--- cmor-3.2.5.orig/Test/test_python_clim_bounds_02.py
++++ cmor-3.2.5/Test/test_python_clim_bounds_02.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import cmor
import numpy
-@@ -50,7 +51,7 @@ def main():
+@@ -51,7 +52,7 @@ def main():
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print('doing:',axis)
+- print 'doing:', axis
++ print ('doing:', axis)
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
-Index: cmor-3.2.1/Test/test_python_clim_bounds_03.py
+Index: cmor-3.2.5/Test/test_python_clim_bounds_03.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_clim_bounds_03.py
-+++ cmor-3.2.1/Test/test_python_clim_bounds_03.py
+--- cmor-3.2.5.orig/Test/test_python_clim_bounds_03.py
++++ cmor-3.2.5/Test/test_python_clim_bounds_03.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import cmor
import numpy
-@@ -50,7 +51,7 @@ def main():
+@@ -51,7 +52,7 @@ def main():
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print('doing:',axis)
+- print 'doing:', axis
++ print ('doing:', axis)
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
-@@ -62,7 +63,7 @@ def main():
- history = 'variable history',
- missing_value = -99
+@@ -66,7 +67,7 @@ def main():
+ history='variable history',
+ missing_value=-99
)
- print values.shape
-+ print(values.shape)
-
- cmor.write(varid, values)#, ntimes_passed=1)
++ print (values.shape)
-Index: cmor-3.2.1/Test/test_python_clim_bounds_04.py
+ cmor.write(varid, values) # , ntimes_passed=1)
+
+Index: cmor-3.2.5/Test/test_python_clim_bounds_04.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_clim_bounds_04.py
-+++ cmor-3.2.1/Test/test_python_clim_bounds_04.py
+--- cmor-3.2.5.orig/Test/test_python_clim_bounds_04.py
++++ cmor-3.2.5/Test/test_python_clim_bounds_04.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import cmor
import numpy
-@@ -50,7 +51,7 @@ def main():
- [45959, 52925]],}
+@@ -51,7 +52,7 @@ def main():
+ [45959, 52925]], }
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print('doing:',axis)
+- print 'doing:', axis
++ print ('doing:', axis)
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
-Index: cmor-3.2.1/Test/test_python_YYYMMDDHH_exp_fmt.py
+Index: cmor-3.2.5/Test/test_python_YYYMMDDHH_exp_fmt.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_YYYMMDDHH_exp_fmt.py
-+++ cmor-3.2.1/Test/test_python_YYYMMDDHH_exp_fmt.py
+--- cmor-3.2.5.orig/Test/test_python_YYYMMDDHH_exp_fmt.py
++++ cmor-3.2.5/Test/test_python_YYYMMDDHH_exp_fmt.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor
- def path_test():
-@@ -30,7 +31,7 @@ def path_test():
+
+@@ -31,7 +32,7 @@ def path_test():
cmor.write(varid, [273])
- path=cmor.close(varid, file_name=True)
+ path = cmor.close(varid, file_name=True)
+
+- print "Saved file: ", path
++ print ("Saved file: ", path)
-- print "Saved file: ",path
-+ print("Saved file: ",path)
if __name__ == '__main__':
- path_test()
-Index: cmor-3.2.1/Test/test_python_direct_calls.py
+Index: cmor-3.2.5/Test/test_python_jamie_10.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_direct_calls.py
-+++ cmor-3.2.1/Test/test_python_direct_calls.py
-@@ -1,3 +1,4 @@
+--- cmor-3.2.5.orig/Test/test_python_jamie_10.py
++++ cmor-3.2.5/Test/test_python_jamie_10.py
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
+from __future__ import print_function
- from test_python_common import * # common subroutines
- import cmor._cmor
- import os
-@@ -19,7 +20,7 @@ tables=[]
- a = cmor._cmor.load_table("Tables/CMIP6_Omon.json")
- tables.append(a)
- tables.append(cmor._cmor.load_table("Tables/CMIP6_Amon.json"))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
+ import cmor
+ import numpy
- axes=[]
-@@ -35,7 +36,7 @@ units="degrees_east"
- myaxes[2] = cmor._cmor.axis(id,units,lon,alons,'d',bnds_lon,2,interval)
- id="plev19"
- 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)
+@@ -29,7 +30,7 @@ def main():
+ axis_ids = list()
+ for axis in axes:
+- print 'doing:', axis
++ print ('doing:', axis)
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
-@@ -62,31 +63,31 @@ myaxes2[1] = myaxes[3];
- myaxes2[2] = myaxes[1];
- myaxes2[3] = myaxes[2];
+Index: cmor-3.2.5/Test/test_python_jamie_12.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_jamie_12.py
++++ cmor-3.2.5/Test/test_python_jamie_12.py
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import print_function
+ import cmor
+ import numpy
--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,"down",varin3d[2],"no history","no future")
--print 'vars 2'
-+print ('vars 2')
+@@ -10,7 +10,7 @@ def define_axes(axes):
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
- myaxes2[1] = myaxes[4];
- myvars[2] = cmor._cmor.variable(entry3d[0],units3d[0],4,myaxes2,'d',None,dtmp2,"down",varin3d[0],"no history","no future")
+- print 'MY:cmor.axis calls complete'
++ print('MY:cmor.axis calls complete')
+ return axis_ids
--print 'vars 2'
-+print ('vars 2')
--print 'zfact',type(numpy.array(myaxes2[1])),type(myaxes2)
-+print ('zfact',type(numpy.array(myaxes2[1])),type(myaxes2))
+Index: cmor-3.2.5/Test/test_python_jamie_2.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_jamie_2.py
++++ cmor-3.2.5/Test/test_python_jamie_2.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
- 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])
-@@ -101,7 +102,7 @@ cmor.set_table(tables[1])
+@@ -26,15 +27,15 @@ def multi_call_test():
+ 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")
+ except BaseException:
+- 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')
- 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-3.2.1/Test/test_python_grid_and_ocn_sigma.py
+ if __name__ == '__main__':
+Index: cmor-3.2.5/Test/test_python_jamie_8.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_grid_and_ocn_sigma.py
-+++ cmor-3.2.1/Test/test_python_grid_and_ocn_sigma.py
-@@ -1,4 +1,4 @@
--
-+from __future__ import print_function
- import cmor,numpy
- import os
- ntimes=2
-@@ -43,7 +43,7 @@ def gen_irreg_grid(lon,lat):
- 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
-
-
-@@ -61,12 +61,12 @@ tables=[]
- a = cmor.load_table("CMIP6_grids.json")
- tables.append(a)
- tables.append(cmor.load_table("CMIP6_Omon.json"))
--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',
-@@ -75,13 +75,13 @@ myaxes[0] = cmor.axis(table_entry = 'x',
- 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'
-@@ -102,19 +102,19 @@ myaxes[3] = cmor.axis(table_entry = 'tim
- # 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,
-@@ -129,8 +129,8 @@ for i in range(ntimes):
- 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-3.2.1/Test/test_python_index_coord.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_index_coord.py
-+++ cmor-3.2.1/Test/test_python_index_coord.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy
-
- ipth="Test"
-@@ -41,4 +42,4 @@ iv = cmor.variable(table_entry='thetao',
- cmor.write(iv,data)
-
- f1 = cmor.close(iv,file_name=True)
--print f1
-+print(f1)
-Index: cmor-3.2.1/Test/test_python_jamie_10.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_10.py
-+++ cmor-3.2.1/Test/test_python_jamie_10.py
-@@ -1,4 +1,5 @@
- #!/usr/bin/env python
-+from __future__ import print_function
- import cmor
- import numpy
-
-@@ -29,7 +30,7 @@ def main():
-
- 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-3.2.1/Test/test_python_jamie_12.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_12.py
-+++ cmor-3.2.1/Test/test_python_jamie_12.py
-@@ -1,5 +1,5 @@
- #!/usr/bin/env python
--
-+from __future__ import print_function
- import cmor
- import numpy
-
-@@ -9,7 +9,7 @@ def define_axes(axes):
- 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-3.2.1/Test/test_python_jamie_2.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_2.py
-+++ cmor-3.2.1/Test/test_python_jamie_2.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor
-
- def multi_call_test():
-@@ -25,15 +26,15 @@ def multi_call_test():
- 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-3.2.1/Test/test_python_jamie_6.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_6.py
-+++ cmor-3.2.1/Test/test_python_jamie_6.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy
-
- error_flag = cmor.setup(inpath='Test', netcdf_file_action=cmor.CMOR_REPLACE)
-@@ -91,7 +92,7 @@ if table_entry == 'hybrid_height':
- 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-3.2.1/Test/test_python_jamie_8.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_8.py
-+++ cmor-3.2.1/Test/test_python_jamie_8.py
+--- cmor-3.2.5.orig/Test/test_python_jamie_8.py
++++ cmor-3.2.5/Test/test_python_jamie_8.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
@@ -1878,7 +604,7 @@ Index: cmor-3.2.1/Test/test_python_jamie_8.py
import cmor
import numpy
-@@ -9,7 +9,7 @@ def define_axes(axes):
+@@ -10,7 +10,7 @@ def define_axes(axes):
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
@@ -1886,360 +612,108 @@ Index: cmor-3.2.1/Test/test_python_jamie_8.py
+ print('cmor.axis calls complete')
return axis_ids
- def define_write_var(axis_ids, entry, unit, values):
-@@ -19,11 +19,11 @@ def define_write_var(axis_ids, entry, un
- missing_value = -99
+
+@@ -21,11 +21,11 @@ def define_write_var(axis_ids, entry, un
+ 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.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')
++ print ('cmor.write call complete')
def cmor_ini():
-Index: cmor-3.2.1/Test/test_python_jamie_9.py
+Index: cmor-3.2.5/Test/test_python_jamie_9.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_9.py
-+++ cmor-3.2.1/Test/test_python_jamie_9.py
+--- cmor-3.2.5.orig/Test/test_python_jamie_9.py
++++ cmor-3.2.5/Test/test_python_jamie_9.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import cmor
import numpy
+@@ -16,7 +17,7 @@ def main():
+ },
+ {'table_entry': 'plev19',
+ 'units': 'Pa',
+- 'coord_vals': map(float, '100000. 92500. 85000. 70000. 60000. 50000. 40000. 30000. 25000. 20000. 15000. 10000. 7000. 5000. 3000. 2000. 1000. 500. 100.'.split(' '))},
++ 'coord_vals': list(map(float, '100000. 92500. 85000. 70000. 60000. 50000. 40000. 30000. 25000. 20000. 15000. 10000. 7000. 5000. 3000. 2000. 1000. 500. 100.'.split(' ')))},
+ {'table_entry': 'latitude',
+ 'units': 'degrees_north',
+ 'coord_vals': [0],
@@ -29,7 +30,7 @@ def main():
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print('doing:',axis)
+- print 'doing:', axis
++ print ('doing:', axis)
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
-Index: cmor-3.2.1/Test/test_python_jamie_site_surface.py
+Index: cmor-3.2.5/Test/test_python_jamie_site_surface.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_site_surface.py
-+++ cmor-3.2.1/Test/test_python_jamie_site_surface.py
+--- cmor-3.2.5.orig/Test/test_python_jamie_site_surface.py
++++ cmor-3.2.5/Test/test_python_jamie_site_surface.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor
import numpy
-@@ -46,7 +47,7 @@ def main():
+@@ -52,7 +53,7 @@ def main():
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-3.2.1/Test/test_python_joerg_10.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_10.py
-+++ cmor-3.2.1/Test/test_python_joerg_10.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- from test_python_common import * # common subroutines
-
- import cmor._cmor
-@@ -24,7 +25,7 @@ tables=[]
- a = cmor.load_table("Tables/CMIP6_grids.json")
- tables.append(a)
- tables.append(cmor.load_table("Tables/CMIP6_Omon.json"))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
- cmor.set_table(tables[0])
-
-@@ -45,7 +46,7 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- 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'
-@@ -70,7 +71,7 @@ myaxes[3] = cmor.axis(table_entry = 'tim
-
- pass_axes = [myaxes[3],myaxes[4],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,
-@@ -88,9 +89,9 @@ for i in range(0,ntimes,2):
- data2d=numpy.array((data2d_1,data2d_2))
- #data2d=numpy.expand_dims(data2d, axis=0)
- #print data2d.shape
-- print 'writing time: ',i
-- print data2d.shape
-- print data2d
-- print Time[i:i+2],bnds_time[2*i:2*i+4]
-+ print ('writing time: ',i)
-+ print (data2d.shape)
-+ print (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-3.2.1/Test/test_python_joerg_11.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_11.py
-+++ cmor-3.2.1/Test/test_python_joerg_11.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- from test_python_common import * # common subroutines
-
- import cmor._cmor
-@@ -18,7 +19,7 @@ tables=[]
- a = cmor.load_table("Tables/CMIP6_grids.json")
- tables.append(a)
- tables.append(cmor.load_table("Tables/CMIP6_Omon.json"))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
- cmor.set_table(tables[0])
-
-@@ -38,7 +39,7 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- 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'
-@@ -62,7 +63,7 @@ myaxes[4] = cmor.axis(table_entry = 'oli
-
- 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,
-@@ -71,7 +72,7 @@ myvars[0] = cmor.variable( table_entry =
- )
- 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-3.2.1/Test/test_python_joerg_12.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_12.py
-+++ cmor-3.2.1/Test/test_python_joerg_12.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- from test_python_common import * # common subroutines
-
- import cmor._cmor
-@@ -22,7 +23,7 @@ tables=[]
- a = cmor.load_table("Tables/CMIP6_grids.json")
- tables.append(a)
- tables.append(cmor.load_table("Tables/CMIP6_Lmon.json"))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
- cmor.set_table(tables[0])
-
-@@ -42,7 +43,7 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- 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'
-@@ -66,7 +67,7 @@ myaxes[4] = cmor.axis(table_entry = 'veg
++ print( cmor.close(file_name=True))
- 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,
-@@ -75,7 +76,7 @@ myvars[0] = cmor.variable( table_entry =
- )
- 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-3.2.1/Test/test_python_joerg_2.py
+ if __name__ == '__main__':
+Index: cmor-3.2.5/Test/test_python_joerg_2.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_2.py
-+++ cmor-3.2.1/Test/test_python_joerg_2.py
+--- cmor-3.2.5.orig/Test/test_python_joerg_2.py
++++ cmor-3.2.5/Test/test_python_joerg_2.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import cmor
import numpy
-@@ -52,7 +53,7 @@ def test_mode(mode,i,suffix=''):
- 'coord_vals': levels},
- ]
-
-- values = numpy.array(range(len(levels)), numpy.float32)+195
-+ values = numpy.array(list(range(len(levels))), numpy.float32)+195
+@@ -52,7 +53,7 @@ def test_mode(mode, i, suffix=''):
+ '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)
-@@ -65,7 +66,7 @@ def test_mode(mode,i,suffix=''):
- history = 'variable history',
- missing_value = -99
+@@ -65,7 +66,7 @@ def test_mode(mode, i, suffix=''):
+ history='variable history',
+ missing_value=-99
)
-- print "Sending time bounds:",[[i,i+1]]
-+ print ("Sending time bounds:",[[i,i+1]])
- cmor.write(varid, values, time_vals = [i], time_bnds = [ [i,i+1] ])
-
- fnm = cmor.close(varid,file_name=True)
-@@ -74,7 +75,7 @@ def test_mode(mode,i,suffix=''):
-
- fnm=''
+- print "Sending time bounds:", [[i, i + 1]]
++ print ("Sending time bounds:", [[i, i + 1]])
+ cmor.write(varid, values, time_vals=[i], time_bnds=[[i, i + 1]])
+
+ fnm = cmor.close(varid, file_name=True)
+@@ -75,7 +76,7 @@ def test_mode(mode, i, suffix=''):
+
+ fnm = ''
for i in range(5):
-- print i,fnm
-+ print(i,fnm)
- if i==0:
+- print i, fnm
++ print (i, fnm)
+ if i == 0:
mode = cmor.CMOR_REPLACE
else:
-Index: cmor-3.2.1/Test/test_python_joerg_3.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_3.py
-+++ cmor-3.2.1/Test/test_python_joerg_3.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy
-
- ntimes=1
-@@ -107,27 +108,27 @@ for d in range(2):
- for i in range(4):
- tval = [i/4.+d]
- tbnd = [i/4.+d-0.125,i/4.+d+0.125]
-- print 'tvar',tval
-- print 'tbnd',tbnd
-- print 'writing time:',i,i/4.
-+ print ('tvar',tval)
-+ print ('tbnd',tbnd)
-+ print ('writing time:',i,i/4.)
- data=numpy.random.random((ntimes,nlev,nlat,nlon))*30.+273
- data=data.astype("f")
- cmor.write(ivar1,data,time_vals=tval,time_bnds=tbnd)
-- 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)
-- 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)
- file1=cmor.close(ivar1,True)
- file2=cmor.close(ivar2,True)
-- print 'File1:',file1
-- print 'File2:',file2
-+ print ('File1:',file1)
-+ print ('File2:',file2)
- cmor.close()
--print cmor.close(ivar1,True)
-+print (cmor.close(ivar1,True))
- cmor.close()
-Index: cmor-3.2.1/Test/test_python_joerg_8.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_8.py
-+++ cmor-3.2.1/Test/test_python_joerg_8.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- from test_python_common import * # common subroutines
-
- import cmor._cmor
-@@ -22,7 +23,7 @@ tables=[]
- a = cmor.load_table("Tables/CMIP6_grids.json")
- tables.append(a)
- tables.append(cmor.load_table("Tables/CMIP6_Omon.json"))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
- cmor.set_table(tables[0])
-
-@@ -42,7 +43,7 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- 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'
-@@ -63,7 +64,7 @@ myaxes[3] = cmor.axis(table_entry = 'tim
-
- pass_axes = [myaxes[3],myaxes[2]]
-
--print 'ok going to cmorvar'
-+print ('ok going to cmorvar')
- myvars[0] = cmor.variable( table_entry = 'exparag100',
- units = 'mol m-2 s-1',
- axis_ids = pass_axes,
-@@ -74,7 +75,7 @@ myvars[0] = cmor.variable( table_entry =
- )
- 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-3.2.1/Test/test_python_joerg_9.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_9.py
-+++ cmor-3.2.1/Test/test_python_joerg_9.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy,cdms2
-
- f=cdms2.open("Test/GR30s_halo.nc")
-@@ -75,7 +76,7 @@ var_ids = cmor.variable(
-
- 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 @@ for i in range(ntimes):
- 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-3.2.1/Test/test_python_joerg_tim2_clim.py
+Index: cmor-3.2.5/Test/test_python_joerg_tim2_clim.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_tim2_clim.py
-+++ cmor-3.2.1/Test/test_python_joerg_tim2_clim.py
+--- cmor-3.2.5.orig/Test/test_python_joerg_tim2_clim.py
++++ cmor-3.2.5/Test/test_python_joerg_tim2_clim.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
@@ -2250,44 +724,21 @@ Index: cmor-3.2.1/Test/test_python_joerg_tim2_clim.py
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print('doing:',axis)
+- 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
+- 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-3.2.1/Test/test_python_max_variables_2.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_max_variables_2.py
-+++ cmor-3.2.1/Test/test_python_max_variables_2.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy
-
- error_flag = cmor.setup(inpath='Test', netcdf_file_action=cmor.CMOR_REPLACE)
-@@ -68,11 +69,11 @@ for it in range(ntimes):
-
- 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-3.2.1/Test/test_python_memory_check.py
+Index: cmor-3.2.5/Test/test_python_memory_check.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_memory_check.py
-+++ cmor-3.2.1/Test/test_python_memory_check.py
+--- cmor-3.2.5.orig/Test/test_python_memory_check.py
++++ cmor-3.2.5/Test/test_python_memory_check.py
@@ -5,7 +5,7 @@ Note the memory size from repeated calls
Memory stats are taken from http://code.activestate.com/recipes/286222/
@@ -2297,141 +748,37 @@ Index: cmor-3.2.1/Test/test_python_memory_check.py
import os
_proc_status = '/proc/%d/status' % os.getpid()
-@@ -120,7 +120,7 @@ def memory_check():
+@@ -125,7 +125,7 @@ def memory_check():
cmor.write(varid, [275])
- mem,res,stk = memory_usage(sys.stdout,mem,res,stk)
+ 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-3.2.1/Test/test_python_open_close_cmor_multiple.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_open_close_cmor_multiple.py
-+++ cmor-3.2.1/Test/test_python_open_close_cmor_multiple.py
-@@ -1,4 +1,4 @@
--
-+from __future__ import print_function
- import cmor,numpy
-
-
-@@ -46,10 +46,10 @@ for var in tvars:
-
- cmor.write(var,data)
- path=cmor.close(var, file_name=True)
-- print 'Saved in:',path
-+ print('Saved in:',path)
-
- cmor.close()
-
++ print ('---')
+ cmor.close(varid)
--print 'hello'
-+print('hello')
-Index: cmor-3.2.1/Test/test_python_reverted_lats.py
+Index: cmor-3.2.5/Test/test_python_reverted_lats.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_reverted_lats.py
-+++ cmor-3.2.1/Test/test_python_reverted_lats.py
+--- cmor-3.2.5.orig/Test/test_python_reverted_lats.py
++++ cmor-3.2.5/Test/test_python_reverted_lats.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
- import cmor,numpy
+ import cmor
+ import numpy
- nlat = 10
-@@ -34,7 +35,7 @@ ivar = cmor.variable(table_entry='tasmin
- cmor.write(ivar,data,ntimes_passed=1,time_vals=[0.],time_bnds=[0.,1.])
- fnm = cmor.close(ivar,file_name=True)
+@@ -53,7 +54,7 @@ ivar = cmor.variable(
+ 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-3.2.1/Test/test_python_singleton_anywhere_in_table_def.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_singleton_anywhere_in_table_def.py
-+++ cmor-3.2.1/Test/test_python_singleton_anywhere_in_table_def.py
-@@ -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 @@ ts='days'
- 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 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- 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 @@ myvars[0] = cmor.variable( table_entry =
- 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-3.2.1/Test/test_python_singleton_string.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_singleton_string.py
-+++ cmor-3.2.1/Test/test_python_singleton_string.py
-@@ -1,5 +1,5 @@
- #!/usr/bin/env python
--
-+from __future__ import print_function
- from test_python_common import * # common subroutines
-
- import cmor._cmor
-@@ -39,7 +39,7 @@ ts='months'
- tscl=3.5e-4
-
- tables.append(cmor.load_table("Tables/%s" % t))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
- cmor.set_table(tables[0])
-
-@@ -59,7 +59,7 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- 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'
-@@ -90,8 +90,8 @@ myvars[0] = cmor.variable( table_entry =
- 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-3.2.1/Test/test_python_stephanie_6hrPlev_minutes.py
+ ivar2 = cmor.variable(
+ table_entry='tasmin',
+Index: cmor-3.2.5/Test/test_python_stephanie_6hrPlev_minutes.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_stephanie_6hrPlev_minutes.py
-+++ cmor-3.2.1/Test/test_python_stephanie_6hrPlev_minutes.py
+--- cmor-3.2.5.orig/Test/test_python_stephanie_6hrPlev_minutes.py
++++ cmor-3.2.5/Test/test_python_stephanie_6hrPlev_minutes.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
@@ -2442,211 +789,26 @@ Index: cmor-3.2.1/Test/test_python_stephanie_6hrPlev_minutes.py
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print('doing:',axis)
+- print 'doing:', axis
++ print ('doing:', axis)
axis_id = cmor.axis(**axis)
axis_ids.append(axis_id)
-Index: cmor-3.2.1/Test/test_python_user_interface_00.py
+Index: cmor-3.2.5/Lib/cmor_const.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_user_interface_00.py
-+++ cmor-3.2.1/Test/test_python_user_interface_00.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- from test_python_common import * # common subroutines
-
- import cmor._cmor
-@@ -22,18 +23,18 @@ tables=[]
- a = cmor.load_table(os.path.join("CMIP6_Omon.json"))
- tables.append(a)
- tables.append(cmor.load_table("CMIP6_Amon.json"))
--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=""
-@@ -69,30 +70,30 @@ myaxes2[1] = myaxes[3];
- 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])
-@@ -107,7 +108,7 @@ cmor.set_table(tables[1])
-
- 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-3.2.1/Test/test_python_user_interface_01.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_user_interface_01.py
-+++ cmor-3.2.1/Test/test_python_user_interface_01.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- from test_python_common import * # common subroutines
-
- import cmor._cmor
-@@ -22,7 +23,7 @@ tables=[]
- a = cmor.load_table("CMIP6_grids.json")
- tables.append(a)
- tables.append(cmor.load_table("CMIP6_Amon.json"))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
- cmor.set_table(tables[0])
-
-@@ -42,7 +43,7 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- 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'
-@@ -72,7 +73,7 @@ myvars[0] = cmor.variable( table_entry =
- )
- for i in range(ntimes):
- data2d = read_2d_input_files(i, varin2d[0], lat,lon)
-- print 'writing time: ',i,Time[i],data2d.shape,data2d
-- print Time[i],bnds_time[2*i:2*i+2]
-+ print ('writing time: ',i,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-3.2.1/Test/test_python_user_interface_03.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_user_interface_03.py
-+++ cmor-3.2.1/Test/test_python_user_interface_03.py
-@@ -3,11 +3,11 @@ import cmor
- from time import localtime, strftime
- today = strftime("%Y%m%d", localtime())
-
--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
-@@ -40,7 +40,7 @@ def prep_var(data):
- 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,
-@@ -63,13 +63,13 @@ def prep_cmor():
-
-
- 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)
-@@ -81,8 +81,8 @@ for var in ['tas',]:
- 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')
-Index: cmor-3.2.1/Lib/cmor_const.py
-===================================================================
---- cmor-3.2.1.orig/Lib/cmor_const.py
-+++ cmor-3.2.1/Lib/cmor_const.py
+--- cmor-3.2.5.orig/Lib/cmor_const.py
++++ cmor-3.2.5/Lib/cmor_const.py
@@ -1,4 +1,4 @@
-import _cmor
+from . import _cmor
atts = """
CMOR_MAX_STRING
CMOR_MAX_ELEMENTS
-Index: cmor-3.2.1/Test/test_python_common.py
+Index: cmor-3.2.5/Lib/__init__.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_common.py
-+++ cmor-3.2.1/Test/test_python_common.py
-@@ -105,7 +105,7 @@ def read_3d_input_files(it, varname, n0,
- for k in range(n2):
- for j in range(n1):
- for i in range(n0):
-- field[k,j,i] = (k*64 + j*16 + i*4 + it)*factor - offset;
-+ field[k,j,i] = (k*64 + j*16 + i*4 + it)*factor - offset;
- return field
-
-
-Index: cmor-3.2.1/Lib/__init__.py
-===================================================================
---- cmor-3.2.1.orig/Lib/__init__.py
-+++ cmor-3.2.1/Lib/__init__.py
-@@ -4,9 +4,9 @@ xml_pth = os.path.join(sys.prefix,"share
+--- cmor-3.2.5.orig/Lib/__init__.py
++++ cmor-3.2.5/Lib/__init__.py
+@@ -4,9 +4,9 @@ xml_pth = os.path.join(sys.prefix, "shar
if os.path.exists(xml_pth):
os.environ["UDUNITS2_XML_PATH"] = xml_pth
@@ -2657,7 +819,7 @@ Index: cmor-3.2.1/Lib/__init__.py
+from .pywrapper import (
CMORError, axis, variable, write, setup, load_table, set_table, zfactor,
close, grid, set_grid_mapping, time_varying_grid_coordinate, dataset_json,
- set_cur_dataset_attribute, get_cur_dataset_attribute,
+ set_cur_dataset_attribute, get_cur_dataset_attribute,
@@ -14,6 +14,6 @@ from pywrapper import (
has_variable_attribute, get_final_filename, set_deflate)
@@ -2666,11 +828,11 @@ Index: cmor-3.2.1/Lib/__init__.py
+ from .check_CMOR_compliant import checkCMOR
except ImportError:
pass
-Index: cmor-3.2.1/Src/_cmormodule.c
+Index: cmor-3.2.5/Src/_cmormodule.c
===================================================================
---- cmor-3.2.1.orig/Src/_cmormodule.c
-+++ cmor-3.2.1/Src/_cmormodule.c
-@@ -2,6 +2,23 @@
+--- cmor-3.2.5.orig/Src/_cmormodule.c
++++ cmor-3.2.5/Src/_cmormodule.c
+@@ -3,6 +3,23 @@
#include "numpy/arrayobject.h"
#include "cmor.h"
@@ -2694,7 +856,7 @@ Index: cmor-3.2.1/Src/_cmormodule.c
static PyObject *CMORError;
volatile sig_atomic_t raise_exception = 0;
char *exception_message = "Problem with 'cmor.%s'. Please check the logfile "
-@@ -394,7 +411,11 @@ static PyObject *PyCMOR_axis( PyObject *
+@@ -399,7 +416,11 @@ static PyObject *PyCMOR_axis(PyObject *
char *units;
char *interval;
int length;
@@ -2707,52 +869,55 @@ Index: cmor-3.2.1/Src/_cmormodule.c
void *coord_vals;
void *cell_bounds;
int cell_bounds_ndim;
-@@ -406,10 +427,12 @@ static PyObject *PyCMOR_axis( PyObject *
+@@ -410,12 +431,18 @@ static PyObject *PyCMOR_axis(PyObject *
+ /************************************************************************/
/* HUGE assumtion here is that the data is contiguous! */
/************************************************************************/
-
-- if( !PyArg_ParseTuple
-- ( args, "ssiOcOis", &name, &units, &length, &coords_obj, &type,
-- &bounds_obj, &cell_bounds_ndim, &interval ) )
-- return NULL;
-+#if PY_MAJOR_VERSION >=3
-+ if (!PyArg_ParseTuple(args,"ssiOCOis",&name,&units,&length,&coords_obj,&type,&bounds_obj,&cell_bounds_ndim,&interval))
+-
++#if PY_MAJOR_VERSION >= 3
++ if (!PyArg_ParseTuple
++ (args, "ssiOCOis", &name, &units, &length, &coords_obj, &type,
++ &bounds_obj, &cell_bounds_ndim, &interval))
+#else
-+ if (!PyArg_ParseTuple(args,"ssiOcOis",&name,&units,&length,&coords_obj,&type,&bounds_obj,&cell_bounds_ndim,&interval))
-+#endif
-+ return NULL;
-
- if( coords_obj == Py_None ) {
- coord_vals = NULL;
-@@ -1030,10 +1053,56 @@ static PyMethodDef MyExtractMethods[] =
- {NULL, NULL} /*sentinel */
+ if (!PyArg_ParseTuple
+ (args, "ssiOcOis", &name, &units, &length, &coords_obj, &type,
+ &bounds_obj, &cell_bounds_ndim, &interval))
++#endif
+ return NULL;
+
++
+ if (coords_obj == Py_None) {
+ coord_vals = NULL;
+ } else {
+@@ -1011,11 +1038,59 @@ static PyMethodDef MyExtractMethods[] =
+ {NULL, NULL} /*sentinel */
};
--PyMODINIT_FUNC init_cmor( void ) {
+-PyMODINIT_FUNC init_cmor(void)
+-{
- PyObject *cmor_module;
-- cmor_module = Py_InitModule("_cmor", MyExtractMethods);
+#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_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 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
++static struct PyModuleDef moduledef = {
++ PyModuleDef_HEAD_INIT,
++ "_cmor",
++ NULL,
++ sizeof(struct module_state),
++ MyExtractMethods,
++ NULL,
++ MyExtract_traverse,
++ MyExtract_clear,
++ NULL
+};
+
+
@@ -2767,16 +932,18 @@ Index: cmor-3.2.1/Src/_cmormodule.c
+#endif
+{
+#if PY_MAJOR_VERSION >= 3
-+ PyObject *module = PyModule_Create(&moduledef);
++ PyObject *module = PyModule_Create(&moduledef);
+#else
-+ PyObject *module = Py_InitModule("_cmor", MyExtractMethods);
++ PyObject *module = Py_InitModule("_cmor", MyExtractMethods);
+#endif
- import_array( );
++ import_array( );
+
+ if (module == NULL)
-+ INITERROR;
++ INITERROR;
+ struct module_state *st = GETSTATE(module);
+
+ cmor_module = Py_InitModule("_cmor", MyExtractMethods);
+ import_array();
CMORError = PyErr_NewException("_cmor.CMORError", NULL, NULL);
- PyModule_AddObject(cmor_module, "CMORError", CMORError);
+ PyModule_AddObject(module, "CMORError", CMORError);
@@ -2784,21 +951,27 @@ Index: cmor-3.2.1/Src/_cmormodule.c
+#if PY_MAJOR_VERSION >= 3
+ return module;
+#endif
++
}
-Index: cmor-3.2.1/Test/cmor_speed_and_compression_01.py
+Index: cmor-3.2.5/Test/cmor_speed_and_compression_01.py
===================================================================
---- cmor-3.2.1.orig/Test/cmor_speed_and_compression_01.py
-+++ cmor-3.2.1/Test/cmor_speed_and_compression_01.py
-@@ -8,7 +8,7 @@ try:
+--- cmor-3.2.5.orig/Test/cmor_speed_and_compression_01.py
++++ cmor-3.2.5/Test/cmor_speed_and_compression_01.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+ import sys
+@@ -11,7 +12,7 @@ try:
cdms2.setNetcdfDeflateFlag(0)
cdms2.setNetcdfDeflateLevelFlag(0)
- except:
+ except BaseException:
- 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:
-@@ -41,7 +41,7 @@ cmor.dataset_json("Test/common_user_inpu
+@@ -48,7 +49,7 @@ cmor.dataset_json("Test/common_user_inpu
tables = []
tables.append(cmor.load_table("mytable"))
@@ -2806,37 +979,37 @@ Index: cmor-3.2.1/Test/cmor_speed_and_compression_01.py
+print ('Tables ids:', tables)
- ## read in data, just one slice
-@@ -87,10 +87,10 @@ mincdms=1000
- c0=st
- f=cdms2.open("Test/crap.nc","w")
- #print 'Time:',i
+ # read in data, just one slice
+@@ -94,10 +95,10 @@ mincdms = 1000
+ c0 = st
+ f = cdms2.open("Test/crap.nc", "w")
+ # print 'Time:',i
-print s.filled().shape
+print (s.filled().shape)
- cmor.write(myvars[0],s.filled(),ntimes_passed=ntimes)
- c=time.time()
--print 'cmor write time:',c-c0
-+print ('cmor write time:',c-c0)
- totcmor+=c-c0
- if maxcmor<c-c0:
- maxcmor=c-c0
-@@ -99,7 +99,7 @@ if mincmor>c-c0:
- 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
-@@ -113,12 +113,12 @@ import cdtime,os
- ltime = cdtime.reltime(ntimes-1,'month since 1980').tocomp()
+ cmor.write(myvars[0], s.filled(), ntimes_passed=ntimes)
+ c = time.time()
+-print 'cmor write time:', c - c0
++print ('cmor write time:', c - c0)
+ totcmor += c - c0
+ if maxcmor < c - c0:
+ maxcmor = c - c0
+@@ -106,7 +107,7 @@ if mincmor > c - c0:
+ 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
+@@ -122,12 +123,12 @@ ltime = cdtime.reltime(ntimes - 1, 'mont
#lcmor = os.stat("CMIP6/CMIP/CSIRO-BOM/NICAM/piControl/r1i1p1f1/Amon/tas/gn/v%s/tas_Amon_piControl_NICAM_r1i1p1f1_gn_197901-197912.nc"%(today))[6]
- lcmor = os.stat("CMIP6/ISMIP6/PCMDI/PCMDI-test-1-0/piControl-withism/r11i1p1f1/Amon/tas/gr/v%s/tas_Amon_piControl-withism_PCMDI-test-1-0_r11i1p1f1_gr_197901-197912.nc"%(today))[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)
+ lcmor = os.stat(
+ "CMIP6/CMIP6/ISMIP6/PCMDI/PCMDI-test-1-0/piControl-withism/r11i1p1f1/Amon/tas/gr/v%s/tas_Amon_PCMDI-test-1-0_piControl-withism_r11i1p1f1_gr_197901-197912.nc" % (today))[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)
@@ -2847,7 +1020,7 @@ Index: cmor-3.2.1/Test/cmor_speed_and_compression_01.py
if os.path.exists("summary.txt"):
f = open("summary.txt")
-@@ -133,7 +133,7 @@ dic[(level, shuffle)] = (float(lcmor) /
+@@ -142,7 +143,7 @@ dic[(level, shuffle)] = (float(lcmor) /
for i in range(10):
a = dic.get((i, 0), "N/A")
b = dic.get((i, 1), "N/A")
@@ -2856,73 +1029,16 @@ Index: cmor-3.2.1/Test/cmor_speed_and_compression_01.py
f = open("summary.txt", "w")
f.write(repr(dic))
f.close()
-Index: cmor-3.2.1/Src/_controlvocabulary.c
-===================================================================
---- cmor-3.2.1.orig/Src/_controlvocabulary.c
-+++ cmor-3.2.1/Src/_controlvocabulary.c
-@@ -546,8 +546,52 @@ static PyMethodDef MyExtractMethods[] =
- {NULL, NULL} /*sentinel */
- };
-
-+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
-+
-+#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,
-+ "_cmip6_cv",
-+ NULL,
-+ sizeof(struct module_state),
-+ MyExtractMethods,
-+ NULL,
-+ MyExtract_traverse,
-+ MyExtract_clear,
-+ NULL
-+ };
-+#endif
-+
- PyMODINIT_FUNC init_cmip6_cv( void ) {
-+#if PY_MAJOR_VERSION >= 3
-+ PyObject *module = PyModule_Create(&moduledef);
-+#else
- ( void ) Py_InitModule( "_cmip6_cv", MyExtractMethods );
-+#endif
- import_array( );
-+
-+#if PY_MAJOR_VERSION >= 3
-+ return module;
-+#endif
- }
-
-Index: cmor-3.2.1/Lib/convertCSVFile.py
+Index: cmor-3.2.5/Lib/convertCSVFile.py
===================================================================
---- cmor-3.2.1.orig/Lib/convertCSVFile.py
-+++ cmor-3.2.1/Lib/convertCSVFile.py
+--- cmor-3.2.5.orig/Lib/convertCSVFile.py
++++ cmor-3.2.5/Lib/convertCSVFile.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import csv
import re
import pdb
-@@ -48,8 +49,8 @@ expt_template ="""
+@@ -53,8 +54,8 @@ expt_template = """
"parent_mip_era ": "CMIP6"
},
"""
@@ -2933,216 +1049,50 @@ Index: cmor-3.2.1/Lib/convertCSVFile.py
with open('../Tables/CMIP6_expt_list_062116.csv', 'rU') as csvfile:
spamreader = csv.reader(csvfile, dialect=csv.excel)
for row in spamreader:
-@@ -58,7 +59,7 @@ with open('../Tables/CMIP6_expt_list_062
- expt = ""
- for row in spamreader:
- ## if (row[5] == "") & (row[22] != ""):
--## print i
-+## print (i)
- if (row[9] != "" ):
- expt = expt + expt_template
- expt = replaceString(expt, row[9], "experiment_id")
-@@ -83,4 +84,4 @@ with open('../Tables/CMIP6_expt_list_062
+@@ -90,4 +91,4 @@ with open('../Tables/CMIP6_expt_list_062
#nexpt = expt + "\"Dummy\":{}\n }"
expt = expt + "\n }\n}"
- expt = deleteComa(expt )
+ expt = deleteComa(expt)
-print expt
+print (expt)
-Index: cmor-3.2.1/LibCV/pywrapper.py
-===================================================================
---- cmor-3.2.1.orig/LibCV/pywrapper.py
-+++ cmor-3.2.1/LibCV/pywrapper.py
-@@ -44,7 +44,7 @@ def _to_numpy(vals, message):
- 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
-
-@@ -64,19 +64,19 @@ def setup(inpath='.',
- 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(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 create_subdirectories not in [0, 1]:
-- raise Exception, "create_subdirectories must be 0 or 1"
-+ raise Exception("create_subdirectories must be 0 or 1")
- CMOR_PRESERVE = 10
- return(_cmip6_cv.setup(inpath, CMOR_PRESERVE, set_verbosity, exit_control, logfile, create_subdirectories))
-
-@@ -87,15 +87,15 @@ def load_table(table):
- 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
-+# raise Exception("Error, the table you specified (%s) does not exists" % table)
- return _cmip6_cv.load_table(table)
-
-
- 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(_cmip6_cv.set_table(table))
-
-
-@@ -111,7 +111,7 @@ def close(var_id=None, file_name=False,
- 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-3.2.1/Test/test_doc.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_doc.py
-+++ cmor-3.2.1/Test/test_doc.py
+Index: cmor-3.2.5/Test/test_doc.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_doc.py
++++ cmor-3.2.5/Test/test_doc.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor
- cmor.setup(inpath='Tables',netcdf_file_action=cmor.CMOR_REPLACE_4)
-@@ -25,7 +26,7 @@ axis_ids = [itime,ilat,ilon]
+ cmor.setup(inpath='Tables', netcdf_file_action=cmor.CMOR_REPLACE_4)
+@@ -25,5 +26,5 @@ axis_ids = [itime, ilat, ilon]
varid = cmor.variable('ts', 'K', axis_ids)
cmor.write(varid, [273])
- outfile=cmor.close(varid, file_name=True)
--print "File written: ",outfile
-+print("File written: ",outfile)
+ outfile = cmor.close(varid, file_name=True)
+-print "File written: ", outfile
++print ("File written: ", outfile)
cmor.close()
-
-
-Index: cmor-3.2.1/LibCV/__init__.py
-===================================================================
---- cmor-3.2.1.orig/LibCV/__init__.py
-+++ cmor-3.2.1/LibCV/__init__.py
-@@ -1,4 +1,4 @@
--from cmor_const import *
-+from .cmor_const import *
-
--from pywrapper import setup, load_table, set_table, close, set_cur_dataset_attribute, get_cur_dataset_attribute, has_cur_dataset_attribute, set_variable_attribute, list_variable_attributes, get_variable_attribute, has_variable_attribute, check_institution, check_sourceID, check_experiment, check_grids, check_requiredattributes, check_ISOTime, check_furtherinfourl, get_CV_Error, setup_variable, set_CV_Error
-+from .pywrapper import setup, load_table, set_table, close, set_cur_dataset_attribute, get_cur_dataset_attribute, has_cur_dataset_attribute, set_variable_attribute, list_variable_attributes, get_variable_attribute, has_variable_attribute, check_institution, check_sourceID, check_experiment, check_grids, check_requiredattributes, check_ISOTime, check_furtherinfourl, get_CV_Error, setup_variable, set_CV_Error
-
-Index: cmor-3.2.1/Test/cmor_speed_and_compression_03.py
-===================================================================
---- cmor-3.2.1.orig/Test/cmor_speed_and_compression_03.py
-+++ cmor-3.2.1/Test/cmor_speed_and_compression_03.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy,sys,os
- from time import localtime, strftime
- today = strftime("%Y%m%d", localtime())
-@@ -9,7 +10,7 @@ try:
- 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()
-
- level = 3
-@@ -19,7 +20,7 @@ cmor.dataset_json("Test/common_user_inpu
-
- tables=[]
- tables.append(cmor.load_table("CMIP6_Amon.json"))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
-
-
- ## read in data, just one slice
-@@ -65,11 +66,11 @@ maxcdms=0
- 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
-+print ('cmor write time:',c-c0)
- totcmor+=c-c0
- if maxcmor<c-c0:
- maxcmor=c-c0
-@@ -78,7 +79,7 @@ if mincmor>c-c0:
- 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
-@@ -92,12 +93,12 @@ import cdtime,os
- ltime = cdtime.reltime(ntimes-1,'month since 1980').tocomp()
- #lcmor = os.stat("CMIP6/CMIP/CSIRO-BOM/NICAM/piControl/r1i1p1f1/Amon/tas/gn/v%s/tas_Amon_piControl_NICAM_r1i1p1f1_gn_197901-197912.nc"%(today))[6]
- lcmor = os.stat("CMIP6/ISMIP6/PCMDI/PCMDI-test-1-0/piControl-withism/r11i1p1f1/Amon/tas/gr/v%s/tas_Amon_piControl-withism_PCMDI-test-1-0_r11i1p1f1_gr_197901-197912.nc"%(today))[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")
-@@ -112,7 +113,7 @@ dic[(level,shuffle)]=(float(lcmor)/float
- 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()
-Index: cmor-3.2.1/Test/test_non_monotonic_climo_bonds_ok.py
+Index: cmor-3.2.5/Test/test_non_monotonic_climo_bonds_ok.py
===================================================================
---- cmor-3.2.1.orig/Test/test_non_monotonic_climo_bonds_ok.py
-+++ cmor-3.2.1/Test/test_non_monotonic_climo_bonds_ok.py
+--- cmor-3.2.5.orig/Test/test_non_monotonic_climo_bonds_ok.py
++++ cmor-3.2.5/Test/test_non_monotonic_climo_bonds_ok.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor
- ## Hypothetical data are going from march 2000 thru feb 2010
-@@ -48,7 +49,7 @@ def path_test():
+ # Hypothetical data are going from march 2000 thru feb 2010
+@@ -49,7 +50,7 @@ def path_test():
cmor.write(varid, data)
- path=cmor.close(varid, file_name=True)
+ path = cmor.close(varid, file_name=True)
- print path
+ print (path)
+
if __name__ == '__main__':
- path_test()
-Index: cmor-3.2.1/Test/test_python_polar_stereo.py
+Index: cmor-3.2.5/Test/test_python_polar_stereo.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_polar_stereo.py
-+++ cmor-3.2.1/Test/test_python_polar_stereo.py
+--- cmor-3.2.5.orig/Test/test_python_polar_stereo.py
++++ cmor-3.2.5/Test/test_python_polar_stereo.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
@@ -3150,28 +1100,28 @@ Index: cmor-3.2.1/Test/test_python_polar_stereo.py
import cmor
import cdms2
import numpy
-@@ -25,7 +25,7 @@ te = 'orog'
- u='m'
+@@ -28,7 +28,7 @@ te = 'orog'
+ u = 'm'
tables.append(cmor.load_table("%s" % t))
--print 'Tables ids:',tables
-+print ('Tables ids:',tables)
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
cmor.set_table(tables[0])
-@@ -49,7 +49,7 @@ grid_id = cmor.grid(axis_ids = myaxes[:2
- latitude = lat_coords,
- longitude = lon_coords)
+@@ -51,7 +51,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ latitude=lat_coords,
+ longitude=lon_coords)
--print 'got grid_id:',grid_id
-+print ('got grid_id:',grid_id)
+-print 'got grid_id:', grid_id
++print ('got grid_id:', grid_id)
myaxes[2] = grid_id
mapnm = 'polar_stereographic'
-Index: cmor-3.2.1/Test/test_checker_works.py
+Index: cmor-3.2.5/Test/test_checker_works.py
===================================================================
---- cmor-3.2.1.orig/Test/test_checker_works.py
-+++ cmor-3.2.1/Test/test_checker_works.py
+--- cmor-3.2.5.orig/Test/test_checker_works.py
++++ cmor-3.2.5/Test/test_checker_works.py
@@ -1,7 +1,7 @@
-####
+# --- Test/test_checker_works.pylint(original)0;95;c####
@@ -3182,48 +1132,28 @@ Index: cmor-3.2.1/Test/test_checker_works.py
import sys
import cmor
import shutil
-@@ -1732,13 +1732,13 @@ cmor.checkCMOR(fo,file,"Tables/CMIP5_6hr
- ## os.remove(F)
- att="cell_measures"
+@@ -1732,7 +1732,7 @@ cmor.checkCMOR(fo, file, "Tables/CMIP5_6
+ # os.remove(F)
+ att = "cell_measures"
try:
- print 'Testing wrong var att %s' % att
+ print ('Testing wrong var att %s' % att)
- F="hus_6hrLev_pcmdi-10a_DcppC2_r1i1p1_2010010100-2010010218.nc"
- shutil.copy(file,F)
- os.popen("ncdump %s > crap.txt"%F).readlines()
- fi=open("crap.txt")
- f=open("crapo.txt","w")
-- for ln in fi.xreadlines():
-+ for ln in fi.readlines():
- if ln.find("hus:%s"%att)>-1:
- f.write(' hus:%s = "area: cl" ;' % att)
- continue
-@@ -1750,15 +1750,15 @@ try:
- os.remove("crap.txt")
- os.remove("crapo.txt")
- cmor.checkCMOR(fo,F,"Tables/CMIP5_6hrLev",dodrs=False)
-- raise Exception,"missing var att %s test failed" % att
--except cmor.check_CMOR_compliant.CMORError,err:
-+ raise Exception("missing var att %s test failed" % att)
-+except cmor.check_CMOR_compliant.CMORError as err:
- if str(err).find('variable attribute cell_measures should be')>-1:
-- print 'Failed with CMOR error as expected:',err
-+ print ('Failed with CMOR error as expected:',err)
+ F = "hus_6hrLev_pcmdi-10a_DcppC2_r1i1p1_2010010100-2010010218.nc"
+ shutil.copy(file, F)
+ os.popen("ncdump %s > crap.txt" % F).readlines()
+@@ -1753,7 +1753,7 @@ try:
+ raise Exception("missing var att %s test failed" % att)
+ except cmor.check_CMOR_compliant.CMORError as err:
+ if str(err).find('variable attribute cell_measures should be') > -1:
+- print 'Failed with CMOR error as expected:', err
++ print ('Failed with CMOR error as expected:', err)
pass
else:
-- raise Exception,"Checker of variable type failed for the wrong reason! %s" % (err)
--except Exception,err:
-- raise Exception,err
-+ raise Exception("Checker of variable type failed for the wrong reason! %s" % (err))
-+except Exception as err:
-+ raise Exception(err)
- os.remove(F)
-
-
-Index: cmor-3.2.1/Test/test_python_free_wrapping_issue.py
+ raise Exception(
+Index: cmor-3.2.5/Test/test_python_free_wrapping_issue.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_free_wrapping_issue.py
-+++ cmor-3.2.1/Test/test_python_free_wrapping_issue.py
+--- cmor-3.2.5.orig/Test/test_python_free_wrapping_issue.py
++++ cmor-3.2.5/Test/test_python_free_wrapping_issue.py
@@ -2,6 +2,7 @@
# Peter Uhe 24 July 2014
# Martin Dix 21 Nov 2014
@@ -3232,95 +1162,1516 @@ Index: cmor-3.2.1/Test/test_python_free_wrapping_issue.py
import numpy as np
import datetime
import cmor
-@@ -124,9 +125,9 @@ def save(opts,threeD=True):
- else:
- data_vals = np.zeros((len(tvals), len(plev), len(lat), len(lon)), np.float32) + 290.
+@@ -131,7 +132,7 @@ def save(opts, threeD=True):
+ len(lon)),
+ np.float32) + 290.
try:
- print 'writing...'
+ print ('writing...')
- cmor.write(variable_id, data_vals[:], ntimes_passed=np.shape(data_vals)[0]) #assuming time is the first dimension
-- except Exception, e:
-+ except Exception as e:
- raise Exception("ERROR writing data!")
-
- try:
-@@ -134,7 +135,7 @@ def save(opts,threeD=True):
- except:
+ cmor.write(variable_id, data_vals[:], ntimes_passed=np.shape(
+ data_vals)[0]) # assuming time is the first dimension
+ except Exception as e:
+@@ -142,7 +143,7 @@ def save(opts, threeD=True):
+ except BaseException:
raise Exception("ERROR closing cmor file!")
- print path
+ print (path)
- if __name__ == "__main__":
-Index: cmor-3.2.1/Test/test_python_jamie.py
+ if __name__ == "__main__":
+Index: cmor-3.2.5/Test/test_python_jamie.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie.py
-+++ cmor-3.2.1/Test/test_python_jamie.py
+--- cmor-3.2.5.orig/Test/test_python_jamie.py
++++ cmor-3.2.5/Test/test_python_jamie.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import cmor
- def path_test():
-@@ -30,7 +31,7 @@ def path_test():
+
+@@ -31,7 +32,7 @@ def path_test():
cmor.write(varid, [275])
- path=cmor.close(varid, file_name=True)
+ path = cmor.close(varid, file_name=True)
- print path
+ print (path)
- if __name__ == '__main__':
- path_test()
-Index: cmor-3.2.1/Test/test_python_jamie_11.py
-===================================================================
---- cmor-3.2.1.orig/Test/test_python_jamie_11.py
-+++ cmor-3.2.1/Test/test_python_jamie_11.py
-@@ -1,3 +1,4 @@
-+from __future__ import print_function
- import cmor,numpy
-
- error_flag = cmor.setup(inpath='Test', netcdf_file_action=cmor.CMOR_REPLACE)
-@@ -91,7 +92,7 @@ if table_entry == 'hybrid_height':
- units='m' ,
- zfactor_values = data2d)
- else:
-- print 'yep working case'
-+ print ('yep working case')
- ilev = cmor.axis(
- table_entry='standard_sigma',
- units='1',
-@@ -127,7 +128,7 @@ else:
- axis_ids=numpy.array(( ilon, ilat, itim )),
- units='Pa')
-
--print "ILEV is:",ilev
-+print ("ILEV is:",ilev)
- var3d_ids = cmor.variable(
- table_entry='sconcoa',
-Index: cmor-3.2.1/Test/test_python_joerg_tim2_clim_02.py
+ if __name__ == '__main__':
+Index: cmor-3.2.5/Test/test_python_joerg_tim2_clim_02.py
===================================================================
---- cmor-3.2.1.orig/Test/test_python_joerg_tim2_clim_02.py
-+++ cmor-3.2.1/Test/test_python_joerg_tim2_clim_02.py
+--- cmor-3.2.5.orig/Test/test_python_joerg_tim2_clim_02.py
++++ cmor-3.2.5/Test/test_python_joerg_tim2_clim_02.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import cmor
import numpy
-@@ -32,12 +33,13 @@ def main():
+@@ -32,12 +33,12 @@ def main():
axis_ids = list()
for axis in axes:
-- print 'doing:',axis
-+ print ('doing:',axis)
+- 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(map(lambda x: len(x["coord_vals"]),axes))*value
-+ values = numpy.ones([len(x["coord_vals"]) for x in axes])*value
- values=values.astype("f")
+- values = numpy.ones(map(lambda x: len(x["coord_vals"]), axes)) * value
++ values = numpy.ones([len(x["coord_vals"]) for x in axes]) * value
+ values = values.astype("f")
varid = cmor.variable(var,
units,
+Index: cmor-3.2.5/Lib/git2svn.py
+===================================================================
+--- cmor-3.2.5.orig/Lib/git2svn.py
++++ cmor-3.2.5/Lib/git2svn.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import os
+ import sys
+
+@@ -18,15 +19,15 @@ for l in git:
+
+ 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-3.2.5/LibCV/pywrapper.py
+===================================================================
+--- cmor-3.2.5.orig/LibCV/pywrapper.py
++++ cmor-3.2.5/LibCV/pywrapper.py
+@@ -5,7 +5,7 @@ Created on Fri Feb 19 11:33:52 2016
+ @author: Denis Nadeau LLNL, Charles Doutriaux LLNL
+ '''
+
+-import cmor_const
++from . import cmor_const
+ import numpy
+ import os
+ import _cmip6_cv
+Index: cmor-3.2.5/LibCV/__init__.py
+===================================================================
+--- cmor-3.2.5.orig/LibCV/__init__.py
++++ cmor-3.2.5/LibCV/__init__.py
+@@ -1,3 +1,3 @@
+-from cmor_const import *
++from .cmor_const import *
+
+-from pywrapper import setup, load_table, set_table, close, set_cur_dataset_attribute, get_cur_dataset_attribute, has_cur_dataset_attribute, set_variable_attribute, list_variable_attributes, get_variable_attribute, has_variable_attribute, check_institution, check_sourceID, check_experiment, check_grids, check_requiredattributes, check_ISOTime, check_furtherinfourl, get_CV_Error, setup_variable, set_CV_Error, check_parentExpID, check_subExpID, check_filename
++from .pywrapper import setup, load_table, set_table, close, set_cur_dataset_attribute, get_cur_dataset_attribute, has_cur_dataset_attribute, set_variable_attribute, list_variable_attributes, get_variable_attribute, has_variable_attribute, check_institution, check_sourceID, check_experiment, check_grids, check_requiredattributes, check_ISOTime, check_furtherinfourl, get_CV_Error, setup_variable, set_CV_Error, check_parentExpID, check_subExpID, check_filename
+Index: cmor-3.2.5/Test/nc2asc.py
+===================================================================
+--- cmor-3.2.5.orig/Test/nc2asc.py
++++ cmor-3.2.5/Test/nc2asc.py
+@@ -1,5 +1,6 @@
+ #!/usr/bin/env python
+
++from __future__ import print_function
+ import cdms2
+ import sys
+ import genutil
+@@ -23,67 +24,67 @@ else:
+ f = cdms2.open(fnm)
+
+ ntimes = 3
+-print 'var:', var
++print ('var:', var)
+ # s=f(var,time=slice(0,3),latitude=(-20,20),order=order,squeeze=1)
+ if order is not None:
+ if order.find('z') > -1:
+ s = f(var, time=slice(0, ntimes), order=order, squeeze=1,
+ longitude=(-180, 180, 'con'), level=slice(5, 12))
+- print s.getLevel()[:]
++ print (s.getLevel()[:])
+ else:
+ s = f(var, time=slice(0, ntimes), order=order,
+ squeeze=1, longitude=(-180, 180, 'con'))
+ else:
+ s = f(var, time=slice(0, ntimes), squeeze=1)
+ # s=s[:,::4,::4]
+-print 'Read in', s.shape
++print ('Read in', s.shape)
+ try:
+ p = s.getLevel()
+ p.id = 'pressure'
+ p.units = 'Pa'
+ except BaseException:
+ pass
+-# print genutil.minmax(s)
++# print (genutil.minmax(s))
+ f.close()
+
+ f = open(fout, 'w')
+
+ ndim = s.rank()
+-print 'Dumping'
+-print >>f, s.id
+-print >>f, s.units
+-print >>f, ndim
++print ('Dumping')
++print (s.id, file=f)
++print (s.units, file=f)
++print (ndim, file=f)
+
+ for i in range(ndim):
+ ax = s.getAxis(i)
+- print >>f, len(ax)
++ print (len(ax), file=f)
+
+ for i in range(ndim):
+ ax = s.getAxis(i)
+ if ax.isLatitude():
+- print >>f, 'latitude'
++ print ('latitude', file=f)
+ elif ax.isLongitude():
+- print >>f, 'longitude'
++ print ('longitude', file=f)
+ else:
+- print >>f, ax.id
+- print >>f, ax.units
+- print ax.id
+- print ax.units
++ print (ax.id, file=f)
++ print (ax.units, file=f)
++ print (ax.id)
++ print (ax.units)
+ for j in ax[:]:
+- print >>f, j,
+- print >>f
++ print ((j,), file=f)
++ print ("", file=f)
+ for j in ax.getBounds().flat[:]:
+- print >>f, j,
+- print >>f
++ print (j,)
++ print ("", file=f)
+ f.flush()
+
+ s = s.filled(120).astype(type)
+ s = s.flat
+ j = 0
+ for i in s[:]:
+- print >>f, i,
++ print ((i,) , file=f)
+ j += 1
+-print >>f
+-print j, s[-1]
++print ("", file=f)
++print (j, s[-1])
+
+ f.close()
+Index: cmor-3.2.5/Test/test_python_joerg_10.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_joerg_10.py
++++ cmor-3.2.5/Test/test_python_joerg_10.py
+@@ -1,4 +1,5 @@
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -28,7 +29,7 @@ tables = []
+ a = cmor.load_table("Tables/CMIP6_grids.json")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP6_Omon.json"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+ cmor.set_table(tables[0])
+
+@@ -49,7 +50,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ 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'
+@@ -74,7 +75,7 @@ myaxes[3] = cmor.axis(table_entry='time'
+
+ pass_axes = [myaxes[3], myaxes[4], 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,
+@@ -91,11 +92,11 @@ for i in range(0, ntimes, 2):
+ data2d_2 = numpy.expand_dims(data2d_2, axis=0)
+ data2d = numpy.array((data2d_1, data2d_2))
+ #data2d=numpy.expand_dims(data2d, axis=0)
+- # print data2d.shape
+- print 'writing time: ', i
+- print data2d.shape
+- print data2d
+- print Time[i:i + 2], bnds_time[2 * i:2 * i + 4]
++ # print (data2d.shape)
++ print ('writing time: ', i)
++ print (data2d.shape)
++ print (data2d)
++ print (Time[i:i + 2], bnds_time[2 * i:2 * i + 4])
+ cmor.write(
+ myvars[0],
+ data2d,
+Index: cmor-3.2.5/Test/test_python_joerg_11.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_joerg_11.py
++++ cmor-3.2.5/Test/test_python_joerg_11.py
+@@ -1,4 +1,5 @@
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -22,7 +23,7 @@ tables = []
+ a = cmor.load_table("Tables/CMIP6_grids.json")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP6_Omon.json"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+ cmor.set_table(tables[0])
+
+@@ -42,7 +43,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ 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'
+@@ -66,7 +67,7 @@ myaxes[4] = cmor.axis(table_entry='oline
+
+ 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,
+@@ -75,8 +76,8 @@ myvars[0] = cmor.variable(table_entry='m
+ )
+ 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-3.2.5/Test/test_python_joerg_12.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_joerg_12.py
++++ cmor-3.2.5/Test/test_python_joerg_12.py
+@@ -1,4 +1,5 @@
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -26,7 +27,7 @@ tables = []
+ a = cmor.load_table("Tables/CMIP6_grids.json")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP6_Lmon.json"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+ cmor.set_table(tables[0])
+
+@@ -46,7 +47,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ 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'
+@@ -70,7 +71,7 @@ myaxes[4] = cmor.axis(table_entry='vegty
+
+ 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,
+@@ -79,8 +80,8 @@ myvars[0] = cmor.variable(table_entry='l
+ )
+ 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-3.2.5/Test/test_python_joerg_9.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_joerg_9.py
++++ cmor-3.2.5/Test/test_python_joerg_9.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+ import cdms2
+@@ -77,7 +78,7 @@ var_ids = cmor.variable(
+
+ 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,
+@@ -88,6 +89,6 @@ for i in range(ntimes):
+ 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-3.2.5/Test/cmor_speed_and_compression_03.py
+===================================================================
+--- cmor-3.2.5.orig/Test/cmor_speed_and_compression_03.py
++++ cmor-3.2.5/Test/cmor_speed_and_compression_03.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+ import sys
+@@ -12,7 +13,7 @@ try:
+ cdms2.setNetcdfDeflateFlag(0)
+ cdms2.setNetcdfDeflateLevelFlag(0)
+ except BaseException:
+- 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()
+
+ level = 3
+@@ -26,7 +27,7 @@ cmor.dataset_json("Test/common_user_inpu
+
+ tables = []
+ tables.append(cmor.load_table("CMIP6_Amon.json"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+
+ # read in data, just one slice
+@@ -73,10 +74,10 @@ mincdms = 1000
+ c0 = st
+ f = cdms2.open("Test/crap.nc", "w")
+ # print 'Time:',i
+-print s.filled().shape
++print (s.filled().shape)
+ cmor.write(myvars[0], s.filled(), ntimes_passed=ntimes)
+ c = time.time()
+-print 'cmor write time:', c - c0
++print ('cmor write time:', c - c0)
+ totcmor += c - c0
+ if maxcmor < c - c0:
+ maxcmor = c - c0
+@@ -85,7 +86,7 @@ if mincmor > c - c0:
+ 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
+@@ -102,12 +103,12 @@ ltime = cdtime.reltime(ntimes - 1, 'mont
+ lcmor = os.stat(
+ "CMIP6/CMIP6/ISMIP6/PCMDI/PCMDI-test-1-0/piControl-withism/r11i1p1f1/Amon/tas/gr/v%s/tas_Amon_PCMDI-test-1-0_piControl-withism_r11i1p1f1_gr_197901-197912.nc" %
+ (today))[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")
+@@ -122,7 +123,7 @@ dic[(level, shuffle)] = (float(lcmor) /
+ 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()
+Index: cmor-3.2.5/Test/test_compression.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_compression.py
++++ cmor-3.2.5/Test/test_compression.py
+@@ -1,9 +1,10 @@
++from __future__ import print_function
+ import sys
+ import os
+ try:
+ import cdms2
+ except BaseException:
+- print 'This test requires cdms2 for I/O'
++ print ('This test requires cdms2 for I/O')
+ sys.exit()
+
+ import cmor
+@@ -40,7 +41,7 @@ for ax in Saxes[1:]:
+ # 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(
+@@ -50,7 +51,7 @@ tmp = cmor.axis(
+ 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)
+@@ -59,7 +60,7 @@ sh[0] = nt
+ s = numpy.resize(s, sh)
+ # s=numpy.where(numpy.greater(s,100.),100,s)
+ s = numpy.random.random(s.shape) * 10000.
+-print s.shape
++print (s.shape)
+ cmor.write(var_id1, s)
+ cmor.close(var_id1)
+ cmor.write(var_id2, s)
+Index: cmor-3.2.5/Test/test_python_2Gb_file.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_2Gb_file.py
++++ cmor-3.2.5/Test/test_python_2Gb_file.py
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -65,12 +65,12 @@ data = numpy.random.random((nlev, nlat,
+
+ for i in range(ntimes):
+ if i % 10 == 0:
+- print 'Writing time:', i
++ 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-3.2.5/Test/test_python_2Gb_slice.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_2Gb_slice.py
++++ cmor-3.2.5/Test/test_python_2Gb_slice.py
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -19,7 +19,7 @@ blons = numpy.arange(0, 360. + dlon, dlo
+ 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, .5, .1])
+ alllevs = numpy.arange(1000, 0, -dlev).tolist()
+-print len(alllevs)
++print (len(alllevs))
+
+ cmor.setup(inpath='Tables', netcdf_file_action=cmor.CMOR_REPLACE)
+ cmor.dataset_json("Test/common_user_input.json")
+@@ -45,20 +45,20 @@ axes = [itim, ilev, ilat, ilon]
+
+ var = cmor.variable(table_entry='ta', units='K', axis_ids=axes)
+
+-print "allocating mem for data"
++print ("allocating mem for data")
+ data = numpy.random.random((nlev, nlat, nlon)) * 30 + 273.15
+-print "moving on to writing"
++print ("moving on to writing")
+
+ for i in range(ntimes):
+- print 'Writing time:', i
++ print ('Writing time:', i)
+ cmor.write(var, data, time_vals=numpy.array(
+ [float(i), ]), time_bnds=numpy.array([i, i + 1.]))
+
+-print "closing var"
+-print cmor.close(var_id=var, file_name=True)
+-print "closing cmor"
++print ("closing var")
++print (cmor.close(var_id=var, file_name=True))
++print ("closing cmor")
+ cmor.close()
+-print "done"
++print ("done")
+
+
+-print 'hello'
++print ('hello')
+Index: cmor-3.2.5/Test/test_python_direct_calls.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_direct_calls.py
++++ cmor-3.2.5/Test/test_python_direct_calls.py
+@@ -1,4 +1,5 @@
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+ import cmor._cmor
+ import os
+ pth = os.path.split(os.path.realpath(os.curdir))
+@@ -25,7 +26,7 @@ tables = []
+ a = cmor._cmor.load_table("Tables/CMIP6_Omon.json")
+ tables.append(a)
+ tables.append(cmor._cmor.load_table("Tables/CMIP6_Amon.json"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+
+ axes = []
+@@ -49,7 +50,7 @@ units = "degrees_east"
+ myaxes[2] = cmor._cmor.axis(id, units, lon, alons, 'd', bnds_lon, 2, interval)
+ id = "plev19"
+ units = "Pa"
+-print plevs.astype("d")
++print (plevs.astype("d"))
+ myaxes[3] = cmor._cmor.axis(
+ id,
+ units,
+@@ -100,7 +101,7 @@ myaxes2[1] = myaxes[3]
+ 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],
+@@ -113,7 +114,7 @@ myvars[0] = cmor._cmor.variable(
+ varin2d[0],
+ "no history",
+ "no future")
+-print 'vars 2'
++print ('vars 2')
+ myvars[1] = cmor._cmor.variable(
+ entry3d[2],
+ units3d[2],
+@@ -126,7 +127,7 @@ myvars[1] = cmor._cmor.variable(
+ varin3d[2],
+ "no history",
+ "no future")
+-print 'vars 2'
++print ('vars 2')
+
+ myaxes2[1] = myaxes[4]
+ myvars[2] = cmor._cmor.variable(
+@@ -142,26 +143,26 @@ myvars[2] = cmor._cmor.variable(
+ "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])
+@@ -187,7 +188,7 @@ cmor.set_table(tables[1])
+
+ 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),
+Index: cmor-3.2.5/Test/test_python_grid_and_ocn_sigma.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_grid_and_ocn_sigma.py
++++ cmor-3.2.5/Test/test_python_grid_and_ocn_sigma.py
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor
+ import numpy
+ import os
+@@ -46,7 +46,7 @@ def gen_irreg_grid(lon, lat):
+ 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
+
+
+@@ -66,13 +66,13 @@ tables = []
+ a = cmor.load_table("CMIP6_grids.json")
+ tables.append(a)
+ tables.append(cmor.load_table("CMIP6_Omon.json"))
+-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',
+@@ -81,13 +81,13 @@ myaxes[0] = cmor.axis(table_entry='x',
+ 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'
+@@ -108,16 +108,16 @@ myaxes[3] = cmor.axis(table_entry='time'
+ # 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
++print ('Depth:', depth.shape, depth.dtype)
+ idpth = cmor.zfactor(zaxis_id=myaxes[4],
+ units='m',
+ zfactor_name='depth',
+@@ -125,7 +125,7 @@ idpth = cmor.zfactor(zaxis_id=myaxes[4],
+ ]),
+ zfactor_values=depth)
+
+-print 'defining zfactor eta'
++print ('defining zfactor eta')
+ ieta = cmor.zfactor(
+ zaxis_id=myaxes[4],
+ units='m',
+@@ -133,9 +133,9 @@ ieta = cmor.zfactor(
+ 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,
+@@ -148,12 +148,12 @@ Time[1], bnds_time[2:4] = read_time(1)
+ for i in range(ntimes):
+ data3d = numpy.random.random((lev, lon, lat, ntimes)) * 40. + 273.15
+ 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,data3d.shape,data3d)
++ # print (Time[i],bnds_time[2*i:2*i+2])
++ 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,
+Index: cmor-3.2.5/Test/test_python_index_coord.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_index_coord.py
++++ cmor-3.2.5/Test/test_python_index_coord.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -63,4 +64,4 @@ iv = cmor.variable(
+ cmor.write(iv, data)
+
+ f1 = cmor.close(iv, file_name=True)
+-print f1
++print (f1)
+Index: cmor-3.2.5/Test/test_python_jamie_11.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_jamie_11.py
++++ cmor-3.2.5/Test/test_python_jamie_11.py
+@@ -1,4 +1,5 @@
+ #****** Conflict with 'orog' in formula terms *****
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -92,7 +93,7 @@ if table_entry == 'hybrid_height':
+ units='m',
+ zfactor_values=data2d)
+ else:
+- print 'yep working case'
++ print ('yep working case')
+ ilev = cmor.axis(
+ table_entry='standard_sigma',
+ units='1',
+@@ -128,7 +129,7 @@ else:
+ axis_ids=numpy.array((ilon, ilat, itim)),
+ units='Pa')
+
+-print "ILEV is:", ilev
++print ("ILEV is:", ilev)
+ var3d_ids = cmor.variable(
+ table_entry='concdust',
+ units='kg m-3',
+Index: cmor-3.2.5/Test/test_python_joerg_3.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_joerg_3.py
++++ cmor-3.2.5/Test/test_python_joerg_3.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -115,17 +116,17 @@ for d in range(2):
+ for i in range(4):
+ tval = [i / 4. + d]
+ tbnd = [i / 4. + d - 0.125, i / 4. + d + 0.125]
+- print 'tvar', tval
+- print 'tbnd', tbnd
+- print 'writing time:', i, i / 4.
++ print ('tvar', tval)
++ print ('tbnd', tbnd)
++ print ('writing time:', i, i / 4.)
+ data = numpy.random.random((ntimes, nlev, nlat, nlon)) * 30. + 273
+ data = data.astype("f")
+ cmor.write(ivar1, data, time_vals=tval, time_bnds=tbnd)
+- 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)
+- 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(
+@@ -135,7 +136,7 @@ for d in range(2):
+ 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,
+@@ -143,11 +144,11 @@ for d in range(2):
+ 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)
+ file1 = cmor.close(ivar1, True)
+ file2 = cmor.close(ivar2, True)
+- print 'File1:', file1
+- print 'File2:', file2
++ print ('File1:', file1)
++ print ('File2:', file2)
+ cmor.close()
+-print cmor.close(ivar1, True)
++print (cmor.close(ivar1, True))
+ cmor.close()
+Index: cmor-3.2.5/Test/test_python_joerg_8.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_joerg_8.py
++++ cmor-3.2.5/Test/test_python_joerg_8.py
+@@ -1,4 +1,5 @@
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -26,7 +27,7 @@ tables = []
+ a = cmor.load_table("Tables/CMIP6_grids.json")
+ tables.append(a)
+ tables.append(cmor.load_table("Tables/CMIP6_Omon.json"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+ cmor.set_table(tables[0])
+
+@@ -46,7 +47,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ 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'
+@@ -67,7 +68,7 @@ myaxes[3] = cmor.axis(table_entry='time'
+
+ pass_axes = [myaxes[3], myaxes[2]]
+
+-print 'ok going to cmorvar'
++print ('ok going to cmorvar')
+ myvars[0] = cmor.variable(table_entry='eparag100',
+ units='mol m-2 s-1',
+ axis_ids=pass_axes,
+@@ -78,8 +79,8 @@ myvars[0] = cmor.variable(table_entry='e
+ )
+ 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-3.2.5/Test/test_python_max_variables_2.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_max_variables_2.py
++++ cmor-3.2.5/Test/test_python_max_variables_2.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -69,11 +70,11 @@ for it in range(ntimes):
+
+ 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-3.2.5/Test/test_python_open_close_cmor_multiple.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_open_close_cmor_multiple.py
++++ cmor-3.2.5/Test/test_python_open_close_cmor_multiple.py
+@@ -1,4 +1,4 @@
+-
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -99,9 +99,9 @@ for var in tvars:
+
+ 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-3.2.5/Test/test_python_singleton_anywhere_in_table_def.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_singleton_anywhere_in_table_def.py
++++ cmor-3.2.5/Test/test_python_singleton_anywhere_in_table_def.py
+@@ -1,6 +1,6 @@
+ #!/usr/bin/env python
+-
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -60,7 +60,7 @@ ts = 'days'
+ 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])
+
+@@ -80,7 +80,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ 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'
+@@ -111,9 +111,9 @@ myvars[0] = cmor.variable(table_entry=te
+ 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-3.2.5/Test/test_python_singleton_string.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_singleton_string.py
++++ cmor-3.2.5/Test/test_python_singleton_string.py
+@@ -1,6 +1,6 @@
+ #!/usr/bin/env python
+-
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -43,7 +43,7 @@ ts = 'months'
+ tscl = 3.5e-4
+
+ tables.append(cmor.load_table("Tables/%s" % t))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+ cmor.set_table(tables[0])
+
+@@ -63,7 +63,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ 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'
+@@ -94,9 +94,9 @@ myvars[0] = cmor.variable(table_entry=te
+ 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-3.2.5/Test/test_python_user_interface_01.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_user_interface_01.py
++++ cmor-3.2.5/Test/test_python_user_interface_01.py
+@@ -1,4 +1,5 @@
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -26,7 +27,7 @@ tables = []
+ a = cmor.load_table("CMIP6_grids.json")
+ tables.append(a)
+ tables.append(cmor.load_table("CMIP6_Amon.json"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+ cmor.set_table(tables[0])
+
+@@ -46,7 +47,7 @@ grid_id = cmor.grid(axis_ids=myaxes[:2],
+ 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'
+@@ -76,8 +77,8 @@ myvars[0] = cmor.variable(table_entry='h
+ )
+ for i in range(ntimes):
+ data2d = read_2d_input_files(i, varin2d[0], lat, lon)
+- print 'writing time: ', i, Time[i], data2d.shape, data2d
+- print Time[i], bnds_time[2 * i:2 * i + 2]
++ print ('writing time: ', i, 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-3.2.5/Test/test_python_user_interface_03.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_user_interface_03.py
++++ cmor-3.2.5/Test/test_python_user_interface_03.py
+@@ -1,13 +1,14 @@
++from __future__ import print_function
+ import numpy
+ import cmor
+ from time import localtime, strftime
+ today = strftime("%Y%m%d", localtime())
+
+-print 'Done importing'
++print ('Done importing')
+ try:
+ import cdms2
+ except BaseException:
+- 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
+@@ -55,7 +56,7 @@ def prep_var(data):
+ 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,
+@@ -81,13 +82,13 @@ def prep_cmor():
+
+
+ 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 @@ for var in ['tas', ]:
+ 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')
+Index: cmor-3.2.5/Test/cmor_speed_and_compression.py
+===================================================================
+--- cmor-3.2.5.orig/Test/cmor_speed_and_compression.py
++++ cmor-3.2.5/Test/cmor_speed_and_compression.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+ import sys
+@@ -11,7 +12,7 @@ try:
+ cdms2.setNetcdfDeflateFlag(0)
+ cdms2.setNetcdfDeflateLevelFlag(0)
+ except BaseException:
+- 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:
+@@ -48,7 +49,7 @@ cmor.dataset_json("Test/common_user_inpu
+
+ tables = []
+ tables.append(cmor.load_table("mytable"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+
+ # read in data, just one slice
+@@ -96,17 +97,17 @@ mincdms = 1000
+ c0 = st
+ s2 = s * 1
+ sh = list(s.shape)
+-print 'shape:', sh
++print ('shape:', sh)
+ sh.insert(0, 1)
+ s2 = MV2.reshape(s2, sh)
+ s2.setAxis(1, s.getLatitude())
+ s2.setAxis(2, s.getLongitude())
+ f = cdms2.open("Test/crap.nc", "w")
+ for i in range(ntimes):
+- # print 'Time:',i
++ # print ('Time:',i)
+ cmor.write(myvars[0], s.filled(), 1)
+ c = time.time()
+- # print 'cmor write time:',c-c0
++ # print ('cmor write time:',c-c0)
+ totcmor += c - c0
+ if maxcmor < c - c0:
+ maxcmor = c - c0
+@@ -137,12 +138,12 @@ ltime = cdtime.reltime(ntimes - 1, 'mont
+ lcmor = os.stat(
+ "CMIP6/CMIP6/ISMIP6/PCMDI/PCMDI-test-1-0/piControl-withism/r11i1p1f1/Amon/tas/gr/v%s/tas_Amon_PCMDI-test-1-0_piControl-withism_r11i1p1f1_gr_198001-%i%.2i.nc" %
+ (today, ltime.year, ltime.month))[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")
+@@ -157,7 +158,7 @@ dic[(level, shuffle)] = (float(lcmor) /
+ 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()
+Index: cmor-3.2.5/Test/cmor_speed_and_compression_02.py
+===================================================================
+--- cmor-3.2.5.orig/Test/cmor_speed_and_compression_02.py
++++ cmor-3.2.5/Test/cmor_speed_and_compression_02.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+ import sys
+@@ -8,7 +9,7 @@ today = strftime("%Y%m%d", localtime())
+ try:
+ import cdms2
+ except BaseException:
+- print "This test code needs cdms2 interface for i/0"
++ print ("This test code needs cdms2 interface for i/0")
+ sys.exit()
+
+ cdms2.setNetcdfShuffleFlag(0)
+@@ -62,7 +63,7 @@ cmor.dataset(
+
+ tables = []
+ tables.append(cmor.load_table("mytable"))
+-print 'Tables ids:', tables
++print ('Tables ids:', tables)
+
+
+ # read in data, just one slice
+@@ -86,7 +87,7 @@ except BaseException:
+ except BaseException:
+ missing_value = None
+
+-print 'Missing:', type(missing_value), missing_value
++print ('Missing:', type(missing_value), missing_value)
+ #missing_value = -999.
+ myaxes[0] = cmor.axis(table_entry='latitude',
+ units='degrees_north',
+@@ -126,12 +127,12 @@ c0 = st
+ f = cdms2.open("Test/crap.nc", "w")
+ step = 10
+ for i in range(0, ntimes, step):
+- print 'Time:', i
++ print ('Time:', i)
+ j1 = i
+ j2 = i + step
+ cmor.write(myvars[0], s[j1:j2].filled(), step, file_suffix="speed-comp-02")
+ c = time.time()
+- # print 'cmor write time:',c-c0
++ # print ('cmor write time:',c-c0)
+ totcmor += c - c0
+ if maxcmor < c - c0:
+ maxcmor = c - c0
+@@ -152,7 +153,7 @@ for i in range(0, ntimes, step):
+ s2.setAxis(0, t)
+ f.write(s2, id=var)
+ c = time.time()
+- # print 'cdms time:',c-c0
++ # print ('cdms time:',c-c0)
+ totcdms += c - c0
+ if maxcdms < c - c0:
+ maxcdms = c - c0
+@@ -166,17 +167,17 @@ import cdtime
+ import os
+ ltime = cdtime.reltime(Tim[ntimes - 1], Tim.units).tocomp()
+ ftime = cdtime.reltime(Tim[0], Tim.units).tocomp()
+-print ftime, ltime
++print (ftime, ltime)
+ print (var, var, ftime.year, ftime.month, ltime.year, ltime.month)
+ lcmor = os.stat(
+ "Test/IPCC_Fourth_Assessment/output/INSTITUTE_ID/pcmdi-09a/mon/REALM/%s/r1/%s_A1_pcmdi-09a_r1_%i%.2i-%i%.2i_speed-comp-02.nc" %
+ (var, var, ftime.year, ftime.month, ltime.year, ltime.month))[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")
+@@ -191,7 +192,7 @@ dic[(level, shuffle)] = (float(lcmor) /
+ 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()
+Index: cmor-3.2.5/Test/test_python_jamie_6.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_jamie_6.py
++++ cmor-3.2.5/Test/test_python_jamie_6.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -92,7 +93,7 @@ if table_entry == 'hybrid_height':
+ 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-3.2.5/Test/test_python_user_interface_00.py
+===================================================================
+--- cmor-3.2.5.orig/Test/test_python_user_interface_00.py
++++ cmor-3.2.5/Test/test_python_user_interface_00.py
+@@ -1,4 +1,5 @@
+-from test_python_common import * # common subroutines
++from __future__ import print_function
++from .test_python_common import * # common subroutines
+
+ import cmor._cmor
+ import os
+@@ -26,12 +27,12 @@ tables = []
+ a = cmor.load_table(os.path.join("CMIP6_Omon.json"))
+ tables.append(a)
+ tables.append(cmor.load_table("CMIP6_Amon.json"))
+-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))
+@@ -42,7 +43,7 @@ myaxes[0] = cmor.axis(
+ 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,7 +88,7 @@ myaxes2[1] = myaxes[3]
+ 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],
+@@ -98,36 +99,36 @@ myvars[0] = cmor.variable(entry2d[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])
+@@ -147,7 +148,7 @@ cmor.set_table(tables[1])
+
+ 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-3.2.5/Src/_controlvocabulary.c
+===================================================================
+--- cmor-3.2.5.orig/Src/_controlvocabulary.c
++++ cmor-3.2.5/Src/_controlvocabulary.c
+@@ -633,8 +633,52 @@ static PyMethodDef MyExtractMethods[] =
+ {NULL, NULL} /*sentinel */
+ };
+
++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
++
++#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,
++ "_cmip6_cv",
++ NULL,
++ sizeof(struct module_state),
++ MyExtractMethods,
++ NULL,
++ MyExtract_traverse,
++ MyExtract_clear,
++ NULL
++};
++#endif
++
+ PyMODINIT_FUNC init_cmip6_cv(void)
+ {
+- (void)Py_InitModule("_cmip6_cv", MyExtractMethods);
++#if PY_MAJOR_VERSION >= 3
++PyObject *module = PyModule_Create(&moduledef);
++#else
++ (void)Py_InitModule("_cmip6_cv", MyExtractMethods);
++#endif
+ import_array();
++
++#if PY_MAJOR_VERSION >= 3
++ return module;
++#endif
+ }
diff --git a/debian/patches/shlib-link.patch b/debian/patches/shlib-link.patch
index e71b2ff..7f8c76c 100644
--- a/debian/patches/shlib-link.patch
+++ b/debian/patches/shlib-link.patch
@@ -3,16 +3,16 @@ Description: Bugfix to link libcmor.so.2 against -lossp-uuid
Last-Updated: 2016-12-20
Forwarded: no
-Index: cmor-3.2.1/Makefile.in
+Index: cmor-3.2.5/Makefile.in
===================================================================
---- cmor-3.2.1.orig/Makefile.in
-+++ cmor-3.2.1/Makefile.in
+--- cmor-3.2.5.orig/Makefile.in
++++ cmor-3.2.5/Makefile.in
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
FC=@FC@
CC=@CC@
CFLAGS=@CFLAGS@
-@@ -34,11 +33,14 @@ MACROS=@MACROS@
+@@ -35,11 +34,14 @@ MACROS=@MACROS@
# Library name
LIBNAME=libcmor.a
@@ -27,12 +27,13 @@ Index: cmor-3.2.1/Makefile.in
LIBFILES=@LIBFILES@
-@@ -48,58 +50,75 @@ INCFILES=@INCFILES@
+@@ -49,59 +51,76 @@ INCFILES=@INCFILES@
# Temporary Files
TMPFILES=*~ $(LIBFILES) *.mod a.out *.stb Test/*.nc Test/IPCC_Fourth_Assessment *.LOG* *.dSYM Test/IPCC Test/CMIP5 CMIP5
DISTFILES=libcmor.a
-DEPEND= makedepend -c ${DEBUG} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS}
+DEPEND= makedepend -c ${DEBUG} ${CFLAGS} ${USERCFLAGS} ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS}
+ UNAME := $(shell uname)
all: cmor
@echo
@@ -127,22 +128,7 @@ Index: cmor-3.2.1/Makefile.in
cmor_fortran_interface.o: Src/cmor_fortran_interface.f90
${FC} -c ${FCFLAGS} ${USERFFLAGS} ${DEBUG} ${MACROS} Src/cmor_fortran_interface.f90
cmor: $(LIBFILES) @MAKEDEPPYTHON@
-@@ -135,10 +154,10 @@ backup: clean
- test: cmor test_C @TEST_FORTRAN@ @MAKETESTPYTHON@
- @echo "All C and Fortran Test passed successfully"
- test_C: cmor
-- rm -f ./ipcc_test_code ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/ipcc_test_code.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ @LDFLAGS@ -o ipcc_test_code @VERB@; ./ipcc_test_code @VERB@
-- @rm -f test_grid ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_grid.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ -o test_grid @LDFLAGS@ @VERB@; ./test_grid @VERB@;
-- @rm -f test_lots_of_variables ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_lots_of_variables.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ @LDFLAGS@ -o test_lots_of_variables @VERB@; ./test_lots_of_variables @VERB@;
-- @rm -f test_cat_unique ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_unit_cat_unique.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDFLAGS@ @LDFLAGS@ -o test_unit_cat_unique @VERB@; ./test_unit_cat_unique @VERB@;
-+ rm -f ./ipcc_test_code ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/ipcc_test_code.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDLDFLAGS@ @LDFLAGS@ -o ipcc_test_code @VERB@; ./ipcc_test_code @VERB@
-+ @rm -f test_grid ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_grid.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDLDFLAGS@ -o test_grid @LDFLAGS@ @VERB@; ./test_grid @VERB@;
-+ @rm -f test_lots_of_variables ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_lots_of_variables.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDLDFLAGS@ @LDFLAGS@ -o test_lots_of_variables @VERB@; ./test_lots_of_variables @VERB@;
-+ @rm -f test_cat_unique ; @CC@ @CFLAGS@ @USERCFLAGS@ @CPPFLAGS@ Test/test_unit_cat_unique.c -L at prefix@/lib -I at prefix@/include -L. -lcmor @NCCFLAGS@ @NCLDFLAGS@ @UDUNITS2LDFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @UUIDLDFLAGS@ @LDFLAGS@ -o test_unit_cat_unique @VERB@; ./test_unit_cat_unique @VERB@;
- python:
- @echo "Building Python interface"
- @${PYTHONEXEC} setup.py install @CDATPREFIX@
-@@ -207,7 +226,7 @@ test_python: python
+@@ -218,7 +237,7 @@ test_python: python
test_case:
@echo "${OK_COLOR}Testing: "${TEST_NAME}" with input file: ${INPUT_FILE}${NO_COLOR}"
@@ -151,7 +137,7 @@ Index: cmor-3.2.1/Makefile.in
@./${TEST_NAME} ${VERB} < ${INPUT_FILE} ;
@ rm ./${TEST_NAME}
ifeq (@MAKEDEPPYTHON@,python)
-@@ -215,7 +234,7 @@ ifeq (@MAKEDEPPYTHON@,python)
+@@ -226,7 +245,7 @@ ifeq (@MAKEDEPPYTHON@,python)
endif
test_case_old_cmor_tables:
@echo "Testing: "${TEST_NAME}" with input file: "${INPUT_FILE}
--
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