diff --git a/geomagio/Util.py b/geomagio/Util.py index e53d25c25cf793037bbe40935e2bb39f404f41b2..05eab9d9f918a938057f8fcd3cc01cbec03a6093 100644 --- a/geomagio/Util.py +++ b/geomagio/Util.py @@ -2,7 +2,7 @@ import pycurl import numpy import os from obspy.core import Stats, Trace -from io import StringIO +from io import BytesIO class ObjectView(object): @@ -161,7 +161,7 @@ def read_url(url, connect_timeout=15, max_redirects=5, timeout=300): except Exception: pass content = None - out = StringIO() + out = BytesIO() curl = pycurl.Curl() try: curl.setopt(pycurl.FOLLOWLOCATION, 1) diff --git a/geomagio/binlog/BinLogWriter.py b/geomagio/binlog/BinLogWriter.py index 7cc0a02db15541e7cb5a46f5a912f64f3961496e..51e3a70c7602b96bf757e59b34c718bb85da1086 100644 --- a/geomagio/binlog/BinLogWriter.py +++ b/geomagio/binlog/BinLogWriter.py @@ -1,7 +1,7 @@ from builtins import range import numpy -from io import StringIO +from io import BytesIO from datetime import datetime from .. import ChannelConverter, TimeseriesUtility from ..TimeseriesFactoryException import TimeseriesFactoryException @@ -196,7 +196,7 @@ class BinLogWriter(object): def format(self, timeseries, channels): """Get a BinLog formatted string. - Calls write() with a StringIO, and returns the output. + Calls write() with a BytesIO, and returns the output. Parameters ---------- @@ -210,7 +210,7 @@ class BinLogWriter(object): unicode BinLog formatted string. """ - out = StringIO() + out = BytesIO() writer = BinLogWriter() writer.write(out, timeseries, channels) return out.getvalue() diff --git a/geomagio/edge/EdgeFactory.py b/geomagio/edge/EdgeFactory.py index 62875bf72dcbcaf4bb6efaf86e646e6decef6006..675a27b8dda4c3ab06b68e1abf77d03af48a7b14 100644 --- a/geomagio/edge/EdgeFactory.py +++ b/geomagio/edge/EdgeFactory.py @@ -11,7 +11,7 @@ Edge is the USGS earthquake hazard centers replacement for earthworm. from __future__ import absolute_import import sys -from io import StringIO +from io import BytesIO import numpy import numpy.ma import obspy.core @@ -141,7 +141,7 @@ class EdgeFactory(TimeseriesFactory): # need this until https://github.com/obspy/obspy/pull/1179 # replace stdout original_stdout = sys.stdout - temp_stdout = StringIO() + temp_stdout = BytesIO() try: sys.stdout = temp_stdout # get the timeseries diff --git a/geomagio/iaga2002/IAGA2002Writer.py b/geomagio/iaga2002/IAGA2002Writer.py index a0b84a151994717d5ecce727392eb26f7bed8b6c..e73611baaaa843180fa6fc514b4b14952133c4a2 100644 --- a/geomagio/iaga2002/IAGA2002Writer.py +++ b/geomagio/iaga2002/IAGA2002Writer.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from builtins import range -from io import StringIO +from io import BytesIO from datetime import datetime import numpy import textwrap @@ -260,7 +260,7 @@ class IAGA2002Writer(object): def format(self, timeseries, channels): """Get an IAGA2002 formatted string. - Calls write() with a StringIO, and returns the output. + Calls write() with a BytesIO, and returns the output. Parameters ---------- @@ -271,7 +271,7 @@ class IAGA2002Writer(object): unicode IAGA2002 formatted string. """ - out = StringIO() + out = BytesIO() writer = IAGA2002Writer() writer.write(out, timeseries, channels) return out.getvalue() diff --git a/geomagio/pcdcp/PCDCPWriter.py b/geomagio/pcdcp/PCDCPWriter.py index 42e91b316c470d9eabc64698e70913438d1ff69d..390c2ea153054abcd2a4628a750f570f9f63750c 100644 --- a/geomagio/pcdcp/PCDCPWriter.py +++ b/geomagio/pcdcp/PCDCPWriter.py @@ -3,7 +3,7 @@ from builtins import range import numpy from . import PCDCPParser -from io import StringIO +from io import BytesIO from datetime import datetime from .. import ChannelConverter, TimeseriesUtility from ..TimeseriesFactoryException import TimeseriesFactoryException @@ -165,7 +165,7 @@ class PCDCPWriter(object): def format(self, timeseries, channels): """Get an PCDCP formatted string. - Calls write() with a StringIO, and returns the output. + Calls write() with a BytesIO, and returns the output. Parameters ---------- @@ -179,7 +179,7 @@ class PCDCPWriter(object): unicode PCDCP formatted string. """ - out = StringIO() + out = BytesIO() writer = PCDCPWriter() writer.write(out, timeseries, channels) return out.getvalue() diff --git a/geomagio/temperature/TEMPWriter.py b/geomagio/temperature/TEMPWriter.py index fd38d6fc07756854b557144c6379cafb296d0c41..d7dfebe3b695d10b2375c5adcf25c0deaadcf871 100644 --- a/geomagio/temperature/TEMPWriter.py +++ b/geomagio/temperature/TEMPWriter.py @@ -1,7 +1,7 @@ from builtins import range import numpy -from io import StringIO +from io import BytesIO from datetime import datetime from .. import TimeseriesUtility from ..TimeseriesFactoryException import TimeseriesFactoryException @@ -131,7 +131,7 @@ class TEMPWriter(object): def format(self, timeseries, channels): """Get an temp/volt formatted string. - Calls write() with a StringIO, and returns the output. + Calls write() with a BytesIO, and returns the output. Parameters ---------- @@ -145,7 +145,7 @@ class TEMPWriter(object): unicode temp/volt formatted string. """ - out = StringIO() + out = BytesIO() writer = TEMPWriter() writer.write(out, timeseries, channels) return out.getvalue() diff --git a/geomagio/vbf/VBFWriter.py b/geomagio/vbf/VBFWriter.py index 626d474d347b56d794bfc8c8d4a5f18e498c930f..47794c812adbb8557282eb5a7d95f10899d6aeb1 100644 --- a/geomagio/vbf/VBFWriter.py +++ b/geomagio/vbf/VBFWriter.py @@ -1,7 +1,7 @@ from builtins import range import numpy -from io import StringIO +from io import BytesIO from datetime import datetime from .. import ChannelConverter, TimeseriesUtility from ..TimeseriesFactoryException import TimeseriesFactoryException @@ -146,7 +146,7 @@ class VBFWriter(object): def format(self, timeseries, channels): """Get an VBF formatted string. - Calls write() with a StringIO, and returns the output. + Calls write() with a BytesIO, and returns the output. Parameters ---------- @@ -160,7 +160,7 @@ class VBFWriter(object): unicode VBF formatted string. """ - out = StringIO() + out = BytesIO() writer = VBFWriter() writer.write(out, timeseries, channels) return out.getvalue() diff --git a/package.json b/package.json index 924ae75aae56f0d729af64d860e632b3cb4a0c91..c842128ff0f409d4a4d53fb8153960008a44e4de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "geomag-algorithms", - "version": "0.3.0", + "version": "0.3.1", "homepage": "http://geomag.usgs.gov/", "repository": "https://github.com/usgs/geomag-algorithms.git", "description": "Geomagnetism algorithms.", diff --git a/setup.py b/setup.py index d25e6b025de34678becc0321fe9857e730d5a065..edb67644460431478a7ec44ed1be080979f79b99 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from distutils.core import setup setup( name='geomag-algorithms', - version='0.3.0', + version='0.3.1', description='USGS Geomag IO Library', url='https://github.com/usgs/geomag-algorithms', packages=[