debian/0000755000000000000000000000000012167353464007201 5ustar debian/control0000644000000000000000000000241412167277405010605 0ustar Source: python-cdo Section: utils Priority: extra Maintainer: Alastair McKinstry Build-Depends: debhelper (>= 9), python-all-dev, python-setuptools, python3-all-dev, python3-setuptools, python-numpy, python3-numpy Standards-Version: 3.9.4 Homepage: http://pypi.python.org/pypi/cdo X-Python-Version: >= 2.6 X-Python3-Version: >= 3.2 Package: python-cdo Section: python Architecture: any Depends: ${python:Depends}, ${misc:Depends}, cdo, python-numpy Provides: ${python:Provides} Description: Python module for Climate Data Operators Climate Data Operators are a collection of command line Operators to manipulate and analyse Climate model Data. Supported data formats are GRIB, netCDF, SERVICE, EXTRA and IEG. There are more than 400 operators available. . This package provides a Python wrapper for CDO. Package: python3-cdo Section: python Architecture: any Depends: ${python3:Depends}, ${misc:Depends}, cdo, python3-numpy Description: Python3 module for Climate Data Operators Climate Data Operators are a collection of command line Operators to manipulate and analyse Climate model Data. Supported data formats are GRIB, netCDF, SERVICE, EXTRA and IEG. There are more than 400 operators available. . This package provides a Python3 wrapper for CDO. debian/watch0000644000000000000000000000011612167272420010220 0ustar version=3 http://pypi.python.org/packages.source/c/cdo/cdo-([\d\.]*)\.tar\.gz debian/source/0000755000000000000000000000000012167272420010471 5ustar debian/source/lintian-overrides0000644000000000000000000000007612167272420014055 0ustar cdo source: package-needs-versioned-debhelper-build-depends 9 debian/source/format0000644000000000000000000000001412167272420011677 0ustar 3.0 (quilt) debian/patches/0000755000000000000000000000000012167300134010612 5ustar debian/patches/series0000644000000000000000000000004412167272533012040 0ustar avoid_szip_test.patch python3.patch debian/patches/avoid_szip_test.patch0000644000000000000000000000231312167272533015053 0ustar Description: cdo in Debian not built with szip support; avoid this test. Author: Alastair McKinstry Last-Updated: 2013-01-16 Forwarded: no Index: python-cdo-1.2.1/test/test_cdo.py =================================================================== --- python-cdo-1.2.1.orig/test/test_cdo.py 2013-07-10 15:52:52.000000000 +0100 +++ python-cdo-1.2.1/test/test_cdo.py 2013-07-10 15:52:52.000000000 +0100 @@ -72,12 +72,12 @@ self.assertEqual([50.0, 100.0, 200.0, 300.0, 450.0, 600.0, 800.0, 1000.0, 1000.0, 1000.0], cdo.thicknessOfLevels(input = ofile)) - def test_CDO_options(self): - cdo = Cdo() - names = cdo.showname(input = "-stdatm,0",options = "-f nc") - self.assertEqual(["P T"],names) - ofile = cdo.topo(options = "-z szip") - self.assertEqual(["GRIB SZIP"],cdo.showformat(input = ofile)) + #def test_CDO_options(self): + # cdo = Cdo() + # names = cdo.showname(input = "-stdatm,0",options = "-f nc") + # self.assertEqual(["P T"],names) + # ofile = cdo.topo(options = "-z szip") + # self.assertEqual(["GRIB SZIP"],cdo.showformat(input = ofile)) def test_chain(self): cdo = Cdo() debian/patches/python3.patch0000644000000000000000000001551312167300134013244 0ustar Author: Alastair McKinstry Description: Support for Python3. Last-Updated: 2013-07-10 Forwarded: no Index: python-cdo-1.2.1/cdo.py =================================================================== --- python-cdo-1.2.1.orig/cdo.py 2013-07-10 16:33:06.000000000 +0100 +++ python-cdo-1.2.1/cdo.py 2013-07-10 16:33:31.000000000 +0100 @@ -1,6 +1,8 @@ +from __future__ import print_function, division import os,re,subprocess,tempfile,random,string import numpy as np + # Copyright (C) 2011-2012 Ralf Mueller, ralf.mueller@zmaw.de # See COPYING file for copying and redistribution conditions. # @@ -57,7 +59,7 @@ 'tstepcount','vardes','vardup','varmul','varquot2test','varrms','vertwind','write_e5ml', 'writegrid','writerandom','yearcount'] - if os.environ.has_key('CDO'): + if 'CDO' in os.environ: self.CDO = os.environ['CDO'] else: self.CDO = 'cdo' @@ -78,9 +80,9 @@ def call(self,cmd): if self.debug: - print '# DEBUG =====================================================================' - print 'CALL:'+' '.join(cmd) - print '# DEBUG =====================================================================' + print('# DEBUG =====================================================================') + print(('CALL:'+' '.join(cmd))) + print('# DEBUG =====================================================================') proc = subprocess.Popen(' '.join(cmd), shell = True, @@ -93,7 +95,7 @@ def hasError(self,method_name,cmd,retvals): if (self.debug): - print("RETURNCODE:"+retvals["returncode"].__str__()) + print(("RETURNCODE:"+retvals["returncode"].__str__())) if ( 0 != retvals["returncode"] ): print("Error in calling operator " + method_name + " with:") print(">>> "+' '.join(cmd)+"<<<") @@ -127,7 +129,7 @@ cmd = [self.CDO,kwargs["options"],','.join(operator),' '.join(io)] retvals = self.call(cmd) if ( not self.hasError(method_name,cmd,retvals) ): - r = map(string.strip,retvals["stdout"].split(os.linesep)) + r = list(map(string.strip,retvals["stdout"].split(os.linesep))) return r[:len(r)-1] else: raise CDOException(**retvals) @@ -163,14 +165,14 @@ if ((method_name in self.__dict__) or (method_name in self.operators)): if self.debug: - print("Found method:" + method_name) + print(("Found method:" + method_name)) return get.__get__(self) else: # If the method isn't in our dictionary, act normal. print("#=====================================================") print("Cannot find method:" + method_name) - raise AttributeError, method_name + raise AttributeError( method_name) def getOperators(self): import os @@ -194,7 +196,7 @@ self.cdf = cdf self.cdfMod = "netcdf4" except: - raise ImportError,"scipy or python-netcdf4 module is required to return numpy arrays." + raise ImportError("scipy or python-netcdf4 module is required to return numpy arrays.") def setReturnArray(self,value=True): @@ -222,7 +224,7 @@ stderr = subprocess.PIPE, stdout = subprocess.PIPE) retvals = proc.communicate() - print retvals + print(retvals) def setCdo(self,value): self.CDO = value @@ -246,7 +248,7 @@ return match.group(1) def boundaryLevels(self,**kwargs): - ilevels = map(float,self.showlevel(input = kwargs['input'])[0].split()) + ilevels = list(map(float,self.showlevel(input = kwargs['input'])[0].split())) bound_levels = [] bound_levels.insert(0,0) for i in range(1,len(ilevels)+1): @@ -277,7 +279,7 @@ elif ( "netcdf4" == self.cdfMod ): fileObj = self.cdf.Dataset(iFile) else: - raise ImportError,"Could not import data from file '" + iFile + "'" + raise ImportError("Could not import data from file '" + iFile + "'") retval = fileObj fileObj.close() @@ -290,7 +292,7 @@ # return the data array return filehandle.variables[varname][:] else: - print "Cannot find variable '" + varname +"'" + print(("Cannot find variable '" + varname +"'")) return False def readMaArray(self,iFile,varname): Index: python-cdo-1.2.1/test/test_cdo.py =================================================================== --- python-cdo-1.2.1.orig/test/test_cdo.py 2013-07-10 16:33:06.000000000 +0100 +++ python-cdo-1.2.1/test/test_cdo.py 2013-07-10 16:33:06.000000000 +0100 @@ -1,3 +1,5 @@ +from __future__ import print_function + import unittest,os,tempfile from stat import * from cdo import * @@ -54,7 +56,7 @@ cdo = Cdo() levels = cdo.showlevel(input = "-stdatm,0") info = cdo.sinfo(input = "-stdatm,0") - self.assertEqual([0,0],map(float,levels)) + self.assertEqual([0,0],list(map(float,levels))) self.assertEqual("File format: GRIB",info[0]) values = cdo.outputkey("value",input="-stdatm,0") @@ -72,12 +74,12 @@ self.assertEqual([50.0, 100.0, 200.0, 300.0, 450.0, 600.0, 800.0, 1000.0, 1000.0, 1000.0], cdo.thicknessOfLevels(input = ofile)) - #def test_CDO_options(self): - # cdo = Cdo() - # names = cdo.showname(input = "-stdatm,0",options = "-f nc") - # self.assertEqual(["P T"],names) - # ofile = cdo.topo(options = "-z szip") - # self.assertEqual(["GRIB SZIP"],cdo.showformat(input = ofile)) + def test_CDO_options(self): + cdo = Cdo() + names = cdo.showname(input = "-stdatm,0",options = "-f nc") + self.assertEqual(["P T"],names) + ofile = cdo.topo(options = "-z szip") + self.assertEqual(["GRIB SZIP"],cdo.showformat(input = ofile)) def test_chain(self): cdo = Cdo() @@ -88,7 +90,7 @@ cdo = Cdo() cdo.debug = True diffv = cdo.diffn(input = "-random,r1x1 -random,r1x1") - print diffv + print(diffv) self.assertEqual(diffv[1].split(' ')[-1],"random") self.assertEqual(diffv[1].split(' ')[-3],"0.53060") diff = cdo.diff(input = "-random,r1x1 -random,r1x1") @@ -267,13 +269,13 @@ if 'thingol' == os.popen('hostname').read().strip(): def testCall(self): cdo = Cdo() - print cdo.sinfov(input='/home/ram/data/icon/oce.nc') + print(cdo.sinfov(input='/home/ram/data/icon/oce.nc')) def test_readCdf(self): cdo = Cdo() input= "-settunits,days -setyear,2000 -for,1,4" cdfFile = cdo.copy(options="-f nc",input=input) cdf = cdo.readCdf(cdfFile) - self.assertEqual(['lat','lon','for','time'],cdf.variables.keys()) + self.assertEqual(['lat','lon','for','time'],list(cdf.variables.keys())) def testTmp(self): cdo = Cdo() debian/rules0000755000000000000000000000122512167277356010266 0ustar #!/usr/bin/make -f export DH_VERBOSE=1 PYVERS:=$(shell pyversions -r) PY3VERS:=$(shell py3versions -r) # The magic debhelper rule %: dh $@ --with python2,python3 override_dh_auto_clean: rm -f test.nc ofile.nc rm -fr *.egg-info build dh_auto_clean #override_dh_auto_test: # for pyvers in $(shell pyversions -r) ; do \ # $$pyvers ./test/test_cdo.py ; done build-python%: python$* setup.py build override_dh_auto_build: $(PYTHON3:%=build-python%) dh_auto_build override_dh_auto_install: for p in $(PYVERS) $(PY3VERS) ; do \ $$p setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb ; \ done dh_numpy dh_numpy3 dh_auto_install debian/compat0000644000000000000000000000000212167272420010367 0ustar 9 debian/python-cdo.install0000644000000000000000000000002212167273340012641 0ustar /usr/lib/python2* debian/python3-cdo.install0000644000000000000000000000002112167273355012731 0ustar /usr/lib/python3 debian/changelog0000644000000000000000000000321012167353451011043 0ustar python-cdo (1.2.1-6) unstable; urgency=low * Python3 support. Add python3-cdo. -- Alastair McKinstry Wed, 10 Jul 2013 15:38:28 +0100 python-cdo (1.2.1-5) unstable; urgency=low * Remove dependencies on python-support, cdo. Not used. * Remove autogenerated files so that it builds twice-in-a-row -- Alastair McKinstry Sun, 19 May 2013 06:29:46 +0100 python-cdo (1.2.1-4) unstable; urgency=low * Disable testing. Do via DEP-8 later instead. -- Alastair McKinstry Sat, 26 Jan 2013 14:12:04 +0000 python-cdo (1.2.1-3) unstable; urgency=low * Add dependency on cdo, needed for testing. -- Alastair McKinstry Fri, 18 Jan 2013 14:14:56 +0000 python-cdo (1.2.1-2) unstable; urgency=low * Use python-all-dev rather than python-dev to ensure all python versions are included for testing. -- Alastair McKinstry Fri, 18 Jan 2013 13:02:41 +0000 python-cdo (1.2.1-1) unstable; urgency=low * New upstream release. * Move to debhelper >=9 dependency and Standards-Version: 3.9.4; no changes required. * Run the tests/ test suite from debian/rules testing target. -- Alastair McKinstry Wed, 16 Jan 2013 21:46:06 +0000 python-cdo (1.0.9-2) unstable; urgency=low * Use clean pbuilder cache when building. Add setuptools to B-D. Closes: #672502. -- Alastair McKinstry Thu, 10 May 2012 19:02:21 +0100 python-cdo (1.0.9-1) unstable; urgency=low * Initial release. (Closes: #660347) -- Alastair McKinstry Tue, 25 Apr 2012 10:17:37 +0000 debian/copyright0000644000000000000000000000122212167272420011121 0ustar This package was debianized by Alastair McKinstry , on Mon, 6 Apr 2009 16:22:04 +0100. It was downloaded from http://www.mpimet.mpg.de/fileadmin/software/cdo/ Upstream authors: Uwe Schulzweida, Uwe.Schulzweida@zmaw.de, is the main author. Luis Kornblueh, Luis.Kornblueh@zmaw.de Ralf Quast, Ralf.Quast@brockmann-consult.de Copyright (C) 2003--2009 Uwe Schulzweidaa. Licensed under the GNU General Public License. The texts of the license can be found in /usr/share/common-licenses/GPL-2 The Debian packaging is Copyright (C) 2009, Alastair McKinstry , is licensed under the terms of the GNU GPL version 2.