[pyferret] 97/110: refresh patches
Alastair McKinstry
mckinstry at moszumanska.debian.org
Fri Jul 28 08:42:25 UTC 2017
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository pyferret.
commit aa754fd10d033bad33a6faea72e747a45d4ad09a
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Sun Jun 25 11:18:38 2017 +0100
refresh patches
---
debian/patches/automate-tests.parch | 28 +-
debian/patches/python3.patch | 4503 -----------------------------------
debian/patches/reproducible.patch | 14 +-
debian/patches/set-envvars.patch | 18 +-
debian/patches/soname-fix.patch | 32 +-
5 files changed, 46 insertions(+), 4549 deletions(-)
diff --git a/debian/patches/automate-tests.parch b/debian/patches/automate-tests.parch
index b1d0238..41e4071 100644
--- a/debian/patches/automate-tests.parch
+++ b/debian/patches/automate-tests.parch
@@ -3,11 +3,11 @@ Description: local changes to make tests automated under Debian
Last-Updated: 2016-03-01
Forwarded: not-needed
-Index: pyferret-7.0.0/bench/run_all
+Index: pyferret-7.1.1.beta/bench/run_all
===================================================================
---- pyferret-7.0.0.orig/bench/run_all
-+++ pyferret-7.0.0/bench/run_all
-@@ -55,6 +55,8 @@
+--- pyferret-7.1.1.beta.orig/bench/run_all
++++ pyferret-7.1.1.beta/bench/run_all
+@@ -56,6 +56,8 @@
# *sh* 4/2015 automatically run clean_draconian at the end
@@ -16,18 +16,18 @@ Index: pyferret-7.0.0/bench/run_all
umask 002 # make all files group deletable 3/16
set rhlev = "0"
-@@ -76,8 +78,8 @@ if ($rhlev == six) then
+@@ -77,7 +79,9 @@ if ($rhlev == six) then
echo six
endif
-echo "Enter the path (including filename) to the FERRET version of choice"
--set fver = $<
-+# echo "Enter the path (including filename) to the FERRET version of choice"
-+set fver = /usr/bin/ferret_c
-
- # XGKS version ? (use "xg" as the indicator)
- echo $fver | grep -s "xg"
-@@ -88,14 +90,14 @@ endif
++# echo "Enter the path (including filename) to the FERRET version of choice"
++set fver /usr/bin/ferret_c
++
+ set fver = $<
+ if ( ! -e $fver ) then
+ echo File $fver not exist.
+@@ -93,14 +97,14 @@ endif
# *acm* 4/5/05 optionally do externally-linked external function tests
#
echo "Run tests of externally-linked external functions? Enter y or n"
@@ -44,7 +44,7 @@ Index: pyferret-7.0.0/bench/run_all
echo "Contents of "$efdir "fcns a* :"
echo " "
ls -1 $efdir/a*
-@@ -105,11 +107,12 @@ endif
+@@ -110,11 +114,12 @@ endif
# background info to go in the benchmark file
echo "Enter your name"
@@ -60,7 +60,7 @@ Index: pyferret-7.0.0/bench/run_all
set date_stamp = `date +'%d%h%yAT%H%M'|tr '[A-Z]' '[a-z]'`
set log_file = "all_${date_stamp}.${machine}_log"
-@@ -131,7 +134,7 @@ if ( ! -e $machine_stream ) then
+@@ -136,7 +141,7 @@ if ( ! -e $machine_stream ) then
echo To create $machine_stream compile and run make_stream_file.F
echo Then rename stream10by5.unf to $machine_stream
echo -n 'Continue anyway? (answer "y" for yes)'
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
deleted file mode 100644
index f0d3151..0000000
--- a/debian/patches/python3.patch
+++ /dev/null
@@ -1,4503 +0,0 @@
-Author: Alastair McKinstry <mckinstry at debian.org>
-Description: Support Python3
-Last-Updated: 2016-08-15
-Forwarded: no
-
-Index: pyferret-7.0.0/ferretmagic.py
-===================================================================
---- pyferret-7.0.0.orig/ferretmagic.py
-+++ pyferret-7.0.0/ferretmagic.py
-@@ -48,6 +48,7 @@ Usage
- # https://cdcvs.fnal.gov/redmine/projects/ipython_ext/repository/revisions/master/raw/ipythonPexpect.py
- #-----------------------------------------------------------------------------
-
-+from __future__ import print_function
- import os.path
- import tempfile
- import math
-@@ -238,8 +239,8 @@ class ferretMagics(Magics):
- rmtree(temp_dir)
-
- # Error in ferret code - Delete temporary directory
-- else:
-- rmtree(temp_dir)
-+ else:
-+ rmtree(temp_dir)
-
- # Publication
- for source, data in display_data:
-@@ -422,8 +423,8 @@ class ferretMagics(Magics):
-
- self._shell.ferret_locked = True
-
-- print 'WARNING: All future cell execution will be processed through pyferret!'
-- print 'To return to IPython, issue %ferret_unlock'
-+ print ('WARNING: All future cell execution will be processed through pyferret!')
-+ print ('To return to IPython, issue %ferret_unlock')
-
- @line_magic
- def ferret_unlock(self, line):
-@@ -434,7 +435,7 @@ class ferretMagics(Magics):
-
- self._shell.ferret_locked = False
-
-- print 'Notebook will use IPython'
-+ print ('Notebook will use IPython')
-
- # Let's rewrite InteractiveShell.run_cell to do automatic processing with pyferret,
- # if desired
-Index: pyferret-7.0.0/gcircle.py
-===================================================================
---- pyferret-7.0.0.orig/gcircle.py
-+++ pyferret-7.0.0/gcircle.py
-@@ -4,9 +4,11 @@ Module of functions involving great circ
- with points given in longitudes and latitudes.
- """
-
-+from __future__ import print_function
- import math
- import numpy
- import numpy.random
-+from past.builtins import xrange
-
- # Equitorial radius of the earth in kilometers
- EARTH_ER = 6378.137
-@@ -384,15 +386,15 @@ if __name__ == "__main__":
- dists = lonlatdistance(0.0, 0.0, tenten, 0.0)
- if not numpy.allclose(dists, tenten):
- raise ValueError("Equatorial distances FAIL; expect: %s; found: %s" % (str(tenten), str(dists)))
-- print "Equatorial distance: PASS"
-- print
-+ print ("Equatorial distance: PASS")
-+ print ()
-
- # On any meridian, distance = delta latitude
- dists = lonlatdistance(20.0, 0.0, 20.0, tenten)
- if not numpy.allclose(dists, tenten):
- raise ValueError("Meridional distances FAIL; expect: %s; found: %s" % (str(tenten), str(dists)))
-- print "Meridional distance: PASS"
-- print
-+ print ("Meridional distance: PASS")
-+ print ()
-
- # Play with some distances between cities (deg W, deg N)
- seattle = (122.0 + (20.0 / 60.0), 47.0 + (37.0 / 60.0))
-@@ -415,8 +417,8 @@ if __name__ == "__main__":
- raise ValueError("Seattle, Portland, Spokane distance matrix in miles\n" \
- " expect: %s\n"
- " found: %s" % (str(expected), str(dists)))
-- print "Seattle, Portland, Spokane distance matrix: PASS"
-- print
-+ print ("Seattle, Portland, Spokane distance matrix: PASS")
-+ print ()
-
- lons = ( austin[0], houston[0], dallas[0] )
- lons1, lons2 = numpy.meshgrid(lons, lons)
-@@ -431,8 +433,8 @@ if __name__ == "__main__":
- raise ValueError("Austin, Houston, Dallas distance matrix in miles\n" \
- " expect: %s\n"
- " found: %s" % (str(expected), str(dists)))
-- print "Austin, Houston, Dallas distance matrix: PASS"
-- print
-+ print ("Austin, Houston, Dallas distance matrix: PASS")
-+ print ()
-
- # Test lonlatintersect
- # Intersections of the equator with meridians
-@@ -469,8 +471,8 @@ if __name__ == "__main__":
- if not numpy.allclose(pt2lats[1:-1], 0.0):
- raise ValueError("Valid pt2lats: expect: all zeros, found %s" %\
- str(pt2lats[1:-1]))
-- print "Equator/meridian intersections: PASS"
-- print
-+ print ("Equator/meridian intersections: PASS")
-+ print ()
-
- ((pt1lons, pt1lats), (pt2lons, pt2lats)) = \
- lonlatintersect( 0.0, 89.99, 180.0, 89.99,
-@@ -482,8 +484,8 @@ if __name__ == "__main__":
- (str([45.0, 90.0, 135.0, -90.0]),
- str([float(pt1lons), float(pt1lats),
- float(pt2lons), float(pt2lats)])))
-- print "Mini north pole cross intersections: PASS"
-- print
-+ print ("Mini north pole cross intersections: PASS")
-+ print ()
-
-
- # Test lonlatfwdpt
-@@ -491,15 +493,15 @@ if __name__ == "__main__":
- if not ( numpy.allclose(lons, portland[0]) and numpy.allclose(lats, portland[1]) ):
- raise ValueError("Zero forward from portland to spokane: expect %s, found %s" % \
- (str(portland), str((lons, lats))))
-- print "Zero forward: PASS"
-- print
-+ print ("Zero forward: PASS")
-+ print ()
-
- lons, lats = lonlatfwdpt(portland[0], portland[1], spokane[0], spokane[1], 1.0)
- if not ( numpy.allclose(lons, spokane[0]) and numpy.allclose(lats, spokane[1]) ):
- raise ValueError("One forward from portland to spokane: expect %s, found %s" % \
- (str(spokane), str((lons, lats))))
-- print "One forward: PASS"
-- print
-+ print ("One forward: PASS")
-+ print ()
-
- lons, lats = lonlatfwdpt(0.0, 0.0, tenten, 0.0, 3.0)
- expectlons = 3.0 * tenten
-@@ -520,8 +522,8 @@ if __name__ == "__main__":
- if not numpy.allclose(lats[1:], 0.0):
- raise ValueError("Valid fwd equator lats: expect: all zeros, found: %s" %\
- str(lats[1:]))
-- print "Fwd equator: PASS"
-- print
-+ print ("Fwd equator: PASS")
-+ print ()
-
- lons, lats = lonlatfwdpt(0.0, -90.0, 0.0, tenten, 2.0)
- # First longitude could be anything, but this algorithm gives 0.0
-@@ -546,8 +548,8 @@ if __name__ == "__main__":
- if not numpy.allclose(lats[:-1], expectlats[:-1]):
- raise ValueError("Valid fwd prime meridian lats: expect: %s, found: %s" %\
- (str(expectlats[:-1]), str(lats[:-1])))
-- print "Fwd prime meridian: PASS"
-- print
-+ print ("Fwd prime meridian: PASS")
-+ print ()
-
- lons, lats = lonlatfwdpt(0.0, 0.0, 45.0, 45.0, (2.0, 3.0, 4.0, 5.0))
- expectlons = [ 135.0, 180.0, -135.0, -45.0 ]
-@@ -558,8 +560,8 @@ if __name__ == "__main__":
- if not numpy.allclose(lats, expectlats):
- raise ValueError("Fwd diagonal lats: expect: %s, found: %s" %\
- (str(expectlats), str(lats)))
-- print "Fwd diagonal: PASS"
-- print
-+ print ("Fwd diagonal: PASS")
-+ print ()
-
- # Test equdistscatter
- lons, lats = equidistscatter(0.0, 0.0, 0.0, 0.0, 1.0)
-@@ -568,8 +570,8 @@ if __name__ == "__main__":
- raise ValueError("Equidistscatter single-point FAIL; \n" \
- " expect: ([0.0],[0.0]), \n" \
- " found (%s,%s)" % (str(lons), str(lats)))
-- print "Equidistscatter single-point PASS"
-- print
-+ print ("Equidistscatter single-point PASS")
-+ print ()
-
- lons, lats = equidistscatter(0.0, 90.0, 90.0, 90.0, 1.0)
- if (lons.shape != (1,)) or (lons[0] != 45.0) or \
-@@ -577,8 +579,8 @@ if __name__ == "__main__":
- raise ValueError("Equidistscatter pole-point FAIL; \n" \
- " expect: ([45.0],[90.0]), \n" \
- " found (%s,%s)" % (str(lons), str(lats)))
-- print "Equidistscatter pole-point PASS"
-- print
-+ print ("Equidistscatter pole-point PASS")
-+ print ()
-
- lons, lats = equidistscatter(0.0, 0.0, 90.0, 0.0, 1.0)
- if not numpy.all( lats == 0.0 ):
-@@ -594,8 +596,8 @@ if __name__ == "__main__":
- raise ValueError("Equidistscatter equitorial FAIL; \n" \
- " expect: longitudes monotonic increasing by less than 1.0001 degrees, \n" \
- " found %s" % str(lons))
-- print "Equidistscatter equitorial PASS"
-- print
-+ print ("Equidistscatter equitorial PASS")
-+ print ()
-
- lons, lats = equidistscatter(0.0, 0.0, 0.0, 90.0, 1.0)
- if not numpy.all( lons == 0.0 ):
-@@ -611,8 +613,8 @@ if __name__ == "__main__":
- raise ValueError("Equidistscatter meridional FAIL; \n" \
- " expect: latitudes monotonic increasing by less than 1.0001 degrees, \n" \
- " found %s" % str(lats))
-- print "Equidistscatter meridional PASS"
-- print
-+ print ("Equidistscatter meridional PASS")
-+ print ()
-
- lons, lats = equidistscatter(0.0, 0.0, 90.0, 90.0, 5.0, 15.0)
- nndists = [ ]
-@@ -629,9 +631,9 @@ if __name__ == "__main__":
- raise ValueError("Equidistscatter region FAIL; \n" \
- " expect nearest neighbor distances < 10.0, \n" \
- " found %s" % str(nndists))
-- print "Nearest neighbor distances: \n" \
-+ print ("Nearest neighbor distances: \n" \
- " min = %f, max = %f, mean = %f, stdev = %f" % \
-- (nndists.min(), nndists.max(), nndists.mean(), nndists.std())
-+ (nndists.min(), nndists.max(), nndists.mean(), nndists.std()))
-
-- print "Equidistscatter region PASS"
-- print
-+ print ("Equidistscatter region PASS")
-+ print ()
-Index: pyferret-7.0.0/pyfermod/filenamecompleter.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/filenamecompleter.py
-+++ pyferret-7.0.0/pyfermod/filenamecompleter.py
-@@ -9,6 +9,7 @@ be names of existing files that match th
- directory/file name.
- """
-
-+from __future__ import print_function
- import os.path
-
- class FilenameCompleter(object):
-@@ -116,12 +117,12 @@ if __name__ == '__main__':
- # Test an empty string
- actdirlist = os.listdir(os.curdir)
- actdirlist.sort()
-- print 'Contents of current directory'
-+ print ('Contents of current directory')
- cmpdirlist = []
- k = 0
- fnam = completer.complete('', 0)
- while fnam != None:
-- print ' %s' % fnam
-+ print (' %s' % fnam)
- cmpdirlist.append(fnam)
- k += 1
- fnam = completer.complete('', k)
-@@ -131,26 +132,26 @@ if __name__ == '__main__':
-
- # Test with a tilde string
- tildedir = '~' + os.sep
-- print ''
-- print 'Contents of %s' % tildedir
-+ print ('')
-+ print ('Contents of %s' % tildedir)
- tildenames = []
- k = 0
- fnam = completer.complete(tildedir, 0)
- while fnam != None:
-- print ' %s' % fnam
-+ print (' %s' % fnam)
- tildenames.append(fnam)
- k += 1
- fnam = completer.complete(tildedir, k)
-
- # Test with an environment variable
- homedir = '$HOME' + os.sep
-- print ''
-- print 'Contents of %s' % homedir
-+ print ('')
-+ print ('Contents of %s' % homedir)
- homenames = []
- k = 0
- fnam = completer.complete(homedir, 0)
- while fnam != None:
-- print ' %s' % fnam
-+ print (' %s' % fnam)
- homenames.append(fnam)
- k += 1
- fnam = completer.complete(homedir, k)
-@@ -161,13 +162,13 @@ if __name__ == '__main__':
-
- # Try with $HOME/bin/
- bindir = '$HOME' + os.sep + 'bin' + os.sep
-- print ''
-- print 'Contents of %s' % bindir
-+ print ('')
-+ print ('Contents of %s' % bindir)
- binnames = []
- k = 0
- fnam = completer.complete(bindir, 0)
- while fnam != None:
-- print ' %s' % fnam
-+ print (' %s' % fnam)
- binnames.append(fnam)
- k += 1
- fnam = completer.complete(bindir, k)
-@@ -190,6 +191,6 @@ if __name__ == '__main__':
- (invalid_name, fnam))
-
- # All tests successful
-- print ''
-- print 'Success'
-+ print ('')
-+ print ('Success')
-
-Index: pyferret-7.0.0/pviewmod/__init__.py
-===================================================================
---- pyferret-7.0.0.orig/pviewmod/__init__.py
-+++ pyferret-7.0.0/pviewmod/__init__.py
-@@ -8,6 +8,8 @@ This package was developed by the Therma
- Pacific Marine Environmental Lab (PMEL).
- '''
-
-+from __future__ import print_function
-+from builtins import input
- from multiprocessing import Pipe
- import sys
-
-@@ -32,14 +34,14 @@ class PipedViewer(object):
- (self.__rspdrecvpipe, self.__rspdsendpipe) = Pipe(False)
- if viewertype == "PipedViewerPQ":
- try:
-- from pipedviewerpq import PipedViewerPQProcess
-+ from .pipedviewerpq import PipedViewerPQProcess
- except ImportError:
- raise TypeError("The PQ viewers requires PyQt4")
- self.__vprocess = PipedViewerPQProcess(self.__cmndrecvpipe,
- self.__rspdsendpipe)
- elif viewertype == "PipedImagerPQ":
- try:
-- from pipedimagerpq import PipedImagerPQProcess
-+ from .pipedimagerpq import PipedImagerPQProcess
- except ImportError:
- raise TypeError("The PQ viewers requires PyQt4")
- self.__vprocess = PipedImagerPQProcess(self.__cmndrecvpipe,
-@@ -225,7 +227,7 @@ if __name__ == "__main__":
-
- # Test each known viewer.
- for viewername in ( "PipedViewerPQ", "PipedImagerPQ", "NoDisplayPQ" ):
-- print "Testing Viewer %s" % viewername
-+ print ("Testing Viewer %s" % viewername)
- # create the viewer
- pviewer = PipedViewer(viewername)
- mydrawcmnds = drawcmnds[:]
-@@ -243,11 +245,11 @@ if __name__ == "__main__":
-
- # submit the commands, pausing after each "show" command
- for cmd in mydrawcmnds:
-- print "Command: %s" % str(cmd)
-+ print ("Command: %s" % str(cmd))
- pviewer.submitCommand(cmd)
- response = pviewer.checkForResponse()
- while response:
-- print "Response: %s" % str(response)
-+ print ("Response: %s" % str(response))
- response = pviewer.checkForResponse()
- if cmd["action"] == "show":
- raw_input("Press Enter to continue")
-@@ -257,4 +259,4 @@ if __name__ == "__main__":
- if result != 0:
- sys.exit(result)
- else:
-- print "Done with %s" % viewername
-+ print ("Done with %s" % viewername)
-Index: pyferret-7.0.0/pviewmod/pyferretbindings.py
-===================================================================
---- pyferret-7.0.0.orig/pviewmod/pyferretbindings.py
-+++ pyferret-7.0.0/pviewmod/pyferretbindings.py
-@@ -15,9 +15,11 @@ This package was developed by the Therma
- Pacific Marine Environmental Lab (PMEL).
- '''
-
-+from __future__ import print_function
- from pyferret.graphbind.abstractpyferretbindings import AbstractPyFerretBindings
- from pipedviewer import PipedViewer
--
-+from past.builtins import xrange
-+from builtins import input
-
- class PyFerretBindings(AbstractPyFerretBindings):
- '''
-@@ -931,7 +933,7 @@ if __name__ == "__main__":
- # Initiate pyferret, but stay in python
- pyferret.init(None, False)
- for viewertype in ( "PipedViewerPQ", ):
-- print "Testing bindings for %s" % viewertype
-+ print ("Testing bindings for %s" % viewertype)
- # Create a viewer window
- title = viewertype + "Tester"
- bindinst = pyferret.graphbind.createWindow(viewertype, title, True, False)
-@@ -967,7 +969,7 @@ if __name__ == "__main__":
- bindinst.endView()
- # Window should already be shown, but just to make sure
- bindinst.showWindow(True)
-- raw_input("Press Enter to continue")
-+ input("Press Enter to continue")
- # Create a view of the whole window
- bindinst.beginView(0.0, 1.0, 1.0, 0.0, True)
- # Draw magenta points using various symbols
-@@ -1010,7 +1012,7 @@ if __name__ == "__main__":
- bindinst.endView()
- # Window should already be shown, but just to make sure
- bindinst.showWindow(True)
-- raw_input("Press Enter to continue")
-+ input("Press Enter to continue")
- try:
- while 1:
- bindinst.deleteColor(mycolors.pop())
-@@ -1018,5 +1020,5 @@ if __name__ == "__main__":
- pass
- bindinst.deleteFont(myfont)
- bindinst.deleteWindow()
-- print "Done with bindings for %s" % viewertype
-+ print ("Done with bindings for %s" % viewertype)
-
-Index: pyferret-7.0.0/pviewmod/scaledialogpq.py
-===================================================================
---- pyferret-7.0.0.orig/pviewmod/scaledialogpq.py
-+++ pyferret-7.0.0/pviewmod/scaledialogpq.py
-@@ -6,6 +6,7 @@ This package was developed by the Therma
- Pacific Marine Environmental Lab (PMEL).
- '''
-
-+from __future__ import print_function
- from PyQt4.QtCore import SIGNAL, Qt
- from PyQt4.QtGui import QApplication, QButtonGroup, QDialog, \
- QDialogButtonBox, QGridLayout, QGroupBox, \
-@@ -214,7 +215,7 @@ if __name__ == "__main__":
- app = QApplication(["tester"])
- resizedialog = ScaleDialogPQ(1.0, 500, 300, 75, 50, False)
- retval = resizedialog.exec_()
-- print "retval = %d" % retval
-+ print ("retval = %d" % retval)
- if retval == QDialog.Accepted:
- rettuple = resizedialog.getValues()
-- print "getValues returned: %s" % str(rettuple)
-+ print ("getValues returned: %s" % str(rettuple))
-Index: pyferret-7.0.0/pyfermod/__init__.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/__init__.py
-+++ pyferret-7.0.0/pyfermod/__init__.py
-@@ -29,10 +29,11 @@ under pyferret.fermethods and are import
- These methods also help reduce the need to know the Ferret language
- and syntax.
- """
--
-+from __future__ import print_function
- import sys
- import os
- import atexit
-+from builtins import input
- try:
- import rlcompleter
- except ImportError:
-@@ -54,52 +55,52 @@ if os.environ.get('FER_MODEL_RUNS') is N
- if os.environ.get('FER_LIBS') is None:
- os.environ['FER_LIBS'] = '/usr/lib/ferret-vis/efmem:/usr/lib/ferret-vis/external_functions'
-
--import libpyferret
-+from pyferret import libpyferret
- # also import everything (not starting with an underscore) from libpyferret
- # so constants in that module are seen as part of this module
--from libpyferret import *
-+from .libpyferret import *
-
- # methods for transferring data between the Ferret engine and Python
--import datamethods
-+from . import datamethods
- # also import the methods given in datamethods into pyferret
--from datamethods import *
-+from .datamethods import *
-
- # methods to assist in writing Ferret external functions written in Python
--import pyefmethods
-+from . import pyefmethods
- # also import the methods given in pyefmethods into pyferret
--from pyefmethods import *
-+from .pyefmethods import *
-
- # the FerRegion, FerAxis, FerGrid, FerVar, FerPyVar, and FerDSet objects
- # for working with Ferret from Python
--import ferregion
--from ferregion import *
--import feraxis
--from feraxis import *
--import fergrid
--from fergrid import *
--import fervar
--from fervar import *
--import ferpyvar
--from ferpyvar import *
--import ferdset
--from ferdset import *
--import feraggdset
--from feraggdset import *
-+from . import ferregion
-+from .ferregion import *
-+from . import feraxis
-+from .feraxis import *
-+from . import fergrid
-+from .fergrid import *
-+from . import fervar
-+from . fervar import *
-+from . import ferpyvar
-+from .ferpyvar import *
-+from . import ferdset
-+from .ferdset import *
-+from . import feraggdset
-+from .feraggdset import *
-
- # Create "the" anonymous dataset
- anondset = FerDSet(qual=ferdset._anonymous_dataset_qualifier)
-
- # convenience methods for executing common Ferret commands
--import fermethods
--from fermethods import *
-+from . import fermethods
-+from .fermethods import *
-
- # bindings for the PyQt-based graphics engines
- import pipedviewer.pyferretbindings
-
- # the following should be in this (pyferret) directory, which should be examined first
--import filenamecompleter
--import graphbind
--import regrid
-+from . import filenamecompleter
-+from . import graphbind
-+from . import regrid
-
- def init(arglist=None, enterferret=True):
- """
-@@ -180,9 +181,9 @@ def init(arglist=None, enterferret=True)
- -transparent: use a transparent background instead of opaque white
- when saving to the file given by -batch
-
-- -script: execute the script <scriptname> with any arguments
-- specified and exit (THIS MUST BE SPECIFIED LAST).
-- The -script option also implies the -nojnl, -noverify,
-+ -script: execute the script <scriptname> with any arguments
-+ specified and exit (THIS MUST BE SPECIFIED LAST).
-+ The -script option also implies the -nojnl, -noverify,
- -server, and -quiet options.
-
- """
-@@ -272,13 +273,13 @@ def init(arglist=None, enterferret=True)
- else:
- raise ValueError("unrecognized option '%s'" % opt)
- k += 1
-- except ValueError, errmsg:
-+ except ValueError as errmsg:
- # print the error message, then print the help message
-- print >>sys.stderr, "\n%s" % errmsg
-+ print ("\n%s" % errmsg, file=sys.stderr)
- print_help = True
- if print_help:
- # print the help message, then mark for exiting
-- print >>sys.stderr, ferret_help_message
-+ print (ferret_help_message, file=sys.stderr)
- just_exit = True
- if just_exit:
- # print the ferret header then exit completely
-@@ -508,7 +509,7 @@ def init(arglist=None, enterferret=True)
- try:
- result = run('go "%s"; exit /topy' % init_script)
- except:
-- print >>sys.stderr, " **Error: exception raised in runnning script %s" % init_script
-+ print (" **Error: exception raised in runnning script %s" % init_script, file=sys.stderr)
- result = run('exit /program')
- # should not get here
- raise SystemExit
-@@ -520,7 +521,7 @@ def init(arglist=None, enterferret=True)
- try:
- result = run('go %s; exit /program' % script_line)
- except:
-- print >>sys.stderr, " **Error: exception raised in running script %s" % script_line
-+ print (" **Error: exception raised in running script %s" % script_line, file=sys.stderr)
- # If exception or if returned early, force shutdown
- result = run('exit /program')
- # should not get here
-@@ -628,7 +629,7 @@ def start(memsize=25, journal=True, veri
- # Execute the $PYTHONSTARTUP file, if it exists and -secure not given
- if not restrict:
- try:
-- execfile(os.getenv('PYTHONSTARTUP', ''));
-+ exec(compile(open(os.getenv('PYTHONSTARTUP', '')).read(), os.getenv('PYTHONSTARTUP', ''), 'exec'));
- except IOError:
- pass;
-
-@@ -746,9 +747,9 @@ def _readline(myprompt):
- """
- try:
- if myprompt:
-- myline = raw_input(myprompt)
-+ myline = eval(input(myprompt))
- else:
-- myline = raw_input()
-+ myline = eval(input())
- except EOFError:
- myline = None
-
-Index: pyferret-7.0.0/pviewmod/pipedviewerpq.py
-===================================================================
---- pyferret-7.0.0.orig/pviewmod/pipedviewerpq.py
-+++ pyferret-7.0.0/pviewmod/pipedviewerpq.py
-@@ -13,6 +13,7 @@ Project (TMAP) of the National Oceanogra
- Administration's (NOAA) Pacific Marine Environmental Lab (PMEL).
- '''
-
-+from __future__ import print_function
- import sip
- try:
- sip.setapi('QVariant', 2)
-@@ -1563,11 +1564,11 @@ class _CommandSubmitterPQ(QDialog):
- or shutdown if there are no more commands to submit.
- '''
- try:
-- print "Command: %s" % str(self.__cmndlist[self.__nextcmnd])
-+ print ("Command: %s" % str(self.__cmndlist[self.__nextcmnd]))
- self.__cmndpipe.send(self.__cmndlist[self.__nextcmnd])
- self.__nextcmnd += 1
- while self.__rspdpipe.poll():
-- print "Response: %s" % str(self.__rspdpipe.recv())
-+ print ("Response: %s" % str(self.__rspdpipe.recv()))
- except IndexError:
- self.__rspdpipe.close()
- self.__cmndpipe.close()
-Index: pyferret-7.0.0/pyfermod/eofanal/eofanalysis.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/eofanal/eofanalysis.py
-+++ pyferret-7.0.0/pyfermod/eofanal/eofanalysis.py
-@@ -9,7 +9,7 @@ raised by some methods in the EOFAnalysi
-
- @author: Karl M. Smith
- '''
--
-+from __future__ import print_function
- import math
- import numpy
- import numpy.linalg
-@@ -495,8 +495,8 @@ if __name__ == '__main__':
- cosT = numpy.cos(months * numpy.pi / 6.0)
- sinT = numpy.sin(months * numpy.pi / 6.0)
-
-- print
-- print 'spacetime = [ cosT, sinT + 1 ]'
-+ print ()
-+ print ('spacetime = [ cosT, sinT + 1 ]')
- spacetimedata = numpy.matrix([cosT,
- sinT + 1.0]).T
- eofanal = EOFAnalysis(spacetimedata)
-@@ -504,24 +504,24 @@ if __name__ == '__main__':
- defminsignif = eofanal.minsignif();
- eofanal.setminsignif(0.1)
- fracsignifs = eofanal.signiffracs()
-- print 'EOF fractional significances:'
-- print formatter.pformat(fracsignifs)
-+ print ('EOF fractional significances:')
-+ print (formatter.pformat(fracsignifs))
- numeofs = eofanal.numeofs()
-- print 'Number of significant EOFs: %d' % numeofs
-+ print ('Number of significant EOFs: %d' % numeofs)
- totalcontrib = eofanal.datapiece(0)
- for k in xrange(1, numeofs+1):
- eofvec = eofanal.eofvec(k)
- sqnorm = numpy.dot(eofvec, eofvec)
-- print 'EOF %d has norm^2: %#.4f' % (k, sqnorm)
-- print formatter.pformat(eofvec)
-+ print ('EOF %d has norm^2: %#.4f' % (k, sqnorm))
-+ print (formatter.pformat(eofvec))
- tafvec = eofanal.tafvec(k)
- sqnorm = numpy.dot(tafvec, tafvec)
-- print 'TAF %d has norm^2: %#.4f' % (k, sqnorm)
-- print formatter.pformat(tafvec)
-+ print ('TAF %d has norm^2: %#.4f' % (k, sqnorm))
-+ print (formatter.pformat(tafvec))
- tafeof = numpy.outer(tafvec, eofvec)
- contrib = eofanal.datapiece(k)
- if numpy.allclose(contrib, tafeof):
-- print 'datapiece(%d) all close to expected values' % k
-+ print ('datapiece(%d) all close to expected values' % k)
- else:
- raise ValueError(
- 'datapiece(%d):\n expected\n%s\n found\n%s' % \
-@@ -530,7 +530,7 @@ if __name__ == '__main__':
- totalcontrib += contrib
- expdata = eofanal.dataexplained(k)
- if numpy.allclose(expdata, totalcontrib):
-- print 'dataexplained(%d) all close to expected values' % k
-+ print ('dataexplained(%d) all close to expected values' % k)
- else:
- raise ValueError(
- 'dataexplained(%d):\n expected\n%s\n found\n%s' % \
-@@ -539,18 +539,18 @@ if __name__ == '__main__':
- datadeltas = numpy.array(numpy.abs(spacetimedata - expdata)).flatten()
- maxdiff = numpy.max(datadeltas)
- rmsdiff = math.sqrt(numpy.average(datadeltas * datadeltas))
-- print 'Max and RMS diff btwn data explained by %d most' % k
-- print ' influential EOFs and actual data: %#.8f, %#.8f' % \
-- (maxdiff, rmsdiff)
-+ print ('Max and RMS diff btwn data explained by %d most' % k)
-+ print (' influential EOFs and actual data: %#.8f, %#.8f' % \
-+ (maxdiff, rmsdiff))
- datadeltas = numpy.array(numpy.abs(spacetimedata - totalcontrib)).flatten()
- maxdiff = numpy.max(datadeltas)
- rmsdiff = math.sqrt(numpy.average(datadeltas * datadeltas))
-- print 'Max and RMS diff btwn sum of all significant'
-- print ' data pieces and actual data: %#.8f, %#.8f' % \
-- (maxdiff, rmsdiff)
-+ print ('Max and RMS diff btwn sum of all significant')
-+ print (' data pieces and actual data: %#.8f, %#.8f' % \
-+ (maxdiff, rmsdiff))
-
-- print
-- print 'spacetime = [ cosT * cosT, cosT * sinT + 1, cosT * sinT + 2, sinT * sinT + 3 ]'
-+ print ()
-+ print ('spacetime = [ cosT * cosT, cosT * sinT + 1, cosT * sinT + 2, sinT * sinT + 3 ]')
- spacetimedata = numpy.matrix([ cosT * cosT,
- cosT * sinT + 1.0,
- cosT * sinT + 2.0,
-@@ -558,24 +558,24 @@ if __name__ == '__main__':
- eofanal = EOFAnalysis(spacetimedata)
- eofanal.analyze()
- fracsignifs = eofanal.signiffracs()
-- print 'EOF fractional significances:'
-- print formatter.pformat(fracsignifs)
-+ print ('EOF fractional significances:')
-+ print (formatter.pformat(fracsignifs))
- numeofs = eofanal.numeofs()
-- print 'Number of significant EOFs: %d' % numeofs
-+ print ('Number of significant EOFs: %d' % numeofs)
- totalcontrib = eofanal.datapiece(0)
- for k in xrange(1, numeofs+1):
- eofvec = eofanal.eofvec(k)
- sqnorm = numpy.dot(eofvec, eofvec)
-- print 'EOF %d has norm^2: %#.4f' % (k, sqnorm)
-- print formatter.pformat(eofvec)
-+ print ('EOF %d has norm^2: %#.4f' % (k, sqnorm))
-+ print (formatter.pformat(eofvec))
- tafvec = eofanal.tafvec(k)
- sqnorm = numpy.dot(tafvec, tafvec)
-- print 'TAF %d has norm^2: %#.4f' % (k, sqnorm)
-- print formatter.pformat(tafvec)
-+ print ('TAF %d has norm^2: %#.4f' % (k, sqnorm))
-+ print (formatter.pformat(tafvec))
- tafeof = numpy.outer(tafvec, eofvec)
- contrib = eofanal.datapiece(k)
- if numpy.allclose(contrib, tafeof):
-- print 'datapiece(%d) all close to expected values' % k
-+ print ('datapiece(%d) all close to expected values' % k)
- else:
- raise ValueError(
- 'datapiece(%d):\n expected\n%s\n found\n%s' % \
-@@ -584,7 +584,7 @@ if __name__ == '__main__':
- totalcontrib += contrib
- expdata = eofanal.dataexplained(k)
- if numpy.allclose(expdata, totalcontrib):
-- print 'dataexplained(%d) all close to expected values' % k
-+ print ('dataexplained(%d) all close to expected values' % k)
- else:
- raise ValueError(
- 'dataexplained(%d):\n expected\n%s\n found\n%s' % \
-@@ -593,31 +593,31 @@ if __name__ == '__main__':
- datadeltas = numpy.array(numpy.abs(spacetimedata - expdata)).flatten()
- maxdiff = numpy.max(datadeltas)
- rmsdiff = math.sqrt(numpy.average(datadeltas * datadeltas))
-- print 'Max and RMS diff btwn data explained by %d most' % k
-- print ' influential EOFs and actual data: %#.8f, %#.8f' % \
-- (maxdiff, rmsdiff)
-+ print ('Max and RMS diff btwn data explained by %d most' % k)
-+ print (' influential EOFs and actual data: %#.8f, %#.8f' % \
-+ (maxdiff, rmsdiff))
- datadeltas = numpy.array(numpy.abs(spacetimedata - totalcontrib)).flatten()
- maxdiff = numpy.max(datadeltas)
- rmsdiff = math.sqrt(numpy.average(datadeltas * datadeltas))
-- print 'Max and RMS diff btwn sum of all significant'
-- print ' data pieces and actual data: %#.8f, %#.8f' % \
-- (maxdiff, rmsdiff)
-+ print ('Max and RMS diff btwn sum of all significant')
-+ print (' data pieces and actual data: %#.8f, %#.8f' % \
-+ (maxdiff, rmsdiff))
-
- fmat = spacetimedata - eofanal.datapiece(0)
- for k in xrange(1, spacetimedata.shape[1] - numeofs + 1):
- nullvec = eofanal.nullvec(k)
- sqnorm = numpy.dot(nullvec, nullvec)
-- print 'Null-space vector %d has norm^2: %#.4f' % (k, sqnorm)
-- print formatter.pformat(nullvec)
-+ print ('Null-space vector %d has norm^2: %#.4f' % (k, sqnorm))
-+ print (formatter.pformat(nullvec))
- tafvec = numpy.array(fmat * numpy.matrix(nullvec).T).squeeze()
- sqnorm = numpy.dot(tafvec, tafvec)
-- print 'F * NSV %d has norm^2: %#.4f' % (k, sqnorm)
-+ print ('F * NSV %d has norm^2: %#.4f' % (k, sqnorm))
- # print formatter.pformat(tafvec)
-
- import cPickle
-
- eofpicklestring = cPickle.dumps(eofanal)
-- print 'length of the eofanal pickle string: %d' % len(eofpicklestring)
-+ print ('length of the eofanal pickle string: %d' % len(eofpicklestring))
- neweofanal = cPickle.loads(eofpicklestring)
-- print 'unpickled eofanal.numeofs() = %d' % neweofanal.numeofs()
-+ print ('unpickled eofanal.numeofs() = %d' % neweofanal.numeofs())
-
-Index: pyferret-7.0.0/pyfermod/eofanal/eofanalysistests.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/eofanal/eofanalysistests.py
-+++ pyferret-7.0.0/pyfermod/eofanal/eofanalysistests.py
-@@ -4,7 +4,8 @@ Tests for the eofanalysis module.
- @author: Karl Smith
- '''
-
--import eofanalysis
-+from . import eofanalysis
-+from past.builtins import xrange
- import math
- import numpy
- import unittest
-Index: pyferret-7.0.0/pviewmod/pipedimagerpq.py
-===================================================================
---- pyferret-7.0.0.orig/pviewmod/pipedimagerpq.py
-+++ pyferret-7.0.0/pviewmod/pipedimagerpq.py
-@@ -13,6 +13,7 @@ Project (TMAP) of the National Oceanogra
- Administration's (NOAA) Pacific Marine Environmental Lab (PMEL).
- '''
-
-+from __future__ import print_function
- import sip
- try:
- sip.setapi('QVariant', 2)
-@@ -28,6 +29,7 @@ from PyQt4.QtGui import QAction, QAppli
- from cmndhelperpq import CmndHelperPQ
- from scaledialogpq import ScaleDialogPQ
- from multiprocessing import Pipe, Process
-+from past.builtins import xrange
- import sys
- import time
- import os
-@@ -787,11 +789,11 @@ class _CommandSubmitterPQ(QDialog):
- cmndstr = str(self.__cmndlist[self.__nextcmnd])
- if len(cmndstr) > 188:
- cmndstr = cmndstr[:188] + '...'
-- print "Command: %s" % cmndstr
-+ print ("Command: %s" % cmndstr)
- self.__cmndpipe.send(self.__cmndlist[self.__nextcmnd])
- self.__nextcmnd += 1
- while self.__rspdpipe.poll():
-- print "Response: %s" % str(self.__rspdpipe.recv())
-+ print ("Response: %s" % str(self.__rspdpipe.recv()))
- except IndexError:
- self.__rspdpipe.close()
- self.__cmndpipe.close()
-Index: pyferret-7.0.0/pyfermod/regrid/__init__.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/__init__.py
-+++ pyferret-7.0.0/pyfermod/regrid/__init__.py
-@@ -10,9 +10,9 @@ import numpy
-
- # Import classes given in modules in this package so they are all seen here.
- try:
-- from esmpcontrol import ESMPControl
-- from regrid2d import CurvRectRegridder
-- from regrid3d import CurvRect3DRegridder
-+ from .esmpcontrol import ESMPControl
-+ from .regrid2d import CurvRectRegridder
-+ from .regrid3d import CurvRect3DRegridder
- except ImportError:
- # No ESMP, but do not raise an error until attempting to actually use it
- pass
-Index: pyferret-7.0.0/pyfermod/regrid/curv2rect.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/curv2rect.py
-+++ pyferret-7.0.0/pyfermod/regrid/curv2rect.py
-@@ -10,7 +10,7 @@ import numpy
- import pyferret
- import ESMP
- import pyferret.regrid as regrid
--
-+from past.builtins import xrange
-
- def ferret_init(efid):
- '''
-Index: pyferret-7.0.0/pyfermod/regrid/curv3srect.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/curv3srect.py
-+++ pyferret-7.0.0/pyfermod/regrid/curv3srect.py
-@@ -12,7 +12,7 @@ import numpy
- import pyferret
- import ESMP
- import pyferret.regrid as regrid
--
-+from past.builtins import xrange
-
- def ferret_init(efid):
- '''
-Index: pyferret-7.0.0/pyfermod/regrid/esmpcontroltests.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/esmpcontroltests.py
-+++ pyferret-7.0.0/pyfermod/regrid/esmpcontroltests.py
-@@ -4,7 +4,7 @@ Tests of ESMPControl singleton class
- @author: Karl Smith
- '''
- import unittest
--from esmpcontrol import ESMPControl
-+from .esmpcontrol import ESMPControl
-
-
- class Test(unittest.TestCase):
-Index: pyferret-7.0.0/pyfermod/regrid/regrid2dexample2.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regrid2dexample2.py
-+++ pyferret-7.0.0/pyfermod/regrid/regrid2dexample2.py
-@@ -5,10 +5,11 @@ and also serves as a coding example of u
- @author: Karl Smith
- '''
-
-+from __future__ import print_function
- import numpy
- import ESMP
--from esmpcontrol import ESMPControl
--from regrid2d import CurvRectRegridder
-+from .esmpcontrol import ESMPControl
-+from .regrid2d import CurvRectRegridder
-
-
- def createExampleData():
-@@ -198,20 +199,20 @@ def printDiffs(grid_lons, grid_lats, und
- for (_, lon, lat, expect, found) in diff_list:
- if expect == undef_val:
- num_not_undef += 1
-- print "lon = %#7.3f, lat = %7.3f, expect = undef, found = %#8.5f" \
-- % (lon, lat, found)
-+ print ("lon = %#7.3f, lat = %7.3f, expect = undef, found = %#8.5f" \
-+ % (lon, lat, found))
- elif found == undef_val:
- num_undef += 1
-- print "lon = %#7.3f, lat = %7.3f, expect = %#8.5f, found = undef" \
-- % (lon, lat, expect)
-+ print ("lon = %#7.3f, lat = %7.3f, expect = %#8.5f, found = undef" \
-+ % (lon, lat, expect))
- else:
- num_diff += 1
-- print "lon = %#7.3f, lat = %7.3f, expect = %#8.5f, found = %#8.5f, " \
-- "diff = %#8.5f" % (lon, lat, expect, found, found - expect)
-- print "%3d undefined when defined might be expected" % num_undef
-- print "%3d with absolute difference > %#.5f" % (num_diff, max_negl)
-- print "%3d defined when undefined expected" % num_not_undef
-- print "%3d values in the grid" % (expect_data.shape[0] * expect_data.shape[1])
-+ print ("lon = %#7.3f, lat = %7.3f, expect = %#8.5f, found = %#8.5f, " \
-+ "diff = %#8.5f" % (lon, lat, expect, found, found - expect))
-+ print ("%3d undefined when defined might be expected" % num_undef)
-+ print ("%3d with absolute difference > %#.5f" % (num_diff, max_negl))
-+ print ("%3d defined when undefined expected" % num_not_undef)
-+ print ("%3d values in the grid" % (expect_data.shape[0] * expect_data.shape[1]))
-
-
- # main routine - for testing "by hand"
-@@ -279,16 +280,16 @@ if __name__ == '__main__':
- # Regrid from curvilinear to rectilinear using the bilinear method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_BILINEAR)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus bilinear regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus bilinear regridded (found) differences")
- printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, max_negl,
- rect_expect_data, rect_regrid_data)
-
- # Regrid from curvilinear to rectilinear using the patch method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_PATCH)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus patch regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus patch regridded (found) differences")
- printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, max_negl,
- rect_expect_data, rect_regrid_data)
-
-@@ -296,8 +297,8 @@ if __name__ == '__main__':
- # Corners required for this method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_CONSERVE)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus conserve regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus conserve regridded (found) differences")
- printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, max_negl,
- rect_expect_data, rect_regrid_data)
-
-Index: pyferret-7.0.0/pyfermod/regrid/regrid2dexample.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regrid2dexample.py
-+++ pyferret-7.0.0/pyfermod/regrid/regrid2dexample.py
-@@ -5,10 +5,12 @@ and also serves as a coding example of u
- @author: Karl Smith
- '''
-
-+from __future__ import print_function
- import numpy
- import ESMP
--from esmpcontrol import ESMPControl
--from regrid2d import CurvRectRegridder
-+from builtins import input
-+from .esmpcontrol import ESMPControl
-+from .regrid2d import CurvRectRegridder
-
-
- def createExampleCurvData():
-@@ -775,32 +777,32 @@ def printDiffs(grid_lons, grid_lats, und
- for (_, lon, lat, expect, found) in diff_list:
- if expect == undef_val:
- num_not_undef += 1
-- print "lon = %#7.3f, lat = %7.3f, expect = undef, found = %#6.3f" \
-- % (lon, lat, found)
-+ print ("lon = %#7.3f, lat = %7.3f, expect = undef, found = %#6.3f" \
-+ % (lon, lat, found))
- elif found == undef_val:
- num_undef += 1
-- print "lon = %#7.3f, lat = %7.3f, expect = %#6.3f, found = undef" \
-- % (lon, lat, expect)
-+ print ("lon = %#7.3f, lat = %7.3f, expect = %#6.3f, found = undef" \
-+ % (lon, lat, expect))
- else:
- num_diff += 1
-- print "lon = %#7.3f, lat = %7.3f, expect = %#6.3f, found = %#6.3f, " \
-- "diff = %#6.3f" % (lon, lat, expect, found, found - expect)
-- print "%3d undefined when defined might be expected" % num_undef
-- print "%3d with absolute difference > %#.3f" % (num_diff, max_negl)
-- print "%3d defined when undefined expected" % num_not_undef
-- print "%3d values in the grid" % (expect_data.shape[0] * expect_data.shape[1])
-+ print ("lon = %#7.3f, lat = %7.3f, expect = %#6.3f, found = %#6.3f, " \
-+ "diff = %#6.3f" % (lon, lat, expect, found, found - expect))
-+ print ("%3d undefined when defined might be expected" % num_undef)
-+ print ("%3d with absolute difference > %#.3f" % (num_diff, max_negl))
-+ print ("%3d defined when undefined expected" % num_not_undef)
-+ print ("%3d values in the grid" % (expect_data.shape[0] * expect_data.shape[1]))
-
-
- # main routine - for testing "by hand"
- if __name__ == '__main__':
- try:
- while True:
-- print 'cw2r: curvilinear with corners to rectilinear'
-- print 'co2r: curvilinear without corners to rectilinear'
-- print 'r2cw: rectilinear to curvilinear with corners'
-- print 'r2co: rectilinear to curvilinear without corners'
-- print 'Ctrl-D to quit'
-- direction = raw_input('Regrid test to run? ')
-+ print ('cw2r: curvilinear with corners to rectilinear')
-+ print ('co2r: curvilinear without corners to rectilinear')
-+ print ('r2cw: rectilinear to curvilinear with corners')
-+ print ('r2co: rectilinear to curvilinear without corners')
-+ print ('Ctrl-D to quit')
-+ direction = input('Regrid test to run? ')
- direction = direction.strip().lower()
- if direction in ('cw2r', 'co2r', 'r2cw', 'r2co'):
- break
-@@ -848,11 +850,11 @@ if __name__ == '__main__':
-
- if direction in ('cw2r', 'co2r'):
-
-- print ""
-+ print ("")
- if direction == 'cw2r':
-- print "Examining rectilinear results from curvilinear with corners"
-+ print ("Examining rectilinear results from curvilinear with corners")
- else:
-- print "Examining rectilinear results from curvilinear without corners"
-+ print ("Examining rectilinear results from curvilinear without corners")
-
- # Create the curvilinear source field
- regridder.assignCurvField(curv_data)
-@@ -868,16 +870,16 @@ if __name__ == '__main__':
- # Regrid from curvilinear to rectilinear using the bilinear method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_BILINEAR)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus bilinear regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus bilinear regridded (found) differences")
- printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, 0.001,
- rect_expect_data, rect_regrid_data)
-
- # Regrid from curvilinear to rectilinear using the patch method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_PATCH)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus patch regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus patch regridded (found) differences")
- printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, 0.001,
- rect_expect_data, rect_regrid_data)
-
-@@ -886,18 +888,18 @@ if __name__ == '__main__':
- # Corners required for this method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_CONSERVE)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus conserve regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus conserve regridded (found) differences")
- printDiffs(rect_2d_center_lons, rect_2d_center_lats, undef_val, 0.05,
- rect_expect_data, rect_regrid_data)
-
- elif direction in ('r2cw', 'r2co'):
-
-- print ""
-+ print ("")
- if direction == 'r2cw':
-- print "Examining curvilinear with corners results from rectilinear"
-+ print ("Examining curvilinear with corners results from rectilinear")
- else:
-- print "Examining curvilinear without corners results from rectilinear"
-+ print ("Examining curvilinear without corners results from rectilinear")
-
- # Create the rectilinear source field
- regridder.assignRectField(rect_data)
-@@ -909,8 +911,8 @@ if __name__ == '__main__':
- curv_regrid_data = regridder.regridRectToCurv(undef_val, ESMP.ESMP_REGRIDMETHOD_BILINEAR)
- # Print the differences between the expected and regrid data
- # Ignore the edges of the regions
-- print ""
-- print "analytic (expect) versus bilinear regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus bilinear regridded (found) differences")
- printDiffs(curv_center_lons[1:-1, 1:-1],
- curv_center_lats[1:-1, 1:-1],
- undef_val, 0.001,
-@@ -921,8 +923,8 @@ if __name__ == '__main__':
- curv_regrid_data = regridder.regridRectToCurv(undef_val, ESMP.ESMP_REGRIDMETHOD_PATCH)
- # Print the differences between the expected and regrid data
- # Ignore the edges of the regions
-- print ""
-- print "analytic (expect) versus patch regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus patch regridded (found) differences")
- printDiffs(curv_center_lons[1:-1 ,1:-1],
- curv_center_lats[1:-1, 1:-1],
- undef_val, 0.001,
-@@ -935,8 +937,8 @@ if __name__ == '__main__':
- curv_regrid_data = regridder.regridRectToCurv(undef_val, ESMP.ESMP_REGRIDMETHOD_CONSERVE)
- # Print the differences between the expected and regrid data
- # Ignore the edges of the regions
-- print ""
-- print "analytic (expect) versus conserve regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus conserve regridded (found) differences")
- printDiffs(curv_center_lons[1:-1,1:-1],
- curv_center_lats[1:-1,1:-1],
- undef_val, 0.1,
-Index: pyferret-7.0.0/pyfermod/regrid/regrid2d.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regrid2d.py
-+++ pyferret-7.0.0/pyfermod/regrid/regrid2d.py
-@@ -179,10 +179,10 @@ class CurvRectRegridder(object):
- center_ignore_array)
-
- # Release any regridding procedures and clear the dictionaries
-- for handle in self.__rect_to_curv_handles.values():
-+ for handle in list(self.__rect_to_curv_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__rect_to_curv_handles.clear()
-- for handle in self.__curv_to_rect_handles.values():
-+ for handle in list(self.__curv_to_rect_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__curv_to_rect_handles.clear()
- # Destroy any curvilinear ESMP_Fields
-@@ -443,10 +443,10 @@ class CurvRectRegridder(object):
- center_ignore_array)
-
- # Release any regridding procedures and clear the dictionaries
-- for handle in self.__rect_to_curv_handles.values():
-+ for handle in list(self.__rect_to_curv_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__rect_to_curv_handles.clear()
-- for handle in self.__curv_to_rect_handles.values():
-+ for handle in list(self.__curv_to_rect_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__curv_to_rect_handles.clear()
- # Destroy any rectilinear ESMP_Fields
-@@ -741,10 +741,10 @@ class CurvRectRegridder(object):
- None
- '''
- # Release any regridding procedures and clear the dictionaries
-- for handle in self.__rect_to_curv_handles.values():
-+ for handle in list(self.__rect_to_curv_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__rect_to_curv_handles.clear()
-- for handle in self.__curv_to_rect_handles.values():
-+ for handle in list(self.__curv_to_rect_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__curv_to_rect_handles.clear()
- # Destroy any ESMP_Fields
-Index: pyferret-7.0.0/pyfermod/regrid/regrid2dtests.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regrid2dtests.py
-+++ pyferret-7.0.0/pyfermod/regrid/regrid2dtests.py
-@@ -3,12 +3,14 @@ Unit tests for CurvRectRegridder
-
- @author: Karl Smith
- '''
-+
-+from __future__ import print_function
- import unittest
- import numpy
- import ESMP
--from esmpcontrol import ESMPControl
--from regrid2d import CurvRectRegridder
--
-+from .esmpcontrol import ESMPControl
-+from .regrid2d import CurvRectRegridder
-+from past.builtins import xrange
-
- class CurvRectRegridderTests(unittest.TestCase):
- '''
-@@ -260,10 +262,11 @@ class CurvRectRegridderTests(unittest.Te
- for i in xrange(expect_data.shape[0]):
- for j in xrange(expect_data.shape[1]):
- if numpy.abs(expect_data[i, j] - regrid_data[i, j]) > 0.0007:
-- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ mismat
-+ ch_found = True
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f" % (expect_data[i, j], regrid_data[i, j],
-- self.rect_center_lons[i], self.rect_center_lats[j])
-+ self.rect_center_lons[i], self.rect_center_lats[j]))
- if mismatch_found:
- self.fail("data mismatch found")
-
-@@ -289,9 +292,9 @@ class CurvRectRegridderTests(unittest.Te
- for j in xrange(expect_data.shape[1]):
- if numpy.abs(expect_data[i, j] - regrid_data[i, j]) > 0.0003:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-- "lat = %5.1f" % (expect_data[i, j], regrid_data[i, j],
-- self.rect_center_lons[i], self.rect_center_lats[j])
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ "lat = %5.1f" % (expect_data[i, j], regrid_data[i, j],
-+ self.rect_center_lons[i], self.rect_center_lats[j]))
- if mismatch_found:
- self.fail("data mismatch found")
-
-@@ -321,9 +324,9 @@ class CurvRectRegridderTests(unittest.Te
- for j in xrange(expect_data.shape[1]):
- if numpy.abs(expect_data[i, j] - regrid_data[i, j]) > 0.0011:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f" % (expect_data[i, j], regrid_data[i, j],
-- self.rect_center_lons[i], self.rect_center_lats[j])
-+ self.rect_center_lons[i], self.rect_center_lats[j]))
- if mismatch_found:
- self.fail("data mismatch found")
-
-@@ -362,9 +365,9 @@ class CurvRectRegridderTests(unittest.Te
- for j in xrange(1, expect_data.shape[1] - 1):
- if numpy.abs(expect_data[i, j] - regrid_data[i, j]) > 0.0004:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %7.3f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %7.3f, " \
- "lat = %7.3f" % (expect_data[i, j], regrid_data[i, j],
-- self.curv_center_lons[i][j], self.curv_center_lats[i][j])
-+ self.curv_center_lons[i][j], self.curv_center_lats[i][j]))
- if mismatch_found:
- self.fail("data mismatch found")
-
-@@ -392,9 +395,9 @@ class CurvRectRegridderTests(unittest.Te
- for j in xrange(2, expect_data.shape[1] - 1):
- if numpy.abs(expect_data[i, j] - regrid_data[i, j]) > 0.0003:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %7.3f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %7.3f, " \
- "lat = %7.3f" % (expect_data[i, j], regrid_data[i, j],
-- self.curv_center_lons[i][j], self.curv_center_lats[i][j])
-+ self.curv_center_lons[i][j], self.curv_center_lats[i][j]))
- if mismatch_found:
- self.fail("data mismatch found")
-
-@@ -429,9 +432,9 @@ class CurvRectRegridderTests(unittest.Te
- for j in xrange(2, expect_data.shape[1] - 1):
- if numpy.abs(expect_data[i, j] - regrid_data[i, j]) > 0.0011:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %7.3f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %7.3f, " \
- "lat = %7.3f" % (expect_data[i, j], regrid_data[i, j],
-- self.curv_center_lons[i][j], self.curv_center_lats[i][j])
-+ self.curv_center_lons[i][j], self.curv_center_lats[i][j]))
- if mismatch_found:
- self.fail("data mismatch found")
-
-Index: pyferret-7.0.0/pyfermod/regrid/regrid3d.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regrid3d.py
-+++ pyferret-7.0.0/pyfermod/regrid/regrid3d.py
-@@ -7,6 +7,7 @@ to ESMF to perform the regridding.
- @author: Karl Smith
- '''
-
-+from __future__ import print_function # for python3
- import numpy
- import ESMP
-
-@@ -225,10 +226,10 @@ class CurvRect3DRegridder(object):
- corner_ignore_array = None
-
- # Release any regridding procedures and clear the dictionaries
-- for handle in self.__rect_to_curv_handles.values():
-+ for handle in list(self.__rect_to_curv_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__rect_to_curv_handles.clear()
-- for handle in self.__curv_to_rect_handles.values():
-+ for handle in list(self.__curv_to_rect_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__curv_to_rect_handles.clear()
- # Destroy any curvilinear ESMP_Fields
-@@ -288,12 +289,15 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- fout = open("curv_corner_xyz.txt", "w")
- try:
-- print >>fout, "curv_corner_x = %s" % \
-- self.__myArrayStr(grid_x_coords, corner_lons_array.shape)
-- print >>fout, "curv_corner_y = %s" % \
-- self.__myArrayStr(grid_y_coords, corner_lons_array.shape)
-- print >>fout, "curv_corner_z = %s" % \
-- self.__myArrayStr(grid_z_coords, corner_lons_array.shape)
-+ print ("curv_corner_x = %s" % \
-+ self.__myArrayStr(grid_x_coords, corner_lons_array.shape), \
-+ file=fout)
-+ print ("curv_corner_y = %s" % \
-+ self.__myArrayStr(grid_y_coords, corner_lons_array.shape), \
-+ file=fout)
-+ print ("curv_corner_z = %s" % \
-+ self.__myArrayStr(grid_z_coords, corner_lons_array.shape), \
-+ file=fout)
- finally:
- fout.close()
-
-@@ -346,12 +350,15 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- fout = open("curv_center_xyz.txt", "w")
- try:
-- print >>fout, "curv_center_x = %s" % \
-- self.__myArrayStr(grid_x_coords, self.__curv_shape)
-- print >>fout, "curv_center_y = %s" % \
-- self.__myArrayStr(grid_y_coords, self.__curv_shape)
-- print >>fout, "curv_center_z = %s" % \
-- self.__myArrayStr(grid_z_coords, self.__curv_shape)
-+ print ("curv_center_x = %s" % \
-+ self.__myArrayStr(grid_x_coords, self.__curv_shape), \
-+ file=fout)
-+ print ("curv_center_y = %s" % \
-+ self.__myArrayStr(grid_y_coords, self.__curv_shape), \
-+ file=fout)
-+ print ("curv_center_z = %s" % \
-+ self.__myArrayStr(grid_z_coords, self.__curv_shape), \
-+ file=fout)
- finally:
- fout.close()
-
-@@ -429,8 +436,9 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- fout = open("curv_data.txt", "w")
- try:
-- print >>fout, "curv_data = %s" % \
-- self.__myArrayStr(field_ptr, self.__curv_shape)
-+ print ("curv_data = %s" % \
-+ self.__myArrayStr(field_ptr, self.__curv_shape),
-+ file=fout)
- finally:
- fout.close()
-
-@@ -570,10 +578,10 @@ class CurvRect3DRegridder(object):
- corner_ignore_array = None
-
- # Release any regridding procedures and clear the dictionaries
-- for handle in self.__rect_to_curv_handles.values():
-+ for handle in list(self.__rect_to_curv_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__rect_to_curv_handles.clear()
-- for handle in self.__curv_to_rect_handles.values():
-+ for handle in list(self.__curv_to_rect_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__curv_to_rect_handles.clear()
- # Destroy any rectilinear ESMP_Fields
-@@ -642,12 +650,15 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- fout = open("rect_corner_xyz.txt", "w")
- try:
-- print >>fout, "rect_corner_x = %s" % \
-- self.__myArrayStr(grid_x_coords, corner_shape)
-- print >>fout, "rect_corner_y = %s" % \
-- self.__myArrayStr(grid_y_coords, corner_shape)
-- print >>fout, "rect_corner_z = %s" % \
-- self.__myArrayStr(grid_z_coords, corner_shape)
-+ print ("rect_corner_x = %s" % \
-+ self.__myArrayStr(grid_x_coords, corner_shape),
-+ file=fout)
-+ print ("rect_corner_y = %s" % \
-+ self.__myArrayStr(grid_y_coords, corner_shape),
-+ file=fout)
-+ print ("rect_corner_z = %s" % \
-+ self.__myArrayStr(grid_z_coords, corner_shape),
-+ file=fout)
- finally:
- fout.close()
-
-@@ -707,12 +718,15 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- try:
- fout = open("rect_center_xyz.txt", "w")
-- print >>fout, "rect_center_x = %s" % \
-- self.__myArrayStr(grid_x_coords, self.__rect_shape)
-- print >>fout, "rect_center_y = %s" % \
-- self.__myArrayStr(grid_y_coords, self.__rect_shape)
-- print >>fout, "rect_center_z = %s" % \
-- self.__myArrayStr(grid_z_coords, self.__rect_shape)
-+ print ("rect_center_x = %s" % \
-+ self.__myArrayStr(grid_x_coords, self.__rect_shape),
-+ file=fout)
-+ print ("rect_center_y = %s" % \
-+ self.__myArrayStr(grid_y_coords, self.__rect_shape),
-+ file=fout)
-+ print ("rect_center_z = %s" % \
-+ self.__myArrayStr(grid_z_coords, self.__rect_shape),
-+ file=fout)
- finally:
- fout.close()
-
-@@ -790,8 +804,9 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- fout = open("rect_data.txt", "w")
- try:
-- print >>fout, "rect_data = %s" % \
-- self.__myArrayStr(field_ptr, self.__rect_shape)
-+ print ("rect_data = %s" % \
-+ self.__myArrayStr(field_ptr, self.__rect_shape),
-+ file=fout)
- finally:
- fout.close()
-
-@@ -866,8 +881,9 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- fout = open("regr_rect_data.txt", "w")
- try:
-- print >>fout, "regr_rect_data = %s" % \
-- self.__myArrayStr(result, self.__rect_shape)
-+ print ("regr_rect_data = %s" % \
-+ self.__myArrayStr(result, self.__rect_shape),
-+ file=fout)
- finally:
- fout.close()
-
-@@ -946,8 +962,9 @@ class CurvRect3DRegridder(object):
- if self.__debug:
- fout = open("regr_curv_data.txt", "w")
- try:
-- print >>fout, "regr_curv_data = %s" % \
-- self.__myArrayStr(result, self.__curv_shape)
-+ print ("regr_curv_data = %s" % \
-+ self.__myArrayStr(result, self.__curv_shape),
-+ file=fout)
- finally:
- fout.close()
- result = result.reshape(self.__curv_shape, order='F')
-@@ -968,10 +985,10 @@ class CurvRect3DRegridder(object):
- None
- '''
- # Release any regridding procedures and clear the dictionaries
-- for handle in self.__rect_to_curv_handles.values():
-+ for handle in list(self.__rect_to_curv_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__rect_to_curv_handles.clear()
-- for handle in self.__curv_to_rect_handles.values():
-+ for handle in list(self.__curv_to_rect_handles.values()):
- ESMP.ESMP_FieldRegridRelease(handle)
- self.__curv_to_rect_handles.clear()
- # Destroy any ESMP_Fields
-Index: pyferret-7.0.0/pyfermod/regrid/regrid3dexample.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regrid3dexample.py
-+++ pyferret-7.0.0/pyfermod/regrid/regrid3dexample.py
-@@ -4,12 +4,12 @@ and also serves as a coding example of u
-
- @author: Karl Smith
- '''
--
-+from __future__ import print_function
- import numpy
- import ESMP
--from esmpcontrol import ESMPControl
--from regrid3d import CurvRect3DRegridder
--
-+from .esmpcontrol import ESMPControl
-+from .regrid3d import CurvRect3DRegridder
-+from builtins import input
-
- GULF_MEX_LONS = (262.0, 278.0, 0.5)
- GULF_MEX_LATS = (18.0, 31.0, 0.5)
-@@ -381,33 +381,33 @@ def printDiffs(grid_lons, grid_lats, gri
- for (_, lon, lat, depth, expect, found) in diff_list:
- if expect == undef_val:
- num_not_undef += 1
-- print "lon = %#7.3f, lat = %7.3f, depth = %7.2f, expect = undef, " \
-- "found = %#6.3f" % (lon, lat, depth, found)
-+ print ("lon = %#7.3f, lat = %7.3f, depth = %7.2f, expect = undef, " \
-+ "found = %#6.3f" % (lon, lat, depth, found))
- elif found == undef_val:
- num_undef += 1
-- # print "lon = %#7.3f, lat = %7.3f, depth = %7.2f, expect = %#6.3f, " \
-- # "found = undef" % (lon, lat, depth, expect)
-+ # print ("lon = %#7.3f, lat = %7.3f, depth = %7.2f, expect = %#6.3f, " \
-+ # "found = undef" % (lon, lat, depth, expect))
- else:
- num_diff += 1
-- print "lon = %#7.3f, lat = %7.3f, depth = %7.2f, expect = %#6.3f, " \
-+ print ("lon = %#7.3f, lat = %7.3f, depth = %7.2f, expect = %#6.3f, " \
- "found = %#6.3f, diff = %#6.3f" \
-- % (lon, lat, depth, expect, found, found - expect)
-- print "%3d undefined when defined might be expected" % num_undef
-- print "%3d with absolute difference > %#.3f" % (num_diff, max_negl)
-- print "%3d defined when undefined expected" % num_not_undef
-- print "%3d values in the grid" \
-- % (expect_data.shape[0] * expect_data.shape[1] * expect_data.shape[2])
-+ % (lon, lat, depth, expect, found, found - expect))
-+ print ("%3d undefined when defined might be expected" % num_undef)
-+ print ("%3d with absolute difference > %#.3f" % (num_diff, max_negl))
-+ print ("%3d defined when undefined expected" % num_not_undef)
-+ print ("%3d values in the grid" \
-+ % (expect_data.shape[0] * expect_data.shape[1] * expect_data.shape[2]))
-
-
- if __name__ == '__main__':
- try:
- while True:
-- print 'cw2r: curvilinear with corners to rectilinear'
-- print 'co2r: curvilinear without corners to rectilinear'
-- print 'r2cw: rectilinear to curvilinear with corners'
-- print 'r2co: rectilinear to curvilinear without corners'
-- print 'Ctrl-D to quit'
-- direction = raw_input('Regrid test to run? ')
-+ print ('cw2r: curvilinear with corners to rectilinear')
-+ print ('co2r: curvilinear without corners to rectilinear')
-+ print ('r2cw: rectilinear to curvilinear with corners')
-+ print ('r2co: rectilinear to curvilinear without corners')
-+ print ('Ctrl-D to quit')
-+ direction = input('Regrid test to run? ')
- direction = direction.strip().lower()
- if direction in ('cw2r', 'co2r', 'r2cw', 'r2co'):
- break
-@@ -460,11 +460,11 @@ if __name__ == '__main__':
-
- if direction in ('cw2r', 'co2r'):
-
-- print ""
-+ print ("")
- if direction == 'cw2r':
-- print "Examining rectilinear results from curvilinear with corners"
-+ print ("Examining rectilinear results from curvilinear with corners")
- else:
-- print "Examining rectilinear results from curvilinear without corners"
-+ print ("Examining rectilinear results from curvilinear without corners")
-
- # Create the curvilinear source field
- regridder.assignCurvField(curv_data)
-@@ -492,8 +492,8 @@ if __name__ == '__main__':
- # Corners required for this method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_CONSERVE)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus conserve regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus conserve regridded (found) differences")
- printDiffs(rect_3d_center_lons,
- rect_3d_center_lats,
- rect_3d_center_depths,
-@@ -504,8 +504,8 @@ if __name__ == '__main__':
- # Regrid from curvilinear to rectilinear using the bilinear method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_BILINEAR)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus bilinear regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus bilinear regridded (found) differences")
- printDiffs(rect_3d_center_lons,
- rect_3d_center_lats,
- rect_3d_center_depths,
-@@ -516,8 +516,8 @@ if __name__ == '__main__':
- # Regrid from curvilinear to rectilinear using the patch method
- rect_regrid_data = regridder.regridCurvToRect(undef_val, ESMP.ESMP_REGRIDMETHOD_PATCH)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus patch regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus patch regridded (found) differences")
- printDiffs(rect_3d_center_lons,
- rect_3d_center_lats,
- rect_3d_center_depths,
-@@ -527,11 +527,11 @@ if __name__ == '__main__':
-
- elif direction in ('r2cw', 'r2co'):
-
-- print ""
-+ print ("")
- if direction == 'r2cw':
-- print "Examining curvilinear with corners results from rectilinear"
-+ print ("Examining curvilinear with corners results from rectilinear")
- else:
-- print "Examining curvilinear without corners results from rectilinear"
-+ print ("Examining curvilinear without corners results from rectilinear")
-
- # Create the rectilinear source field
- regridder.assignRectField(rect_data)
-@@ -544,8 +544,8 @@ if __name__ == '__main__':
- # Corners required for this method
- curv_regrid_data = regridder.regridRectToCurv(undef_val, ESMP.ESMP_REGRIDMETHOD_CONSERVE)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus conserve regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus conserve regridded (found) differences")
- printDiffs(curv_center_lons[:,:,1:-1],
- curv_center_lats[:,:,1:-1],
- curv_center_depths[:,:,1:-1],
-@@ -556,8 +556,8 @@ if __name__ == '__main__':
- # Regrid from rectilinear to curvilinear using the bilinear method
- curv_regrid_data = regridder.regridRectToCurv(undef_val, ESMP.ESMP_REGRIDMETHOD_BILINEAR)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus bilinear regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus bilinear regridded (found) differences")
- printDiffs(curv_center_lons[:,:,1:-1],
- curv_center_lats[:,:,1:-1],
- curv_center_depths[:,:,1:-1],
-@@ -568,8 +568,8 @@ if __name__ == '__main__':
- # Regrid from rectilinear to curvilinear using the patch method
- curv_regrid_data = regridder.regridRectToCurv(undef_val, ESMP.ESMP_REGRIDMETHOD_PATCH)
- # Print the differences between the expected and regrid data
-- print ""
-- print "analytic (expect) versus patch regridded (found) differences"
-+ print ("")
-+ print ("analytic (expect) versus patch regridded (found) differences")
- printDiffs(curv_center_lons[:,:,1:-1],
- curv_center_lats[:,:,1:-1],
- curv_center_depths[:,:,1:-1],
-Index: pyferret-7.0.0/pyfermod/regrid/regrid3dtests.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regrid3dtests.py
-+++ pyferret-7.0.0/pyfermod/regrid/regrid3dtests.py
-@@ -3,11 +3,12 @@ Unit tests for CurvRect3DRegridder
-
- @author: Karl Smith
- '''
-+from __future__ import print_function #python3
- import unittest
- import numpy
- import ESMP
--from esmpcontrol import ESMPControl
--from regrid3d import CurvRect3DRegridder
-+from .esmpcontrol import ESMPControl
-+from .regrid3d import CurvRect3DRegridder
-
-
- class CurvRect3DRegridderTests(unittest.TestCase):
-@@ -347,10 +348,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
- regrid_data[i, j, k], self.rect_center_lons[i],
-- self.rect_center_lats[j], self.rect_center_levs[k])
-+ self.rect_center_lats[j], self.rect_center_levs[k]))
- if mismatch_found:
- self.fail("data mismatch found for bilinear regridding without flags")
-
-@@ -372,10 +373,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
-- regrid_data[i, j, k], self.rect_center_lons[i],
-- self.rect_center_lats[j], self.rect_center_levs[k])
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
-+ regrid_data[i, j, k], self.rect_center_lons[i],
-+ self.rect_center_lats[j], self.rect_center_levs[k]))
- if mismatch_found:
- self.fail("data mismatch found for bilinear regridding with flags")
-
-@@ -408,10 +409,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
- regrid_data[i, j, k], self.rect_center_lons[i],
-- self.rect_center_lats[j], self.rect_center_levs[k])
-+ self.rect_center_lats[j], self.rect_center_levs[k]))
- if mismatch_found:
- self.fail("data mismatch found for conservative regridding")
-
-@@ -441,10 +442,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
- regrid_data[i, j, k], self.rect_center_lons[i],
-- self.rect_center_lats[j], self.rect_center_levs[k])
-+ self.rect_center_lats[j], self.rect_center_levs[k]))
- if mismatch_found:
- self.fail("data mismatch found for patch regridding")
-
-@@ -474,10 +475,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
- regrid_data[i, j, k], self.curv_center_lons[i][j][k],
-- self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k])
-+ self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k]))
- if mismatch_found:
- self.fail("data mismatch found for bilinear regridding without flags")
-
-@@ -499,10 +500,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
- regrid_data[i, j, k], self.curv_center_lons[i][j][k],
-- self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k])
-+ self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k]))
- if mismatch_found:
- self.fail("data mismatch found for bilinear regridding with flags")
-
-@@ -535,10 +536,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
- regrid_data[i, j, k], self.curv_center_lons[i][j][k],
-- self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k])
-+ self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k]))
- if mismatch_found:
- self.fail("data mismatch found for conservative regridding")
-
-@@ -570,10 +571,10 @@ class CurvRect3DRegridderTests(unittest.
- for k in xrange(margin, expect_data.shape[2] - margin):
- if numpy.abs(expect_data[i, j, k] - regrid_data[i, j, k]) > delta:
- mismatch_found = True
-- print "expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
-+ print ("expect = %#6.4f, found = %#6.4f for lon = %5.1f, " \
- "lat = %5.1f, lev = %5.1f" % (expect_data[i, j, k],
- regrid_data[i, j, k], self.curv_center_lons[i][j][k],
-- self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k])
-+ self.curv_center_lats[i][j][k], self.curv_center_levs[i][j][k]))
- if mismatch_found:
- self.fail("data mismatch found for patch regridding")
-
-Index: pyferret-7.0.0/pyfermod/regrid/regridtests.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/regrid/regridtests.py
-+++ pyferret-7.0.0/pyfermod/regrid/regridtests.py
-@@ -5,7 +5,8 @@ Tests of the regrid.__init__ functions
- '''
- import unittest
- import numpy
--import __init__ as regrid
-+from . import __init__ as regrid
-+from past.builtins import xrange
-
- class RegridTests(unittest.TestCase):
- '''
-Index: pyferret-7.0.0/pyfermod/eofanal/eofdatapiece.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/eofanal/eofdatapiece.py
-+++ pyferret-7.0.0/pyfermod/eofanal/eofdatapiece.py
-@@ -6,7 +6,8 @@ Time Amplitude Funtion (TAF)
-
- @author: Karl Smith
- '''
--
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import pyferret.eofanal as eofanal
-@@ -145,12 +146,12 @@ if __name__ == "__main__":
- tdata = -5.0 * numpy.cos((tdata - 2190.0) * numpy.pi / 4380.0)
- yztdata += numpy.outer(yzdata, tdata).reshape((1, 17, 6, 25, 1, 1))
- yztdata += 6.0
-- print "time series at Y = 0.0, Z = 0.0"
-- print str(yztdata[0, 8, 0, :, 0, 0])
-- print "depth series at Y = 0.0, T = start of April"
-- print str(yztdata[0, 8, :, 6, 0, 0])
-- print "latitude series at Z = 0.0, T = start of April"
-- print str(yztdata[0, :, 0, 6, 0, 0])
-+ print ("time series at Y = 0.0, Z = 0.0")
-+ print (str(yztdata[0, 8, 0, :, 0, 0]))
-+ print ("depth series at Y = 0.0, T = start of April")
-+ print (str(yztdata[0, 8, :, 6, 0, 0]))
-+ print ("latitude series at Z = 0.0, T = start of April")
-+ print (str(yztdata[0, :, 0, 6, 0, 0]))
- # Create the result array and the other ferret_compute arguments
- result = numpy.zeros((1, 17, 6, 25, 17*6, 1))
- resbdf = numpy.array([1.0E20])
-@@ -163,17 +164,17 @@ if __name__ == "__main__":
- for m in xrange(17 * 6):
- if numpy.allclose(result[:, :, :, :, m, 0], resbdf):
- break;
-- print "EOF-TAF piece %d" % m
-- print " time series at Y = 0.0, Z = 0.0"
-- print " " + str(result[0, 8, 0, :, m, 0])
-- print " depth series at Y = 0.0, T = start of April"
-- print " " + str(result[0, 8, :, 6, m, 0])
-- print " latitude series at Z = 0.0, T = start of April"
-- print " " + str(result[0, :, 0, 6, m, 0])
-+ print ("EOF-TAF piece %d" % m)
-+ print (" time series at Y = 0.0, Z = 0.0")
-+ print (" " + str(result[0, 8, 0, :, m, 0]))
-+ print (" depth series at Y = 0.0, T = start of April")
-+ print (" " + str(result[0, 8, :, 6, m, 0]))
-+ print (" latitude series at Z = 0.0, T = start of April")
-+ print (" " + str(result[0, :, 0, 6, m, 0]))
- lastone = m
- piecesum += result[:, :, :, :, m, 0]
- if numpy.allclose(piecesum, yztdata[:, :, :, :, 0, 0]):
-- print "sum of %d pieces all close to input data" % lastone
-+ print ("sum of %d pieces all close to input data" % lastone)
- else:
-- print "sum %d pieces different from input data" % lastone
-+ print ("sum %d pieces different from input data" % lastone)
-
-Index: pyferret-7.0.0/pyfermod/eofanal/eofdatasum.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/eofanal/eofdatasum.py
-+++ pyferret-7.0.0/pyfermod/eofanal/eofdatasum.py
-@@ -8,7 +8,8 @@ Functions (EOFs) and their corresponding
- @author: Karl Smith
- '''
-
--
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import pyferret.eofanal as eofanal
-@@ -146,12 +147,12 @@ if __name__ == "__main__":
- tdata = -5.0 * numpy.cos((tdata - 2190.0) * numpy.pi / 4380.0)
- yztdata += numpy.outer(yzdata, tdata).reshape((1, 17, 6, 25, 1, 1))
- yztdata += 6.0
-- print "time series at Y = 0.0, Z = 0.0"
-- print str(yztdata[0, 8, 0, :, 0, 0])
-- print "depth series at Y = 0.0, T = start of April"
-- print str(yztdata[0, 8, :, 6, 0, 0])
-- print "latitude series at Z = 0.0, T = start of April"
-- print str(yztdata[0, :, 0, 6, 0, 0])
-+ print ("time series at Y = 0.0, Z = 0.0")
-+ print (str(yztdata[0, 8, 0, :, 0, 0]))
-+ print ("depth series at Y = 0.0, T = start of April")
-+ print (str(yztdata[0, 8, :, 6, 0, 0]))
-+ print ("latitude series at Z = 0.0, T = start of April")
-+ print (str(yztdata[0, :, 0, 6, 0, 0]))
- # Create the result array and the other ferret_compute arguments
- result = numpy.zeros((1, 17, 6, 25, 17*6, 1))
- resbdf = numpy.array([1.0E20])
-@@ -163,17 +164,17 @@ if __name__ == "__main__":
- for m in xrange(17 * 6):
- if numpy.allclose(result[:, :, :, :, m, 0], resbdf):
- break;
-- print "EOF-TAF sum %d" % m
-- print " time series at Y = 0.0, Z = 0.0"
-- print " " + str(result[0, 8, 0, :, m, 0])
-- print " depth series at Y = 0.0, T = start of April"
-- print " " + str(result[0, 8, :, 6, m, 0])
-- print " latitude series at Z = 0.0, T = start of April"
-- print " " + str(result[0, :, 0, 6, m, 0])
-+ print ("EOF-TAF sum %d" % m)
-+ print (" time series at Y = 0.0, Z = 0.0")
-+ print (" " + str(result[0, 8, 0, :, m, 0]))
-+ print (" depth series at Y = 0.0, T = start of April")
-+ print (" " + str(result[0, 8, :, 6, m, 0]))
-+ print (" latitude series at Z = 0.0, T = start of April")
-+ print (" " + str(result[0, :, 0, 6, m, 0]))
- lastone = m
- if numpy.allclose(result[:, :, :, :, lastone, 0],
- yztdata[:, :, :, :, 0, 0]):
-- print "sum %d all close to input data" % lastone
-+ print ("sum %d all close to input data" % lastone)
- else:
-- print "sum %d different from input data" % lastone
-+ print ("sum %d different from input data" % lastone)
-
-Index: pyferret-7.0.0/pyfermod/eofanal/__init__.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/eofanal/__init__.py
-+++ pyferret-7.0.0/pyfermod/eofanal/__init__.py
-@@ -6,5 +6,5 @@ especially for Python external functions
- '''
-
- # Import classes given in modules in this package so they are all seen here.
--from eofanalysis import InvalidStateError, EOFAnalysis
-+from .eofanalysis import InvalidStateError, EOFAnalysis
-
-Index: pyferret-7.0.0/pyfermod/fershp/__init__.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/__init__.py
-+++ pyferret-7.0.0/pyfermod/fershp/__init__.py
-@@ -2,6 +2,7 @@
- Helper functions for pyferret shapefile external functions.
- """
-
-+from __future__ import print_function
- import numpy
- import shapefile
- import os
-@@ -33,7 +34,7 @@ def createprjfile(shapefile_mapprj, shap
- prj_descript = pyferret.fershp.mapprj.name_to_descript(shapefile_mapprj)
- (sfname, ext) = os.path.splitext(shapefile_name)
- prjfile = file("%s.prj" % sfname, "w")
-- print >>prjfile, prj_descript
-+ print (prj_descript, file=prjfile)
- prjfile.close()
-
-
-@@ -241,7 +242,7 @@ if __name__ == "__main__":
- " expect: %s\n" \
- " found: %s" % (wgs84upsnorth_descript, descript))
- del prjfile, datalines, descript
-- print "createprjfile: SUCCESS"
-+ print ("createprjfile: SUCCESS")
-
- # Test quadxycentroids
- xvals = ( ( 0, 1 ), ( 3, 4 ) )
-@@ -268,7 +269,7 @@ if __name__ == "__main__":
- raise ValueError("Centroid Y values: expected %s; found %s" % \
- (str(expecty), str(centy)))
- del xvals, yvals, expectx, expecty, centx, centy
-- print "quadxycentroids: SUCCESS"
-+ print ("quadxycentroids: SUCCESS")
-
- # Test quadxycenters
- xvals = ( ( 0, 1 ), ( 3, 4 ) )
-@@ -295,7 +296,7 @@ if __name__ == "__main__":
- raise ValueError("Centroid Y values: expected %s; found %s" % \
- (str(expecty), str(centy)))
- del xvals, yvals, expectx, expecty, centx, centy
-- print "quadxycenters: SUCCESS"
-+ print ("quadxycenters: SUCCESS")
-
- # Test addquadxyvalues
- coords = [ [0.0, 0.0], [1.0, 0.0], [1.0, -1.0], [2.0, 1.0] ]
-@@ -337,5 +338,5 @@ if __name__ == "__main__":
- os.remove("%s.shx" % shapefilename)
- os.remove("%s.prj" % shapefilename)
-
-- print "addquadxyvalues: SUCCESS"
-+ print ("addquadxyvalues: SUCCESS")
-
-Index: pyferret-7.0.0/pyfermod/fershp/mapprj.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/mapprj.py
-+++ pyferret-7.0.0/pyfermod/fershp/mapprj.py
-@@ -2,6 +2,8 @@
- Map projection file utility functions
- """
-
-+from __future__ import print_function
-+
- def name_to_descript(mapprj_name):
- """
- Returns the map projection file contents of the given common name
-@@ -2709,4 +2711,4 @@ if __name__ == "__main__":
- if num_descripts != 1337:
- raise ValueError("Number of entries in _DESCRIPT_DICT: expect: 1337, found: %d" % num_descripts)
-
-- print "mapprj: SUCCESS"
-+ print ("mapprj: SUCCESS")
-Index: pyferret-7.0.0/pyfermod/fershp/shapefile_readxy.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/shapefile_readxy.py
-+++ pyferret-7.0.0/pyfermod/fershp/shapefile_readxy.py
-@@ -4,6 +4,8 @@ coordinates from the points in the indic
- The missing value separates coordinates between shapes.
- """
-
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import shapefile
-@@ -86,9 +88,9 @@ if __name__ == "__main__":
- inpbdfs = numpy.array([-8888.0, -7777.0], dtype=numpy.float64)
- maxpts = 3200 * 2400
- result = -6666.0 * numpy.ones((maxpts,2,1,1,1,1), dtype=numpy.float64, order='F')
-- print "ferret_compute start: time = %s" % time.asctime()
-+ print ("ferret_compute start: time = %s" % time.asctime())
- ferret_compute(0, result, resbdf, ("tl_2010_us_county10", maxpts, ), inpbdfs)
-- print "ferret_compute done; time = %s" % time.asctime()
-+ print ("ferret_compute done; time = %s" % time.asctime())
- good_x = numpy.logical_and((-180.0 <= result[:,0,0,0,0,0]), (result[:,0,0,0,0,0] <= -65.0))
- good_x = numpy.logical_or(good_x,
- numpy.logical_and((172.0 <= result[:,0,0,0,0,0]), (result[:,0,0,0,0,0] <= 180.0)))
-@@ -110,7 +112,7 @@ if __name__ == "__main__":
- if count == 0:
- at_end = True
- else:
-- # print "Count[%d] = %d" % (shape_num, count)
-+ # print ("Count[%d] = %d" % (shape_num, count))
- shape_num += 1
- total += count + 1
- count = 0
-@@ -119,8 +121,8 @@ if __name__ == "__main__":
- else:
- count += 1
- total += count
-- print "total (including missing-value separators) = %d" % total
-- print "out of a maximum of %d" % result.shape[0]
-- print "number of shapes = %d" % shape_num
-- print "shapefile_readxy: SUCCESS"
-+ print ("total (including missing-value separators) = %d" % total)
-+ print ("out of a maximum of %d" % result.shape[0])
-+ print ("number of shapes = %d" % shape_num)
-+ print ("shapefile_readxy: SUCCESS")
-
-Index: pyferret-7.0.0/pyfermod/fershp/shapefile_readxyval.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/shapefile_readxyval.py
-+++ pyferret-7.0.0/pyfermod/fershp/shapefile_readxyval.py
-@@ -4,6 +4,8 @@ latitude), as well as a value for shapes
- The missing value separates coordinates between shapes.
- """
-
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import shapefile
-@@ -76,10 +78,10 @@ def ferret_compute(efid, result, resbdf,
- if sf.fields[k][0] == fieldname:
- break
- else:
-- print "Known fields (name, type, size, precision):"
-+ print ("Known fields (name, type, size, precision):")
- for field in sf.fields:
- if field[0] != 'DeletionFlag':
-- print " %s" % str(field)
-+ print (" %s" % str(field))
- raise ValueError("No field with the name '%s' found" % fieldname)
- if sf.fields[0][0] == 'DeletionFlag':
- field_index = k - 1
-@@ -126,10 +128,10 @@ if __name__ == "__main__":
- inpbdfs = numpy.array([-8888.0, -7777.0], dtype=numpy.float64)
- maxpts = 3200 * 2400
- result = -6666.0 * numpy.ones((maxpts,3,1,1,1,1), dtype=numpy.float64, order='F')
-- print "ferret_compute start: time = %s" % time.asctime()
-+ print ("ferret_compute start: time = %s" % time.asctime())
- # INTPTLAT10 == latitude of an internal point in each county
- ferret_compute(0, result, resbdf, ("tl_2010_us_county10", "INTPTLAT10", maxpts, ), inpbdfs)
-- print "ferret_compute done; time = %s" % time.asctime()
-+ print ("ferret_compute done; time = %s" % time.asctime())
- good_x = numpy.logical_and((-180.0 <= result[:,0,0,0,0,0]), (result[:,0,0,0,0,0] <= -65.0))
- good_x = numpy.logical_or(good_x,
- numpy.logical_and((172.0 <= result[:,0,0,0,0,0]), (result[:,0,0,0,0,0] <= 180.0)))
-@@ -151,7 +153,7 @@ if __name__ == "__main__":
- if count == 0:
- at_end = True
- else:
-- # print "Count[%d] = %d" % (shape_num, count)
-+ # print ("Count[%d] = %d" % (shape_num, count))
- shape_num += 1
- total += count + 1
- count = 0
-@@ -167,5 +169,5 @@ if __name__ == "__main__":
- num_good = len(result[:,2,0,0,0,0][good_val])
- if num_good != shape_num:
- raise ValueError("number of values: expected %d, found %d" % (shape_num, num_good))
-- print "shapefile_readxyval: SUCCESS"
-+ print ("shapefile_readxyval: SUCCESS")
-
-Index: pyferret-7.0.0/pyfermod/fershp/shapefile_readxyz.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/shapefile_readxyz.py
-+++ pyferret-7.0.0/pyfermod/fershp/shapefile_readxyz.py
-@@ -3,7 +3,7 @@ Returns the X, Y, and Z (presumably long
- coordinates from the points in the indicated shapefile.
- The missing value separates coordinates between shapes.
- """
--
-+from __future__ import print_function
- import numpy
- import pyferret
- import shapefile
-@@ -82,6 +82,6 @@ if __name__ == "__main__":
- info = ferret_init(0)
-
- # this is tested under shapefile_writexyzval
-- print "shapefile_readxyz: SUCCESS (limited)"
-- print " run shapefile_writexyzval for full test"
-+ print ("shapefile_readxyz: SUCCESS (limited)")
-+ print (" run shapefile_writexyzval for full test")
-
-Index: pyferret-7.0.0/pyfermod/fershp/shapefile_readxyzval.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/shapefile_readxyzval.py
-+++ pyferret-7.0.0/pyfermod/fershp/shapefile_readxyzval.py
-@@ -4,7 +4,8 @@ latitude, and level), as well as a value
- a shapefile. The missing value separates coordinates
- between shapes.
- """
--
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import shapefile
-@@ -78,10 +79,10 @@ def ferret_compute(efid, result, resbdf,
- if sf.fields[k][0] == fieldname:
- break
- else:
-- print "Known fields (name, type, size, precision):"
-+ print ("Known fields (name, type, size, precision):")
- for field in sf.fields:
- if field[0] != 'DeletionFlag':
-- print " %s" % str(field)
-+ print (" %s" % str(field))
- raise ValueError("No field with the name '%s' found" % fieldname)
- if sf.fields[0][0] == 'DeletionFlag':
- field_index = k - 1
-@@ -124,6 +125,6 @@ if __name__ == "__main__":
- info = ferret_init(0)
-
- # this is tested under shapefile_writexyzval
-- print "shapefile_readxyzval: SUCCESS (limited)"
-- print " run shapefile_writexyzval for full test"
-+ print ("shapefile_readxyzval: SUCCESS (limited)")
-+ print (" run shapefile_writexyzval for full test")
-
-Index: pyferret-7.0.0/pyfermod/fershp/shapefile_writeval.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/shapefile_writeval.py
-+++ pyferret-7.0.0/pyfermod/fershp/shapefile_writeval.py
-@@ -5,7 +5,8 @@ this axis is used). The vertices of the
- of the bounding boxes of the X and Y axes of the given value array. The
- value(s) associated with each shape comes from the value array.
- """
--
-+from __future__ import print_function
-+from past.builtins import xrange
- import pyferret
- import pyferret.fershp
- import shapefile
-@@ -145,4 +146,4 @@ if __name__ == "__main__":
- # Testing ferret_compute difficult due to call
- # to get_axis_box_limits and get_axis_coordinates
-
-- print "shapefile_writeval: SUCCESS (limited)"
-+ print ("shapefile_writeval: SUCCESS (limited)")
-Index: pyferret-7.0.0/pyfermod/fershp/shapefile_writexyval.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/shapefile_writexyval.py
-+++ pyferret-7.0.0/pyfermod/fershp/shapefile_writexyval.py
-@@ -9,7 +9,8 @@ element of the value for the previously
- Quadrilaterals associated with missing values are omitted from
- the shapefile.
- """
--
-+from __future__ import print_function
-+from past.builtins import xrange
- import shapefile
- import pyferret
- import pyferret.fershp
-@@ -288,7 +289,7 @@ if __name__ == "__main__":
- sortedvals[2 * numvals // 5],
- sortedvals[3 * numvals // 5],
- sortedvals[4 * numvals // 5], ]
-- print str( [ sortedvals[0] ] + limits + [ sortedvals[-1] ] )
-+ print (str( [ sortedvals[0] ] + limits + [ sortedvals[-1] ] ))
-
- partvals = vals.copy()
- partvals[ partvals >= limits[0] ] = inpbdfs[3]
-@@ -323,5 +324,5 @@ if __name__ == "__main__":
- fieldname, ""), inpbdfs)
- """
-
-- print "shapefile_writexyval: SUCCESS"
-+ print ("shapefile_writexyval: SUCCESS")
-
-Index: pyferret-7.0.0/pyfermod/fershp/shapefile_writexyzval.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/fershp/shapefile_writexyzval.py
-+++ pyferret-7.0.0/pyfermod/fershp/shapefile_writexyzval.py
-@@ -10,6 +10,8 @@ mentioned quadrilateral. Quadrilaterals
- values are omitted from the shapefile.
- """
-
-+from __future__ import print_function
-+from past.builtins import xrange
- import shapefile
- import pyferret
- import pyferret.fershp
-@@ -310,12 +312,12 @@ if __name__ == "__main__":
- " expect: %s\n" \
- " found: %s" % (wgs84_descript, descript))
-
-- print "shapefile_writexyzval: SUCCESS"
-+ print ("shapefile_writexyzval: SUCCESS")
-
- # Check the result for calling ferret_compute of shapefile_readxyz
- # in this directory. This assumes the ordering of the shapes does
- # not change, which appears to be the case but is not required.
-- import shapefile_readxyz
-+ from . import shapefile_readxyz
- maxpts = len(expcurvals[0])
- result = -11111.0 * numpy.ones((maxpts, 3, 1, 1, 1, 1), dtype=numpy.float64, order='F')
- shapefile_readxyz.ferret_compute(0, result, resbdf, (shapefilename, maxpts), inpbdfs[:2])
-@@ -329,7 +331,7 @@ if __name__ == "__main__":
- raise ValueError("Zs from shapefile_readxyz:\n expected\n%s\n found\n%s" % \
- (str(expcurvals[2]), str(result[:,2,0,0,0,0])))
-
-- print "shapefile_readxyz: SUCCESS"
-+ print ("shapefile_readxyz: SUCCESS")
-
- # Check the result for calling ferret_compute of shapefile_readxyzval
- # in this directory. This assumes the ordering of the shapes does
-@@ -354,7 +356,7 @@ if __name__ == "__main__":
- raise ValueError("Extra values from shapefile_readxyzval: expected all %s\n found\n%s" % \
- (str(float(resbdf[0])), str(result[numvals:,3,0,0,0,0])))
-
-- print "shapefile_readxyzval: SUCCESS"
-+ print ("shapefile_readxyzval: SUCCESS")
-
- os.remove("%s.dbf" % shapefilename)
- os.remove("%s.shp" % shapefilename)
-Index: pyferret-7.0.0/pyfermod/graphbind/__init__.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/graphbind/__init__.py
-+++ pyferret-7.0.0/pyfermod/graphbind/__init__.py
-@@ -1,17 +1,18 @@
- '''
-+
- Maintains a dictionary of classes which can be used to bind PyFerret
- graphics calls to a particular graphics engine.
-
- When a new Window is needed, the createWindow function in this module
- is called. This function creates an instance of the appropriate
--bindings class, its createWindow method is called, and the bindings
-+bindings class, its createWindow method is called, and the bindings
- instance is returned.
-
- Other methods of the bindings instance are called directly to perform
- graphics operations on this Window.
- '''
--
--from abstractpyferretbindings import AbstractPyFerretBindings
-+from __future__ import print_function
-+from pyferret.graphbind.abstractpyferretbindings import AbstractPyFerretBindings
-
- __pyferret_bindings_classes = { }
-
-@@ -46,7 +47,7 @@ def knownPyFerretEngines():
- Returns a tuple of all the known engine names.
- '''
- return tuple( __pyferret_bindings_classes.keys() )
--
-+
- def createWindow(engine_name, title, visible, noalpha):
- '''
- Creates an instance of the bindings class associated with
-@@ -109,5 +110,4 @@ if __name__ == "__main__":
- (known_engines[0] != TestBindings.engine_name):
- raise RuntimeError("Unexpected tuple of known engines: %s" % \
- str(known_engines))
-- print "Success"
--
-+ print ("Success")
-Index: pyferret-7.0.0/pyfermod/stats/__init__.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/__init__.py
-+++ pyferret-7.0.0/pyfermod/stats/__init__.py
-@@ -1,6 +1,8 @@
- """
- Helper functions for pyferret stats external functions.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import math
- import numpy
- try:
-@@ -883,7 +885,7 @@ if __name__ == "__main__":
- distname = "beta"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d" % \
- (distname, len(descript)))
- del descript
-@@ -902,7 +904,7 @@ if __name__ == "__main__":
- (alpha * beta * (alpha + beta + 2.0) * (alpha + beta + 3.0)),
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del alpha, beta, foundstats, expectedstats
-@@ -912,25 +914,25 @@ if __name__ == "__main__":
- distparms.append(1.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Binomial distribution
- distname = "binom"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -946,26 +948,26 @@ if __name__ == "__main__":
- (1.0 - 6.0 * prob * (1.0 - prob)) / (ntrials * prob * (1.0 - prob)),
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del ntrials, prob, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # no binom.fit function
- del distparms, distf, newparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Cauchy distribution
- distname = "cauchy"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -979,32 +981,32 @@ if __name__ == "__main__":
- foundpdfs = distf.pdf(xvals)
- expectedpdfs = (gamma / numpy.pi) / ((xvals - m)**2 + gamma**2)
- if not numpy.allclose(foundpdfs, expectedpdfs):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("pdfs(0.0:10.1:0.5) of %s(%#.1f,%#.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedpdfs), str(foundpdfs)))
- del m, gamma, xvals, foundpdfs, expectedpdfs
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Chi distribution
- distname = "chi"
- descript = getdistparams(distname, None)
- if len(descript) != 1:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1024,7 +1026,7 @@ if __name__ == "__main__":
- 2.0 * (1.0 - mean * stdev * skew - variance) / variance,
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%d.0): expected %s; found %s" % \
- (distname, distparms[0], str(expectedstats), str(foundstats)))
- del degfree, foundstats, mean, variance, stdev, skew, expectedstats
-@@ -1034,25 +1036,25 @@ if __name__ == "__main__":
- distparms.append(1.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.4, atol=0.4):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Chi-squared distribution
- distname = "chi2"
- descript = getdistparams(distname, None)
- if len(descript) != 1:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1068,7 +1070,7 @@ if __name__ == "__main__":
- 12.0 / degfree,
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%s): expected %s; found %s" % \
- (distname, distparms[0], str(expectedstats), str(foundstats)))
- del degfreestr, foundstats, expectedstats
-@@ -1077,25 +1079,25 @@ if __name__ == "__main__":
- distparms = [ degfree, 0.0, 1.0 ]
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.4, atol=0.4):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del degfree, distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Exponential distribution
- distname = "expon"
- descript = getdistparams(distname, None)
- if len(descript) != 1:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1106,7 +1108,7 @@ if __name__ == "__main__":
- foundstats = distf.stats("mvsk")
- expectedstats = ( 1.0 / lambdaflt, 1.0 / lambdaflt**2, 2.0, 6.0 )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f): expected %s; found %s" % \
- (distname, distparms[0], str(expectedstats), str(foundstats)))
- del lambdaflt, foundstats, expectedstats
-@@ -1115,25 +1117,25 @@ if __name__ == "__main__":
- distparms.append(0.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Exponentiated Weibull distribution
- distname = "exponweib"
- descript = getdistparams(distname, None)
- if len(descript) != 3:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 3; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1149,7 +1151,7 @@ if __name__ == "__main__":
- foundcdfs = distf.cdf(xvals)
- expectedcdfs = numpy.power(1.0 - numpy.exp(-1.0 * numpy.power(xvals / lambdaflt, k)), alpha)
- if not numpy.allclose(foundcdfs, expectedcdfs):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("cdfs(0.0:10.1:0.5) of %s(%#.1f,%#.1f%#.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], distparms[2], str(expectedcdfs), str(foundcdfs)))
- del k, lambdaflt, alpha, xvals, foundcdfs, expectedcdfs
-@@ -1158,25 +1160,25 @@ if __name__ == "__main__":
- distparms.append(0.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # F distribution
- distname = "f"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1198,7 +1200,7 @@ if __name__ == "__main__":
- )
- if not numpy.allclose(foundstats, expectedstats):
- # raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- # since skew and kurtosis is not coming out as expected, check some pdf values
-@@ -1210,7 +1212,7 @@ if __name__ == "__main__":
- expectedpdfs = factor * numpy.power(xvals, 0.5 * dofn - 1.0) / \
- numpy.power(dofd + dofn * xvals, 0.5 * (dofn + dofd))
- if not numpy.allclose(foundpdfs, expectedpdfs):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("pdfs(0.5:10.1:0.5) of %s(%#.1f,%#.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedpdfs), str(foundpdfs)))
- del dofn, dofd, foundstats, expectedstats, xvals, foundpdfs, factor, expectedpdfs
-@@ -1220,25 +1222,25 @@ if __name__ == "__main__":
- distparms.append(1.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.2, atol=0.4):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Gamma distribution
- distname = "gamma"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1250,7 +1252,7 @@ if __name__ == "__main__":
- foundstats = distf.stats("mvsk")
- expectedstats = ( alpha * theta, alpha * theta**2, 2.0 / math.sqrt(alpha), 6.0 / alpha )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del alpha, theta, foundstats, expectedstats
-@@ -1259,24 +1261,24 @@ if __name__ == "__main__":
- distparms.append(0.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- sample = distf.rvs(25000)
- fitparms = getfitparams(sample, distname, distparms)
- if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("fitparams of %s: expected %s; found %s" % \
- (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms, sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Geometric distribution
- distname = "geom"
- descript = getdistparams(distname, None)
- if len(descript) != 1:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1291,26 +1293,26 @@ if __name__ == "__main__":
- 6.0 + prob**2 / (1.0 - prob),
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f): expected %s; found %s" % \
- (distname, distparms[0], str(expectedstats), str(foundstats)))
- del prob, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # no geom.fit function
- del distparms, distf, newparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Hypergeometric distribution
- distname = "hypergeom"
- descript = getdistparams(distname, None)
- if len(descript) != 3:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 3; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1335,26 +1337,26 @@ if __name__ == "__main__":
- # 3.0 * numdrawn * (numtotal - numdrawn) * (numtotal + 6.0) / numtotal**2 - 6.0),
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], distparms[2], str(expectedstats), str(foundstats)))
- del numtotal, numgood, numdrawn, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # no hypergeom.fit function
- del distparms, distf, newparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Inverse-Gamma distribution
- distname = "invgamma"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1370,7 +1372,7 @@ if __name__ == "__main__":
- (30.0 * alpha - 66.0)/ ((alpha - 3.0) * (alpha - 4.0)),
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del alpha, beta, foundstats, expectedstats
-@@ -1379,25 +1381,25 @@ if __name__ == "__main__":
- distparms.append(0.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.2, atol=0.4):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Laplace distribution
- distname = "laplace"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1409,31 +1411,31 @@ if __name__ == "__main__":
- foundstats = distf.stats("mvsk")
- expectedstats = ( mu, 2.0 * b**2, 0.0, 3.0 )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del mu, b, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- sample = distf.rvs(25000)
- fitparms = getfitparams(sample, distname, distparms)
- if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("fitparams of %s: expected %s; found %s" % \
- (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms, sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Log-normal distribution
- distname = "lognorm"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1449,7 +1451,7 @@ if __name__ == "__main__":
- math.exp(4.0 * sigma**2) + 2.0 * math.exp(3.0 * sigma**2) + 3.0 * math.exp(2.0 * sigma**2) - 6,
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del mu, sigma, foundstats, expectedstats
-@@ -1458,25 +1460,25 @@ if __name__ == "__main__":
- distparms.append(0.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-- # print "%s fitparams: %s" % (distname, str(fitparms))
-+ # print ("%s fitparams: %s" % (distname, str(fitparms)))
- # if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- # print "%s: FAIL" % distname
-+ # print ("%s: FAIL" % distname)
- # raise ValueError("fitparams of %s: expected %s; found %s" % \
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Negative-binomial distribution
- distname = "nbinom"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1492,26 +1494,26 @@ if __name__ == "__main__":
- (prob**2 - 6.0 * prob + 6.0) / (numsuccess * (1.0 - prob)),
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del numsuccess, prob, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # no nbinom.fit function
- del distparms, distf, newparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Normal distribution
- distname = "norm"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1523,31 +1525,31 @@ if __name__ == "__main__":
- foundstats = distf.stats("mvsk")
- expectedstats = ( mu, sigma**2, 0.0, 0.0 )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del mu, sigma, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- sample = distf.rvs(25000)
- fitparms = getfitparams(sample, distname, distparms)
- if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("fitparams of %s: expected %s; found %s" % \
- (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms, sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Pareto distribution
- distname = "pareto"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1564,7 +1566,7 @@ if __name__ == "__main__":
- (alpha * (alpha - 3.0) * (alpha - 4.0)),
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del xm, alpha, foundstats, expectedstats
-@@ -1573,7 +1575,7 @@ if __name__ == "__main__":
- distparms.append(0.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-@@ -1584,14 +1586,14 @@ if __name__ == "__main__":
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Poisson distribution
- distname = "poisson"
- descript = getdistparams(distname, None)
- if len(descript) != 1:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1602,26 +1604,26 @@ if __name__ == "__main__":
- foundstats = distf.stats("mvsk")
- expectedstats = ( mu, mu, 1.0 / math.sqrt(mu), 1.0 / mu )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f): expected %s; found %s" % \
- (distname, distparms[0], str(expectedstats), str(foundstats)))
- del mu, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # no poisson.fit function
- del distparms, distf, newparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Random Integer (Discrete Uniform) distribution
- distname = "randint"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1636,7 +1638,7 @@ if __name__ == "__main__":
- # expectedstats = ( 0.5 * (a + b), (n**2 - 1.0) / 12.0, 0.0, -6.0 * (n**2 + 1) / (5.0 * (n**2 - 1)) )
- expectedstats = ( 0.5 * (a + b), (n**2 - 1.0) / 12.0, 0.0, )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- # raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- raise ValueError("(mean, var, skew) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
-@@ -1646,26 +1648,26 @@ if __name__ == "__main__":
- expectedpmfs[n+1] = 0.0
- foundpmfs = distf.pmf(xvals)
- if not numpy.allclose(foundpmfs, expectedpmfs):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("pmfs(%.1f:%.1f:1.0) of %s(%.1f, %.1f): expected %s; found %s" % \
- (a - 1.0, b + 1.1, distname, distparms[0], distparms[1], str(expectedpmfs), str(foundpmfs)))
- del a, b, foundstats, n, expectedstats, xvals, expectedpmfs, foundpmfs
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # no randint.fit function
- del distparms, distf, newparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Student's-t distribution
- distname = "t"
- descript = getdistparams(distname, None)
- if len(descript) != 1:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1676,7 +1678,7 @@ if __name__ == "__main__":
- foundstats = distf.stats("mvsk")
- expectedstats = ( 0.0, degfree / (degfree - 2.0), 0.0, 6.0 / (degfree - 4.0) )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f): expected %s; found %s" % \
- (distname, distparms[0], str(expectedstats), str(foundstats)))
- del degfree, foundstats, expectedstats
-@@ -1686,24 +1688,24 @@ if __name__ == "__main__":
- distparms.append(1.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- sample = distf.rvs(25000)
- fitparms = getfitparams(sample, distname, distparms)
- if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("fitparams of %s: expected %s; found %s" % \
- (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms, sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Uniform distribution
- distname = "uniform"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1715,31 +1717,31 @@ if __name__ == "__main__":
- foundstats = distf.stats("mvsk")
- expectedstats = ( 0.5 * (a + b), (b - a)**2 / 12.0, 0.0, -6.0 / 5.0 )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del a, b, foundstats, expectedstats
-
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- sample = distf.rvs(25000)
- fitparms = getfitparams(sample, distname, distparms)
- if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("fitparams of %s: expected %s; found %s" % \
- (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms, sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # Weibull distribution
- distname = "weibull_min"
- descript = getdistparams(distname, None)
- if len(descript) != 2:
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
- (distname, len(descript)))
- del descript
-@@ -1762,7 +1764,7 @@ if __name__ == "__main__":
- (gam2 - gam1**2)**2,
- )
- if not numpy.allclose(foundstats, expectedstats):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
- (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
- del k, lambdaflt, foundstats, gam1, gam2, gam3, gam4, mu, sigma, expectedstats
-@@ -1771,7 +1773,7 @@ if __name__ == "__main__":
- distparms.append(0.0)
- newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
- if not numpy.allclose(newparms, distparms):
-- print "%s: FAIL" % distname
-+ print ("%s: FAIL" % distname)
- raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
- # sample = distf.rvs(25000)
- # fitparms = getfitparams(sample, distname, distparms)
-@@ -1782,9 +1784,9 @@ if __name__ == "__main__":
- # (distname, str(distparms), str(fitparms)))
- del distparms, distf, newparms # , sample, fitparms
-
-- print "%s: PASS" % distname
-+ print ("%s: PASS" % distname)
-
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_cdf.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_cdf.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_cdf.py
-@@ -2,6 +2,8 @@
- Returns the array of cumulative distribution function values
- for a probability distribution and set of abscissa values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -78,10 +80,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, dimen, 1, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (abscissa, pfname, pfparams), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_chisquare.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_chisquare.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_chisquare.py
-@@ -3,6 +3,8 @@ Performs a chi-square test that a sample
- counts of categorical data comes from a population with the
- given expected counts or relative frequencies of that data.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import scipy.stats
-@@ -109,12 +111,12 @@ if __name__ == "__main__":
- histgr = numpy.array(histgr, dtype=numpy.float64)
- exphist = numpy.ones((nbins,), dtype=numpy.float64) * histgr.mean()
- chival = ((histgr - exphist)**2 / exphist).sum()
-- print "created a sample with chival = %f" % chival
-+ print ("created a sample with chival = %f" % chival)
- prob = scipy.stats.chi2(nbins - 1 - ddof).sf(chival)
- expect = numpy.array([chival, prob, nbins], dtype=numpy.float64)
-- print "sample histogram = \n%s" % str(histgr)
-- print "expect histogram value for all bins = %f" % exphist[0]
-- print "expect result = %s" % str(expect)
-+ print ("sample histogram = \n%s" % str(histgr))
-+ print ("expect histogram value for all bins = %f" % exphist[0])
-+ print ("expect result = %s" % str(expect))
-
- # setup for the call to ferret_compute - one non-singular axis
- inpbdfs = numpy.array([-9999.0, -8888.0, -7777.0], dtype=numpy.float64)
-@@ -128,7 +130,7 @@ if __name__ == "__main__":
- # call ferret_compute and check the result
- ferret_compute(0, result, resbdf, (samhist, pophist, ddofarr), inpbdfs)
- result = result.reshape(-1)
-- print " found result = %s" % str(result)
-+ print (" found result = %s" % str(result))
- if not numpy.allclose(result, expect):
- raise ValueError("Unexpected result")
-
-@@ -145,10 +147,10 @@ if __name__ == "__main__":
- # call ferret_compute and check the result
- ferret_compute(0, result, resbdf, (samhist, pophist, ddofarr), inpbdfs)
- result = result.reshape(-1)
-- print " found result = %s" % str(result)
-+ print (" found result = %s" % str(result))
- if not numpy.allclose(result, expect):
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_fit.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_fit.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_fit.py
-@@ -2,6 +2,8 @@
- Returns parameter values for a specified probability distribution type
- that best describe the distribution of a given array of values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import math
- import numpy
- import pyferret
-@@ -101,5 +103,5 @@ if __name__ == "__main__":
- raise ValueError("Norm fit fail; expected params: %s; found %s" % (str(expected), str(result)))
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_helper.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_helper.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_helper.py
-@@ -2,6 +2,8 @@
- Returns an array of strings describing
- the parameters for a probability distribution.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import pyferret.stats
-@@ -118,7 +120,7 @@ def print_help():
- ferret_compute(0, distrib_array, None, ( pfname, ), None)
- # Print all the distribution short and long names, and the empty line at the end
- for j in xrange(max_strings):
-- print distrib_array[j]
-+ print (distrib_array[j])
- # Now go through all the distributions
- params_array = numpy.empty((max_strings,), \
- dtype=numpy.dtype('S128'), order='F')
-@@ -131,7 +133,7 @@ def print_help():
- pfname = distrib_array[j].split()[1].split('(')[0]
- ferret_compute(0, params_array, None, ( pfname, ), None)
- for k in xrange(max_strings):
-- print params_array[k]
-+ print (params_array[k])
- # Stop after printing an empty line
- if not params_array[k]:
- break;
-Index: pyferret-7.0.0/pyfermod/stats/stats_histogram.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_histogram.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_histogram.py
-@@ -1,6 +1,7 @@
- """
- Returns histogram bin counts for a given array of values.
- """
-+from __future__ import print_function
- import numpy
- import pyferret
-
-@@ -111,5 +112,5 @@ if __name__ == "__main__":
- # verify the results
- if not numpy.allclose(result, expected):
- raise ValueError("Unexpected results; expected:\n%s\nfound:\n%s" % (str(expected), str(result)))
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_isf.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_isf.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_isf.py
-@@ -2,6 +2,8 @@
- Returns the array of inverse survival function values for
- a probability distribution and set of quantile values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -77,10 +79,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, dimen, 1, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (quantile, pfname, pfparams), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_kstest1.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_kstest1.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_kstest1.py
-@@ -2,6 +2,8 @@
- Performs a two-sided Kolmogorov-Smirnov test that the provided
- sample comes from the given probability distribution function.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import pyferret.stats
-@@ -117,7 +119,7 @@ if __name__ == "__main__":
- # call ferret_compute with data from the distribution and check the results
- ferret_compute(0, resultc, resbdf, (sampc, distname, distparams), inpbdfs)
- resultc = resultc.reshape(-1)
-- print "from same dist result: %s" % str(resultc)
-+ print ("from same dist result: %s" % str(resultc))
- if (resultc[0] < 0.00) or (resultc[0] > 0.01) or \
- (resultc[1] < 0.10) or (resultc[1] > 1.00):
- raise ValueError("Unexpected result")
-@@ -125,11 +127,11 @@ if __name__ == "__main__":
- # call ferret_compute with data from a different distribution and check the results
- ferret_compute(0, resultu, resbdf, (sampu, distname, distparams), inpbdfs)
- resultu = resultu.reshape(-1)
-- print "from diff dist result: %s" % str(resultu)
-+ print ("from diff dist result: %s" % str(resultu))
- if (resultu[0] < 0.99) or (resultu[0] > 1.00) or \
- (resultu[1] < 0.00) or (resultu[1] > 0.01):
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_kstest2.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_kstest2.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_kstest2.py
-@@ -2,6 +2,8 @@
- Performs a two-sided Kolmogorov-Smirnov test that two samples
- come from the same continuous probability distribution.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import scipy.stats
-@@ -107,7 +109,7 @@ if __name__ == "__main__":
- # call ferret_compute with the samples from the same distribution and check the results
- ferret_compute(0, resultb, resbdf, (arraya, arrayb), inpbdfs)
- resultb = resultb.reshape(-1)
-- print "from same dist result: %s" % str(resultb)
-+ print ("from same dist result: %s" % str(resultb))
- if (resultb[0] < 0.00) or (resultb[0] > 0.01) or \
- (resultb[1] < 0.10) or (resultb[1] > 1.00):
- raise ValueError("Unexpected result")
-@@ -115,11 +117,11 @@ if __name__ == "__main__":
- # call ferret_compute with data from different distributions and check the results
- ferret_compute(0, resultu, resbdf, (sampa, sampu), inpbdfs)
- resultu = resultu.reshape(-1)
-- print "from diff dist result: %s" % str(resultu)
-+ print ("from diff dist result: %s" % str(resultu))
- if (resultu[0] < 0.98) or (resultu[0] > 1.00) or \
- (resultu[1] < 0.00) or (resultu[1] > 0.01):
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_linregress.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_linregress.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_linregress.py
-@@ -2,6 +2,8 @@
- Returns parameters resulting from a linear regression of one set
- of given data against another set of given data.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import math
- import numpy
- import pyferret
-@@ -149,5 +151,5 @@ if __name__ == "__main__":
- (str(expected), str(result)))
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_norm_pdf.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_norm_pdf.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_norm_pdf.py
-@@ -4,6 +4,8 @@ for the Normal probability distribution
- using the given arrays for the abscissa or template
- values and each of the parameters values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import pyferret.stats
-@@ -70,10 +72,10 @@ if __name__ == "__main__":
- result = -5555.0 * numpy.ones((xdim, ydim, zdim, tdim, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (yzvals, mus, sigmas), inpbdfs)
- if not numpy.allclose(result, pdfs):
-- print "Expect (flattened) =\n%s" % str(pdfs.reshape(-1))
-- print "Result (flattened) =\n%s" % str(result.reshape(-1))
-+ print ("Expect (flattened) =\n%s" % str(pdfs.reshape(-1)))
-+ print ("Result (flattened) =\n%s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_pdf.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_pdf.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_pdf.py
-@@ -2,6 +2,8 @@
- Returns the array of probability density function values for a
- continuous probability distribution and set of abscissa values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -78,10 +80,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, dimen, 1, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (abscissa, pfname, pfparams), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_pearsonr.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_pearsonr.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_pearsonr.py
-@@ -2,6 +2,8 @@
- Returns the Pearson product-moment correlation
- coefficient between two samples of data.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import math
- import numpy
- import pyferret
-@@ -141,5 +143,5 @@ if __name__ == "__main__":
- (str(expectu.reshape(-1)), str(resultu.reshape(-1))))
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_percentilesofscores.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_percentilesofscores.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_percentilesofscores.py
-@@ -1,6 +1,8 @@
- """
- Returns interpolated percentiles through a sample of scores (values)
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import scipy.stats
-@@ -93,10 +95,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, 1, zdim, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (sample, scores), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_pmf.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_pmf.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_pmf.py
-@@ -2,6 +2,8 @@
- Returns the array of probability density function values for a
- discrete probability distribution and set of abscissa values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -77,10 +79,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, dimen, 1, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (abscissa, pfname, pfparams), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_ppf.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_ppf.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_ppf.py
-@@ -2,6 +2,8 @@
- Returns the array of percent point function values for
- a probability distribution and set of quantile values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -77,10 +79,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, dimen, 1, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (quantile, pfname, pfparams), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_probplotvals.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_probplotvals.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_probplotvals.py
-@@ -13,6 +13,8 @@ distribution. Thus, the slope, intercep
- (r) of this fitted line are returned and the first three X elements
- of the third Y axis value.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -148,15 +150,15 @@ if __name__ == "__main__":
- ferret_compute(0, result, resbdf, (inputarr, pfname, pfparams), inpbdfs)
- if not numpy.allclose(result, expected):
- if not numpy.allclose(result[:,0,0,0,0,0], expected[:,0,0,0,0,0]):
-- print "Expected[:,0,0,0,0,0] =\n%s" % str(expected[:,0,0,0,0,0])
-- print "Result[:,0,0,0,0,0] =\n%s" % str(result[:,0,0,0,0,0])
-+ print ("Expected[:,0,0,0,0,0] =\n%s" % str(expected[:,0,0,0,0,0]))
-+ print ("Result[:,0,0,0,0,0] =\n%s" % str(result[:,0,0,0,0,0]))
- if not numpy.allclose(result[:,1,0,0,0,0], expected[:,1,0,0,0,0]):
-- print "Expected[:,1,0,0,0,0] =\n%s" % str(expected[:,1,0,0,0,0])
-- print "Result[:,1,0,0,0,0] =\n%s" % str(result[:,1,0,0,0,0])
-+ print ("Expected[:,1,0,0,0,0] =\n%s" % str(expected[:,1,0,0,0,0]))
-+ print ("Result[:,1,0,0,0,0] =\n%s" % str(result[:,1,0,0,0,0]))
- if not numpy.allclose(result[:3,2,0,0,0,0], expected[:3,2,0,0,0,0]):
-- print "Expected[:3,2,0,0,0,0] =\n%s" % str(expected[:3,2,0,0,0,0])
-- print "Result[:3,2,0,0,0,0] =\n%s" % str(result[:3,2,0,0,0,0])
-+ print ("Expected[:3,2,0,0,0,0] =\n%s" % str(expected[:3,2,0,0,0,0]))
-+ print ("Result[:3,2,0,0,0,0] =\n%s" % str(result[:3,2,0,0,0,0]))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-Index: pyferret-7.0.0/pyfermod/stats/stats_rvs.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_rvs.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_rvs.py
-@@ -2,6 +2,8 @@
- Returns the array of random variates for a probability distribution
- assigned to positions corresponding to defined values in an input array.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -96,5 +98,5 @@ if __name__ == "__main__":
- raise ValueError("Standard deviation of random sample: expected: 0.5; found: %f" % stdev)
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_scoresatpercentiles.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_scoresatpercentiles.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_scoresatpercentiles.py
-@@ -1,6 +1,8 @@
- """
- Returns interpolated scores (values) at percentiles through a sample
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import scipy.stats
-@@ -92,10 +94,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, 1, zdim, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (sample, prcnts), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_sf.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_sf.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_sf.py
-@@ -2,6 +2,8 @@
- Returns the array of survival function values for a
- probability distribution and set of abscissa values.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import scipy.stats
- import pyferret
-@@ -77,10 +79,10 @@ if __name__ == "__main__":
- result = -888.0 * numpy.ones((1, dimen, 1, 1, 1, 1), dtype=numpy.float64, order='F')
- ferret_compute(0, result, resbdf, (abscissa, pfname, pfparams), inpbdfs)
- if not numpy.allclose(result, expected):
-- print "Expected (flattened) = %s" % str(expected.reshape(-1))
-- print "Result (flattened) = %s" % str(result.reshape(-1))
-+ print ("Expected (flattened) = %s" % str(expected.reshape(-1)))
-+ print ("Result (flattened) = %s" % str(result.reshape(-1)))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_spearmanr.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_spearmanr.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_spearmanr.py
-@@ -1,6 +1,8 @@
- """
- Returns Spearman's rank correlation coefficient between two samples of data.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import math
- import numpy
- import pyferret
-@@ -139,5 +141,5 @@ if __name__ == "__main__":
- (str(expectu.reshape(-1)), str(resultu.reshape(-1))))
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_stats.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_stats.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_stats.py
-@@ -2,6 +2,8 @@
- Returns the (unweighted) mean, variance, skew, and kurtoses
- of an array of values
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import math
- import numpy
- import pyferret
-@@ -102,5 +104,5 @@ if __name__ == "__main__":
- (str(expected), str(result)))
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_ttest1.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_ttest1.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_ttest1.py
-@@ -2,6 +2,8 @@
- Performs a two-sided T-test that the provided sample
- comes from a population with the given mean(s).
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import scipy.stats
-@@ -131,10 +133,10 @@ if __name__ == "__main__":
- # call ferret_compute and check the results
- ferret_compute(0, result, resbdf, (samparr, meanarr), inpbdfs)
- if not numpy.allclose(result, expect):
-- print "expect[:,:,0,0,0,0]:\n %s" % str(expect[:, :, 0, 0, 0, 0])
-- print "result[:,:,0,0,0,0]:\n %s" % str(result[:, :, 0, 0, 0, 0])
-+ print ("expect[:,:,0,0,0,0]:\n %s" % str(expect[:, :, 0, 0, 0, 0]))
-+ print ("result[:,:,0,0,0,0]:\n %s" % str(result[:, :, 0, 0, 0, 0]))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_ttest2ind.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_ttest2ind.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_ttest2ind.py
-@@ -2,6 +2,8 @@
- Performs a two-sided T-test that two independent samples
- come from (normal) distributions with the same mean.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import scipy.stats
-@@ -111,7 +113,7 @@ if __name__ == "__main__":
- # call ferret_compute with the samples from distribs with the same mean and check
- ferret_compute(0, resultb, resbdf, (arraya, arrayb), inpbdfs)
- resultb = resultb.reshape(-1)
-- print "result from same mean: %s" % str(resultb)
-+ print ("result from same mean: %s" % str(resultb))
- if (abs(resultb[0]) > 2.0) or \
- (resultb[1] < 0.1) or (resultb[1] > 1.0):
- raise ValueError("Unexpected result")
-@@ -119,11 +121,11 @@ if __name__ == "__main__":
- # call ferret_compute with the samples from distribs with different means and check
- ferret_compute(0, resultu, resbdf, (arraya, arrayu), inpbdfs)
- resultu = resultu.reshape(-1)
-- print "result from diff mean: %s" % str(resultu)
-+ print ("result from diff mean: %s" % str(resultu))
- if (resultu[0] > -20.0) or \
- (resultu[1] < 0.0) or (resultu[1] > 1.0E-5):
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_ttest2rel.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_ttest2rel.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_ttest2rel.py
-@@ -2,6 +2,8 @@
- Performs a two-sided T-test that two related (paired) samples
- come from (normal) distributions with the same mean.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import numpy
- import pyferret
- import scipy.stats
-@@ -118,7 +120,7 @@ if __name__ == "__main__":
- # call ferret_compute with the samples with the same mean and check
- ferret_compute(0, resultb, resbdf, (arraya, arrayb), inpbdfs)
- resultb = resultb.reshape(-1)
-- print "result from same mean:\n %s" % str(resultb)
-+ print ("result from same mean:\n %s" % str(resultb))
- if (abs(resultb[0]) > 2.0) or \
- (resultb[1] < 0.1) or (resultb[1] > 1.0) or \
- (abs(resultb[2] - numgood) > 1.0E-5):
-@@ -127,12 +129,12 @@ if __name__ == "__main__":
- # call ferret_compute with samples with different means and check
- ferret_compute(0, resultu, resbdf, (arraya, arrayu), inpbdfs)
- resultu = resultu.reshape(-1)
-- print "result from diff mean:\n %s" % str(resultu)
-+ print ("result from diff mean:\n %s" % str(resultu))
- if (resultu[0] > -2000.0) or \
- (resultu[1] < 0.00) or (resultu[1] > 0.0001) or \
- (abs(resultb[2] - numgood) > 1.0E-5):
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/stats/stats_zscore.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/stats/stats_zscore.py
-+++ pyferret-7.0.0/pyfermod/stats/stats_zscore.py
-@@ -3,6 +3,8 @@ Returns the array of standard scores for
- standard score are for the standard distribution centered of the
- mean value of the data with the same variance as the data.
- """
-+from __future__ import print_function
-+from past.builtins import xrange
- import math
- import numpy
- import pyferret
-@@ -82,10 +84,10 @@ if __name__ == "__main__":
- # call ferret_compute and check the results
- ferret_compute(0, result, resbdf, (input, ), inpbdfs)
- if not numpy.allclose(result, expected, rtol=2.0E-7, atol=2.0E-7):
-- print "expected (flattened) =\n%s" % str(expected.reshape(-1, order='F'))
-- print "result (flattened) =\n%s" % str(result.reshape(-1, order='F'))
-+ print ("expected (flattened) =\n%s" % str(expected.reshape(-1, order='F')))
-+ print ("result (flattened) =\n%s" % str(result.reshape(-1, order='F')))
- raise ValueError("Unexpected result")
-
- # All successful
-- print "Success"
-+ print ("Success")
-
-Index: pyferret-7.0.0/pyfermod/libpyferret.c
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/libpyferret.c
-+++ pyferret-7.0.0/pyfermod/libpyferret.c
-@@ -42,6 +42,13 @@
- #include <stdlib.h>
- #include <string.h>
-
-+#if PY_MAJOR_VERSION >= 3
-+#define PyInt_AsLong(x) PyLong_AsLong(x)
-+#define PyString_AsString(x) PyUnicode_AsUTF8(x)
-+#define PyString_FromString(x) PyUnicode_FromString(x)
-+#define PyString_FromStringAndSize(x,y) PyUnicode_FromStringAndSize(x,y)
-+#endif
-+
- #include "ferret.h"
- #include "ferret_shared_buffer.h"
- #include "EF_Util.h"
-@@ -49,6 +56,35 @@
- #include "pyferret.h"
- #include "pplmem.h"
-
-+struct pyferret_module {
-+ /* Flag of this Ferret's start/stop state */
-+ int initialized;
-+ /*
-+ * for memory management in this module
-+ * double *, instead of DFTYPE *, is used for ferMemory
-+ * to create a warning if DFTYPE is not double.
-+ */
-+ size_t ferMemSize;
-+ double *ferMemory;
-+ float *pplMemory;
-+ /* TODO: Merge errors to use this */
-+ PyObject *error;
-+};
-+
-+/* In Python3, we shouldn't have a global variable for module state; all the state should be via
-+ * a struct (pyferret_module)
-+ * In practice we still have a hacky need due to reallo_ppl_memory() so we have pyf_module below
-+ */
-+#if PY_MAJOR_VERSION >= 3
-+#define MODULE_STATE(m) ((struct pyferret_module*)PyModule_GetState(m))
-+#else
-+#define MODULE_STATE(m) (&_state)
-+static struct pyferret_module _state;
-+#endif
-+
-+/* Hack. See if we can remove this static later */
-+static struct pyferret_module *pyf_module = NULL;
-+
- /* global pyferret Python module object used for readline */
- PyObject *pyferret_module_pyobject = NULL;
-
-@@ -67,17 +103,9 @@ PyObject *pyferret_graphbind_module_pyob
- /* Length given to the abstract axis */
- #define ABSTRACT_AXIS_LEN 9999999
-
--/* Flag of this Ferret's start/stop state */
--static int ferretInitialized = 0;
-
--/*
-- * for memory management in this module
-- * double *, instead of DFTYPE *, is used for ferMemory
-- * to create a warning if DFTYPE is not double.
-- */
--static size_t ferMemSize;
--static double *ferMemory = NULL;
--static float *pplMemory = NULL;
-+
-+
-
- /* for recovering from seg faults */
- static void (*segv_handler)(int);
-@@ -166,9 +194,11 @@ static PyObject *pyferretStart(PyObject
- int ttoutLun = TTOUT_LUN;
- int one_cmnd_mode_int;
- PyObject *modulename;
--
-+ struct pyferret_module *module;
-+
-+ module = MODULE_STATE(self);
- /* If already initialized, return False */
-- if ( ferretInitialized ) {
-+ if ( module->initialized ) {
- Py_INCREF(Py_False);
- return Py_False;
- }
-@@ -223,23 +253,23 @@ static PyObject *pyferretStart(PyObject
-
- /* Initial allocation of PPLUS memory */
- pplMemSize = 0.5 * 1.0E6;
-- pplMemory = (float *) PyMem_Malloc((size_t)pplMemSize * (size_t)sizeof(float));
-- if ( pplMemory == NULL )
-+ module->pplMemory = (float *) PyMem_Malloc((size_t)pplMemSize * (size_t)sizeof(float));
-+ if ( module->pplMemory == NULL )
- return PyErr_NoMemory();
-- set_ppl_memory(pplMemory, pplMemSize);
-+ set_ppl_memory(module->pplMemory, pplMemSize);
-
- /* Initial allocation of Ferret memory - multiples of 100 PMAX_MEM_BLKS */
- blksiz = (size_t) ((mwMemSize * 1.0E6 + (double)PMAX_MEM_BLKS - 1.0) / (double)PMAX_MEM_BLKS);
- blksiz = (blksiz + 99) / 100;
- blksiz *= 100;
-- ferMemSize = blksiz * (size_t)PMAX_MEM_BLKS;
-+ module->ferMemSize = blksiz * (size_t)PMAX_MEM_BLKS;
- /* Check for overflow */
-- if ( blksiz != ferMemSize / (size_t)PMAX_MEM_BLKS )
-+ if ( blksiz != module->ferMemSize / (size_t)PMAX_MEM_BLKS )
- return PyErr_NoMemory();
-- ferMemory = (double *) PyMem_Malloc(ferMemSize * (size_t)sizeof(double));
-- if ( ferMemory == NULL )
-+ module->ferMemory = (double *) PyMem_Malloc( module->ferMemSize * (size_t)sizeof(double));
-+ if ( module->ferMemory == NULL )
- return PyErr_NoMemory();
-- set_fer_memory(ferMemory, ferMemSize);
-+ set_fer_memory(module->ferMemory, module->ferMemSize);
-
- if ( (metaname != NULL) || (unmappedFlag != 0) ) {
- /*
-@@ -310,7 +340,10 @@ static PyObject *pyferretStart(PyObject
- set_one_cmnd_mode_(&one_cmnd_mode_int);
-
- /* Success - return True */
-- ferretInitialized = 1;
-+ module->initialized = 1;
-+
-+ pyf_module = module;
-+
- Py_INCREF(Py_True);
- return Py_True;
- }
-@@ -322,7 +355,7 @@ static PyObject *pyferretStart(PyObject
- * blksiz * PMAX_MEM_BLKS (defined in ferret.h as 2000)
- * Returns: zero if fails, non-zero if successful
- */
--static int resizeFerretMemory(int blksiz)
-+static int resizeFerretMemory(struct pyferret_module *module, int blksiz)
- {
- size_t actual_blksiz;
- size_t newFerMemSize;
-@@ -341,20 +374,20 @@ static int resizeFerretMemory(int blksiz
- * realloc since the contents of the old memory isn't needed.
- * This could also result in a better garbage collection.
- */
-- PyMem_Free(ferMemory);
-- ferMemory = (double *) PyMem_Malloc(newFerMemSize * (size_t)sizeof(double));
-- if ( ferMemory == NULL ) {
-- ferMemory = (double *) PyMem_Malloc(ferMemSize * (size_t)sizeof(double));
-- if ( ferMemory == NULL ) {
-- fprintf(stderr, "**ERROR: Unable to restore Ferret's memory cache of %f Mdoubles\n", (double)ferMemSize / 1.0E6);
-+ PyMem_Free(module->ferMemory);
-+ module->ferMemory = (double *) PyMem_Malloc(newFerMemSize * (size_t)sizeof(double));
-+ if ( module->ferMemory == NULL ) {
-+ module->ferMemory = (double *) PyMem_Malloc(module->ferMemSize * (size_t)sizeof(double));
-+ if ( module->ferMemory == NULL ) {
-+ fprintf(stderr, "**ERROR: Unable to restore Ferret's memory cache of %f Mdoubles\n", (double)module->ferMemSize / 1.0E6);
- exit(1);
- }
- return 0;
- }
-
- /* Reallocation successful; assign the new memory */
-- ferMemSize = newFerMemSize;
-- set_fer_memory(ferMemory, ferMemSize);
-+ module->ferMemSize = newFerMemSize;
-+ set_fer_memory(module->ferMemory, module->ferMemSize);
- return 1;
- }
-
-@@ -364,14 +397,20 @@ static int resizeFerretMemory(int blksiz
- */
- void reallo_ppl_memory(int new_size)
- {
-- if ( pplMemory != NULL )
-- PyMem_Free(pplMemory);
-- pplMemory = (float *) PyMem_Malloc((size_t)new_size * sizeof(float));
-- if ( pplMemory == NULL ) {
-+
-+ /* Horrible hack. Need to keep a global state var in libpyferret for reallo_ppl_memory
-+ * to be free of tracking PyFerret module state
-+ */
-+ struct pyferret_module *module = pyf_module;
-+
-+ if ( module->pplMemory != NULL )
-+ PyMem_Free(module->pplMemory);
-+ module->pplMemory = (float *) PyMem_Malloc((size_t)new_size * sizeof(float));
-+ if ( module->pplMemory == NULL ) {
- printf("Unable to allocate the requested %d words of PLOT memory.\n", new_size);
- exit(1);
- }
-- set_ppl_memory(pplMemory, new_size);
-+ set_ppl_memory(module->pplMemory, new_size);
- }
-
-
-@@ -397,8 +436,9 @@ static PyObject *pyferretResizeMemory(Py
- static char *argNames[] = {"memsize", NULL};
- double mwMemSize;
-
-+ struct pyferret_module *module = MODULE_STATE(self);
- /* If not initialized, raise a MemoryError */
-- if ( ! ferretInitialized ) {
-+ if ( ! module->initialized ) {
- PyErr_SetString(PyExc_MemoryError, "Ferret not started");
- return NULL;
- }
-@@ -408,7 +448,7 @@ static PyObject *pyferretResizeMemory(Py
- return NULL;
-
- /* Reallocate the new amount of memory for Ferret */
-- if ( resizeFerretMemory((int) ((mwMemSize * 1.0E6 + (double)PMAX_MEM_BLKS - 1.0) / (double)PMAX_MEM_BLKS)) == 0 ) {
-+ if ( resizeFerretMemory(module, (int) ((mwMemSize * 1.0E6 + (double)PMAX_MEM_BLKS - 1.0) / (double)PMAX_MEM_BLKS)) == 0 ) {
- Py_INCREF(Py_False);
- return Py_False;
- }
-@@ -453,9 +493,11 @@ static PyObject *pyferretRunCommand(PyOb
- int cmnd_stack_level;
- char errmsg[2112];
- int errval;
--
-+ struct pyferret_module *module;
-+
-+ module = MODULE_STATE(self);
- /* If not initialized, raise a MemoryError */
-- if ( ! ferretInitialized ) {
-+ if ( ! module->initialized ) {
- PyErr_SetString(PyExc_MemoryError, "Ferret not started");
- return NULL;
- }
-@@ -486,15 +528,15 @@ static PyObject *pyferretRunCommand(PyOb
- do {
- cmnd_stack_level = 0;
- /* Run the Ferret command */
-- ferret_dispatch_c(ferMemory, iter_command, sBuffer);
-+ ferret_dispatch_c(module->ferMemory, iter_command, sBuffer);
-
- if ( sBuffer->flags[FRTN_ACTION] == FACTN_MEM_RECONFIGURE ) {
- /* resize, then re-enter if not single-command mode */
-- if ( resizeFerretMemory(sBuffer->flags[FRTN_IDATA1]) == 0 ) {
-+ if ( resizeFerretMemory(module, sBuffer->flags[FRTN_IDATA1]) == 0 ) {
- printf("Unable to resize Ferret's memory cache to %f Mdoubles\n",
- (double)(sBuffer->flags[FRTN_IDATA1]) * (double)PMAX_MEM_BLKS / 1.0E6);
- printf("Ferret's memory cache remains at %f Mdoubles\n",
-- (double)(ferMemSize) / 1.0E6);
-+ (double)(module->ferMemSize) / 1.0E6);
- }
- cmnd_stack_level = sBuffer->flags[FRTN_IDATA2];
- }
-@@ -596,9 +638,12 @@ static PyObject *pyferretGetData(PyObjec
- char axis_units[MAX_FERRET_NDIM][64];
- char axis_names[MAX_FERRET_NDIM][64];
- CALTYPE calendar_type;
-+ struct pyferret_module *module;
-
-+ module = MODULE_STATE(self);
-+
- /* If not initialized, raise a MemoryError */
-- if ( ! ferretInitialized ) {
-+ if ( ! module->initialized ) {
- PyErr_SetString(PyExc_MemoryError, "Ferret not started");
- return NULL;
- }
-@@ -619,7 +664,7 @@ static PyObject *pyferretGetData(PyObjec
- * Retrieve the memory parameters describing the data array requested.
- * Assumes Unix standard for passing strings to Fortran (appended array lengths).
- */
-- get_data_array_params_(dataname, &lendataname, ferMemory, &arraystart, memlo, memhi,
-+ get_data_array_params_(dataname, &lendataname, module->ferMemory, &arraystart, memlo, memhi,
- steplo, stephi, incr, dataunit, &lendataunit, axis_types,
- &badval, errmsg, &lenerrmsg, 1024, 64, 2112);
- if ( lenerrmsg > 0 ) {
-@@ -658,7 +703,7 @@ static PyObject *pyferretGetData(PyObjec
- * Assign the data in the new ndarray.
- * Note: if MAX_FERRET_NDIM changes, this needs editing.
- */
-- ferdata = ferMemory + arraystart;
-+ ferdata = module->ferMemory + arraystart;
- npydata = (double *)PyArray_DATA(data_ndarray);
- q = 0;
- for (n = 0; n < (int)(shape[5]); n++) {
-@@ -891,7 +936,7 @@ static PyObject *pyferretPutData(PyObjec
- int len_errmsg;
-
- /* If not initialized, raise a MemoryError */
-- if ( ! ferretInitialized ) {
-+ if ( ! MODULE_STATE(self)->initialized ) {
- PyErr_SetString(PyExc_MemoryError, "Ferret not started");
- return NULL;
- }
-@@ -1194,9 +1239,10 @@ static PyObject *pyferretGetStrData(PyOb
- char axis_units[MAX_FERRET_NDIM][64];
- char axis_names[MAX_FERRET_NDIM][64];
- CALTYPE calendar_type;
--
-+ struct pyferret_module *module = MODULE_STATE(self);
-+
- /* If not initialized, raise a MemoryError */
-- if ( ! ferretInitialized ) {
-+ if ( ! module->initialized ) {
- PyErr_SetString(PyExc_MemoryError, "Ferret not started");
- return NULL;
- }
-@@ -1217,7 +1263,7 @@ static PyObject *pyferretGetStrData(PyOb
- * Retrieve the memory parameters describing the data array requested.
- * Assumes Unix standard for passing strings to Fortran (appended array lengths).
- */
-- get_str_data_array_params_(dataname, &lendataname, ferMemory, &arraystart,
-+ get_str_data_array_params_(dataname, &lendataname, module->ferMemory, &arraystart,
- memlo, memhi, steplo, stephi, incr, axis_types,
- errmsg, &lenerrmsg, 1024, 64, 2112);
- if ( lenerrmsg > 0 ) {
-@@ -1250,7 +1296,7 @@ static PyObject *pyferretGetStrData(PyOb
- */
-
- /* Get the maximum string length of all the strings in this array */
-- ferdata = (void **) (ferMemory + arraystart);
-+ ferdata = (void **) (module->ferMemory + arraystart);
- /* Use STRING_MISSING_VALUE for missing strings */
- maxstrlen = (int)(strlen(STRING_MISSING_VALUE) + 1);
- for (n = 0; n < (int)(shape[5]); n++) {
-@@ -1485,14 +1531,16 @@ static char pyferretStopDocstring[] =
-
- static PyObject *pyferretStop(PyObject *self)
- {
-+ struct pyferret_module *module = MODULE_STATE(self);
- /* If not initialized, return False */
-- if ( ! ferretInitialized ) {
-+ if ( ! module->initialized ) {
- Py_INCREF(Py_False);
- return Py_False;
- }
-
- /* Set to uninitialized */
-- ferretInitialized = 0;
-+ module->initialized = 0;
-+ pyf_module = NULL;
-
- /* Release the references to the pyferret and pyferret.graphbind modules */
- Py_DECREF(pyferret_graphbind_module_pyobject);
-@@ -1501,24 +1549,24 @@ static PyObject *pyferretStop(PyObject *
- pyferret_module_pyobject = NULL;
-
- /* Run commands to clear/reset Ferret's state */
-- ferret_dispatch_c(ferMemory, "SET GRID ABSTRACT", sBuffer);
-- ferret_dispatch_c(ferMemory, "CANCEL WINDOW /ALL", sBuffer);
-- ferret_dispatch_c(ferMemory, "CANCEL VARIABLE /ALL", sBuffer);
-- ferret_dispatch_c(ferMemory, "CANCEL SYMBOL /ALL", sBuffer);
-- ferret_dispatch_c(ferMemory, "CANCEL DATA /ALL", sBuffer);
-- ferret_dispatch_c(ferMemory, "CANCEL REGION /ALL", sBuffer);
-- ferret_dispatch_c(ferMemory, "CANCEL MEMORY /ALL", sBuffer);
-- ferret_dispatch_c(ferMemory, "EXIT /PROGRAM", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "SET GRID ABSTRACT", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "CANCEL WINDOW /ALL", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "CANCEL VARIABLE /ALL", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "CANCEL SYMBOL /ALL", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "CANCEL DATA /ALL", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "CANCEL REGION /ALL", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "CANCEL MEMORY /ALL", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "EXIT /PROGRAM", sBuffer);
-
- /* Free memory allocated inside Ferret */
- finalize_();
-
- /* Free memory allocated for Ferret */
-- PyMem_Free(ferMemory);
-- ferMemory = NULL;
-- ferMemSize = 0;
-- PyMem_Free(pplMemory);
-- pplMemory = NULL;
-+ PyMem_Free(module->ferMemory);
-+ module->ferMemory = NULL;
-+ module->ferMemSize = 0;
-+ PyMem_Free(module->pplMemory);
-+ module->pplMemory = NULL;
-
- /* Return True */
- Py_INCREF(Py_True);
-@@ -1542,14 +1590,15 @@ static char pyferretQuitDocstring[] =
-
- static PyObject *pyferretQuit(PyObject *self)
- {
-+ struct pyferret_module *module = MODULE_STATE(self);
- /* If not initialized, nothing to do; just return None */
-- if ( ! ferretInitialized ) {
-+ if ( ! module->initialized ) {
- Py_INCREF(Py_None);
- return Py_None;
- }
-
- /* Set to uninitialized */
-- ferretInitialized = 0;
-+ module->initialized = 0;
-
- /* Release the references to the pyferret and pyferret.graphbind modules */
- Py_DECREF(pyferret_graphbind_module_pyobject);
-@@ -1558,17 +1607,17 @@ static PyObject *pyferretQuit(PyObject *
- pyferret_module_pyobject = NULL;
-
- /* Let Ferret do its orderly shutdown - including closing viewers */
-- ferret_dispatch_c(ferMemory, "EXIT /PROGRAM", sBuffer);
-+ ferret_dispatch_c(module->ferMemory, "EXIT /PROGRAM", sBuffer);
-
- /* Free memory allocated inside Ferret */
- finalize_();
-
- /* Free memory allocated for Ferret */
-- PyMem_Free(ferMemory);
-- ferMemory = NULL;
-- ferMemSize = 0;
-- PyMem_Free(pplMemory);
-- pplMemory = NULL;
-+ PyMem_Free(module->ferMemory);
-+ module->ferMemory = NULL;
-+ module->ferMemSize = 0;
-+ PyMem_Free(module->pplMemory);
-+ module->pplMemory = NULL;
-
- /* Return None */
- Py_INCREF(Py_None);
-@@ -2134,8 +2183,37 @@ static struct PyMethodDef pyferretMethod
- static char pyferretModuleDocstring[] =
- "An extension module enabling the use of Ferret from Python \n";
-
-+
-+#if PY_MAJOR_VERSION >= 3
-+
-+static int pyferretTraverse(PyObject *m, visitproc visit, void *arg) {
-+ Py_VISIT(MODULE_STATE(m)->error);
-+ return 0;
-+}
-+
-+static int pyferretClear(PyObject *m) {
-+ Py_CLEAR(MODULE_STATE(m)->error);
-+ return 0;
-+}
-+
-+static struct PyModuleDef moduledef = {
-+ PyModuleDef_HEAD_INIT,
-+ "libpyferret",
-+ NULL,
-+ sizeof(struct pyferret_module),
-+ pyferretMethods,
-+ NULL,
-+ pyferretTraverse,
-+ pyferretClear,
-+ NULL
-+};
-+
-+
-+PyMODINIT_FUNC PyInit_libpyferret(void)
-+#else /* !python3 */
- /* For the libpyferret module, this function must be named initlibpyferret */
- PyMODINIT_FUNC initlibpyferret(void)
-+#endif
- {
- char names[64][32];
- int values[64];
-@@ -2143,7 +2221,11 @@ PyMODINIT_FUNC initlibpyferret(void)
- int k;
-
- /* Create the module with the indicated methods */
-+#if PY_MAJOR_VERSION >= 3
-+ PyObject *mod = PyModule_Create(&moduledef);
-+#else
- PyObject *mod = Py_InitModule3("libpyferret", pyferretMethods, pyferretModuleDocstring);
-+#endif
-
- /* Add ferret parameter values */
- get_ferret_params_(names, values, &numvals);
-@@ -2205,5 +2287,10 @@ PyMODINIT_FUNC initlibpyferret(void)
-
- /* Private parameter return value from libpyferret._run indicating the program should shut down */
- PyModule_AddIntConstant(mod, "_FERR_EXIT_PROGRAM", FERR_EXIT_PROGRAM);
-+
-+
-+#if PY_MAJOR_VERSION >= 3
-+ return mod;
-+#endif
- }
-
-Index: pyferret-7.0.0/pyfermod/pyefcn_result_limits.c
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/pyefcn_result_limits.c
-+++ pyferret-7.0.0/pyfermod/pyefcn_result_limits.c
-@@ -39,6 +39,11 @@
- #include "pyferret.h"
- #include "EF_Util.h"
-
-+#if PY_MAJOR_VERSION >=3
-+#define PyInt_AsLong(x) PyLong_AsLong(x)
-+#define PyString_FromString(x) PyUnicode_FromString(x)
-+#endif
-+
- static const char *AXIS_NAMES[MAX_FERRET_NDIM] = { "X", "Y", "Z", "T", "E", "F" };
-
- /*
-Index: pyferret-7.0.0/fer/grdel/window.c
-===================================================================
---- pyferret-7.0.0.orig/fer/grdel/window.c
-+++ pyferret-7.0.0/fer/grdel/window.c
-@@ -24,6 +24,9 @@
- #include "cferbind.h"
- #include "pyferret.h"
-
-+#if PY_MAJOR_VERSION >=3
-+#define PyString_FromString(x) PyUnicode_FromString(x)
-+#endif
-
- #ifdef VERBOSEDEBUG
- #include <stdio.h>
-Index: pyferret-7.0.0/pyfermod/pyefcn_compute.c
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/pyefcn_compute.c
-+++ pyferret-7.0.0/pyfermod/pyefcn_compute.c
-@@ -42,6 +42,12 @@
- #include "pyferret.h"
- #include "EF_Util.h"
-
-+#if PY_MAJOR_VERSION >= 3
-+#define PyString_FromString(x) PyUnicode_FromString(x)
-+#define PyInt_FromLong(x) PyLong_FromLong(x)
-+#define PyInt_AsLong(x) PyLong_AsLong(x)
-+#endif
-+
- /*
- * See pyferret.h for information on this function
- */
-Index: pyferret-7.0.0/pyfermod/pyefcn_init.c
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/pyefcn_init.c
-+++ pyferret-7.0.0/pyfermod/pyefcn_init.c
-@@ -39,6 +39,12 @@
- #include "pyferret.h"
- #include "EF_Util.h"
-
-+#if PY_MAJOR_VERSION >=3
-+#define PyString_FromString(x) PyUnicode_FromString(x)
-+#define PyString_AsString(x) PyUnicode_AsUTF8(x)
-+#define PyInt_AsLong(x) PyLong_AsLong(x)
-+#endif
-+
- static const char *AXIS_NAMES[MAX_FERRET_NDIM] = { "X", "Y", "Z", "T", "E", "F" };
-
- /*
-Index: pyferret-7.0.0/pyfermod/pyefcn_get_error.c
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/pyefcn_get_error.c
-+++ pyferret-7.0.0/pyfermod/pyefcn_get_error.c
-@@ -35,6 +35,10 @@
- #include <Python.h>
- #include "pyferret.h"
-
-+#if PY_MAJOR_VERSION >=3
-+#define PyString_AsString(x) PyUnicode_AsUTF8(x)
-+#endif
-+
- /*
- * See pyferret.h for information on this function
- */
-Index: pyferret-7.0.0/pyfermod/pyefcn_custom_axes.c
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/pyefcn_custom_axes.c
-+++ pyferret-7.0.0/pyfermod/pyefcn_custom_axes.c
-@@ -39,6 +39,11 @@
- #include "pyferret.h"
- #include "EF_Util.h"
-
-+#if PY_MAJOR_VERSION >= 3
-+#define PyString_AsString(x) PyUnicode_AsUTF8(x)
-+#define PyString_FromString(x) PyUnicode_FromString(x)
-+#endif
-+
- static const char *AXIS_NAMES[MAX_FERRET_NDIM] = { "X", "Y", "Z", "T", "E", "F" };
-
- /*
-Index: pyferret-7.0.0/pyfermod/pyferret.h
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/pyferret.h
-+++ pyferret-7.0.0/pyfermod/pyferret.h
-@@ -1,8 +1,6 @@
- #ifndef PYFERRET_H_
- #define PYFERRET_H_
-
--/* Python.h should already have been included */
--
- /* Ferret memory cache */
- extern double *memory;
-
-Index: pyferret-7.0.0/setup.py
-===================================================================
---- pyferret-7.0.0.orig/setup.py
-+++ pyferret-7.0.0/setup.py
-@@ -74,7 +74,11 @@ if buildtype != "intel-mac":
- lib_list.extend(fer_lib_list)
- lib_list.extend(fer_lib_list)
- # Add required system libraries to the list to link in
--lib_list.append("python%i.%i" % sys.version_info[:2])
-+ver = sys.version_info[:2]
-+if ver[0] == 2:
-+ lib_list.append("python%i.%i" % ver)
-+else:
-+ lib_list.append("python%i.%im" %ver)
-
- # Linking in the rest of the system libraries were moved to addn_link_flags
- # in order to make sure the appropriate netcdff, netcdf, hdf5_hl, hdf5, and
-Index: pyferret-7.0.0/fmt/src/tm_ftoc_readline.c
-===================================================================
---- pyferret-7.0.0.orig/fmt/src/tm_ftoc_readline.c
-+++ pyferret-7.0.0/fmt/src/tm_ftoc_readline.c
-@@ -66,6 +66,10 @@
- #include <string.h>
- #include "pyferret.h"
-
-+#if PY_MAJOR_VERSION >=3
-+#define PyString_AsString(x) PyUnicode_AsUTF8(x)
-+#endif
-+
- /* Easier way of handling FORTRAN calls with underscore/no underscore */
- #ifdef NO_ENTRY_NAME_UNDERSCORES
- #define FORTRAN(a) a
-Index: pyferret-7.0.0/pyfermod/datamethods.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/datamethods.py
-+++ pyferret-7.0.0/pyfermod/datamethods.py
-@@ -3,11 +3,16 @@ Methods in pyferret for transferring dat
- and Python.
- """
-
-+from past.builtins import xrange
- import numpy
- import numpy.ma
--import StringIO
-
--import libpyferret
-+try:
-+ from StringIO import StringIO
-+except ImportError:
-+ from io import StringIO
-+
-+from pyferret import libpyferret
-
- # set of units (in uppercase) for checking if a custom axis is actual a longitude axis
- _UC_LONGITUDE_UNITS = frozenset( ("DEG E", "DEG_E", "DEG EAST", "DEG_EAST",
-Index: pyferret-7.0.0/pyfermod/pyefmethods.py
-===================================================================
---- pyferret-7.0.0.orig/pyfermod/pyefmethods.py
-+++ pyferret-7.0.0/pyfermod/pyefmethods.py
-@@ -3,7 +3,7 @@ Methods in pyferret to assist in the wri
- written in Python.
- """
-
--import libpyferret
-+from pyferret import libpyferret
-
- def ferret_pyfunc():
- """
diff --git a/debian/patches/reproducible.patch b/debian/patches/reproducible.patch
index 7b25b77..7be1480 100644
--- a/debian/patches/reproducible.patch
+++ b/debian/patches/reproducible.patch
@@ -3,10 +3,10 @@ Description: Hard-code platform, date for reproducible builds
Last-Updated: 2016-07-07
Forwarded: no
-Index: pyferret-7.0.0/fer/Makefile
+Index: pyferret-7.1.1.beta/fer/Makefile
===================================================================
---- pyferret-7.0.0.orig/fer/Makefile
-+++ pyferret-7.0.0/fer/Makefile
+--- pyferret-7.1.1.beta.orig/fer/Makefile
++++ pyferret-7.1.1.beta/fer/Makefile
@@ -13,8 +13,11 @@ include ../site_specific.mk
#
include ../platform_specific.mk.$(BUILDTYPE)
@@ -21,11 +21,11 @@ Index: pyferret-7.0.0/fer/Makefile
#
# Macros
-Index: pyferret-7.0.0/fer/grdel/window.c
+Index: pyferret-7.1.1.beta/fer/grdel/window.c
===================================================================
---- pyferret-7.0.0.orig/fer/grdel/window.c
-+++ pyferret-7.0.0/fer/grdel/window.c
-@@ -54,6 +54,9 @@ static void openlogfile(void)
+--- pyferret-7.1.1.beta.orig/fer/grdel/window.c
++++ pyferret-7.1.1.beta/fer/grdel/window.c
+@@ -50,6 +50,9 @@ static void openlogfile(void)
}
#endif /* VERBOSEDEBUG */
diff --git a/debian/patches/set-envvars.patch b/debian/patches/set-envvars.patch
index 122574e..8e2d92c 100644
--- a/debian/patches/set-envvars.patch
+++ b/debian/patches/set-envvars.patch
@@ -3,13 +3,13 @@ Description: Ensure pyferret can run without Environmental variables set
Last-Updated: 2015-05-11
Forwarded: no
-Index: pyferret-7.0.0/pyfermod/__init__.py
+Index: pyferret-7.1.1.beta/pyfermod/__init__.py
===================================================================
---- pyferret-7.0.0.orig/pyfermod/__init__.py
-+++ pyferret-7.0.0/pyfermod/__init__.py
-@@ -39,6 +39,21 @@ except ImportError:
- pass
- import readline
+--- pyferret-7.1.1.beta.orig/pyfermod/__init__.py
++++ pyferret-7.1.1.beta/pyfermod/__init__.py
+@@ -32,6 +32,21 @@ and syntax.
+
+ from __future__ import print_function
+# In Debian, an application should be able to start without environmental
+# variables needing to be set. So set them here.
@@ -26,6 +26,6 @@ Index: pyferret-7.0.0/pyfermod/__init__.py
+if os.environ.get('FER_LIBS') is None:
+ os.environ['FER_LIBS'] = '/usr/lib/ferret-vis/efmem:/usr/lib/ferret-vis/external_functions'
+
- import libpyferret
- # also import everything (not starting with an underscore) from libpyferret
- # so constants in that module are seen as part of this module
+ import sys
+ import os
+ import atexit
diff --git a/debian/patches/soname-fix.patch b/debian/patches/soname-fix.patch
index c7c596a..545caab 100644
--- a/debian/patches/soname-fix.patch
+++ b/debian/patches/soname-fix.patch
@@ -5,43 +5,43 @@ Description: Add SONAME to python module, as external modules search for it
Last-Updated: 2016-08-15
Forwarded: not-needed
-Index: pyferret-7.0.0/Makefile
+Index: pyferret-7.1.1.beta/Makefile
===================================================================
---- pyferret-7.0.0.orig/Makefile
-+++ pyferret-7.0.0/Makefile
-@@ -54,7 +54,8 @@ pymod_optimized_build :
- export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
- export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
+--- pyferret-7.1.1.beta.orig/Makefile
++++ pyferret-7.1.1.beta/Makefile
+@@ -69,7 +69,8 @@ pymod_optimized_build :
+ export COMPRESS_LIB=$(COMPRESS_LIB) ; \
export NETCDF4_LIBDIR=$(NETCDF4_LIBDIR) ; \
+ export IS_LINUX_SYSTEM=$(IS_LINUX_SYSTEM) ; \
- $(PYTHON_EXE) setup.py --quiet build )
+ export LDFLAGS="$(LDFLAGS) -Wl,--soname=libpyferret.so" ;\
+ $(PYTHON_EXE) setup.py --verbose build )
## The following installs libpyferret.so and optimized
## versions of all the python scripts into $(DIR_PREFIX)/install.
-@@ -69,7 +70,8 @@ pymod_optimized_install :
- export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
- export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
+@@ -87,7 +88,8 @@ pymod_optimized_install :
+ export COMPRESS_LIB=$(COMPRESS_LIB) ; \
export NETCDF4_LIBDIR=$(NETCDF4_LIBDIR) ; \
+ export IS_LINUX_SYSTEM=$(IS_LINUX_SYSTEM) ; \
- $(PYTHON_EXE) setup.py --quiet install -O2 --prefix=$(DIR_PREFIX)/install )
+ export LDFLAGS="$(LDFLAGS) -Wl,--soname=libpyferret.so" ;\
+ $(PYTHON_EXE) setup.py --verbose install -O2 --prefix=$(DIR_PREFIX)/install )
.PHONY : externals_optimized
externals_optimized :
-@@ -114,7 +116,7 @@ clean :
+@@ -138,7 +140,7 @@ clean :
$(MAKE) -C $(DIR_PREFIX)/bench clean
$(MAKE) -C $(DIR_PREFIX)/bin/build_fonts/unix clean
$(MAKE) -C $(DIR_PREFIX)/external_functions clean
- rm -fr $(DIR_PREFIX)/install $(DIR_PREFIX)/build ferret.jnl*
-+ # rm -fr $(DIR_PREFIX)/install $(DIR_PREFIX)/build ferret.jnl*
- find $(DIR_PREFIX)/pviewmod -name '*.py[co]' -exec rm -f {} ';'
- find $(DIR_PREFIX)/pyfermod -name '*.py[co]' -exec rm -f {} ';'
++ # rm -fr $(DIR_PREFIX)/install $(DIR_PREFIX)/build ferret.jnl*
+ find $(DIR_PREFIX)/pviewmod -name '*.py[co]' -delete
+ find $(DIR_PREFIX)/pyfermod -name '*.py[co]' -delete
$(MAKE) -C $(DIR_PREFIX)/threddsBrowser clean
-@@ -147,7 +149,7 @@ update :
- export PIXMAN_LIBDIR=$(PIXMAN_LIBDIR) ; \
- export HDF5_LIBDIR=$(HDF5_LIBDIR) ; \
+@@ -174,7 +176,7 @@ update :
+ export COMPRESS_LIB=$(COMPRESS_LIB) ; \
export NETCDF4_LIBDIR=$(NETCDF4_LIBDIR) ; \
+ export IS_LINUX_SYSTEM=$(IS_LINUX_SYSTEM) ; \
- $(PYTHON_EXE) setup.py --quiet install -O2 --prefix=$(INSTALL_FER_DIR) )
+ $(PYTHON_EXE) setup.py --verbose install -O2 --prefix=$(INSTALL_FER_DIR) )
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyferret.git
More information about the debian-science-commits
mailing list