[cmor] 05/13: Update python3
Alastair McKinstry
mckinstry at moszumanska.debian.org
Thu Apr 20 10:37:03 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 76acbe9868fc4f5702d62102320f291c0162d17b
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Tue Dec 20 12:58:03 2016 +0000
Update python3
---
debian/patches/python3.patch | 285 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 283 insertions(+), 2 deletions(-)
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index f692db3..6932229 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -1210,9 +1210,10 @@ Index: cmor-3.2.1/Test/test_python_2Gb_slice.py
-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"
++print ("closing cmor")
cmor.close()
-print "done"
+print ("done")
@@ -2158,7 +2159,8 @@ Index: cmor-3.2.1/Test/test_python_joerg_3.py
+ print ('File1:',file1)
+ print ('File2:',file2)
cmor.close()
- print cmor.close(ivar1,True)
+-print cmor.close(ivar1,True)
++print (cmor.close(ivar1,True))
cmor.close()
Index: cmor-3.2.1/Test/test_python_joerg_8.py
===================================================================
@@ -3047,3 +3049,282 @@ Index: cmor-3.2.1/LibCV/__init__.py
-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
+===================================================================
+--- 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
+@@ -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():
+ cmor.write(varid, data)
+ 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
+===================================================================
+--- cmor-3.2.1.orig/Test/test_python_polar_stereo.py
++++ cmor-3.2.1/Test/test_python_polar_stereo.py
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import print_function
+ import cmor
+ import cdms2
+ import numpy
+@@ -25,7 +25,7 @@ te = 'orog'
+ u='m'
+
+ tables.append(cmor.load_table("%s" % t))
+-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)
+
+-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
+===================================================================
+--- cmor-3.2.1.orig/Test/test_checker_works.py
++++ cmor-3.2.1/Test/test_checker_works.py
+@@ -1,7 +1,7 @@
+-####
++--- Test/test_checker_works.pylint(original)0;95;c####
+ # This is trying to test all that cmor_checker catches all the possible failures
+ ###
+-
++from __future__ import print_function
+ import sys
+ import cmor
+ import shutil
+@@ -1732,13 +1732,13 @@ cmor.checkCMOR(fo,file,"Tables/CMIP5_6hr
+ ## 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
++ raise Exception("missing var att %s test failed" % att)
+ except cmor.check_CMOR_compliant.CMORError,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)
++ raise Exception("Checker of variable type failed for the wrong reason! %s" % (err))
+ except Exception,err:
+- raise Exception,err
++ raise Exception(err)
+ os.remove(F)
+
+
+Index: cmor-3.2.1/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
+@@ -2,6 +2,7 @@
+ # Peter Uhe 24 July 2014
+ # Martin Dix 21 Nov 2014
+ #
++from __future__ import print_function
+ 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.
+ 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:
+ raise Exception("ERROR closing cmor file!")
+
+- print path
++ print (path)
+
+ if __name__ == "__main__":
+
+Index: cmor-3.2.1/Test/test_python_jamie.py
+===================================================================
+--- cmor-3.2.1.orig/Test/test_python_jamie.py
++++ cmor-3.2.1/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():
+ cmor.write(varid, [275])
+ 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
+===================================================================
+--- 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
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import cmor
+ import numpy
+
+@@ -32,12 +33,13 @@ 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)
+
+ 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")
+ varid = cmor.variable(var,
+ units,
--
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