diff --git a/.travis.yml b/.travis.yml index a9c6b0568c73ed480f02e1182f3ac7cee83bb15e..3c05d9cf26ce3a50bb458f22c33ca58f521584d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,8 +23,8 @@ before_install: - npm --version - node --version install: - - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy nose flake8 + - conda config --add channels conda-forge + - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION obspy pycurl nose flake8 - source activate test-environment - - pip install obspy pycurl - npm install script: grunt lint test diff --git a/README.md b/README.md index b46b932752a185684307e3f7a029ca09abaa50df..94c07e4f0976751c8d422697e314bfacc325728a 100644 --- a/README.md +++ b/README.md @@ -86,19 +86,25 @@ Docker is the simplest install option. named `geomagio`, listening on local port `8000`, from the image `usgs/geomag-algorithms` on docker hub + ``` docker run -d --name geomagio -p 8000:80 usgs/geomag-algorithms ``` + 2. Use the running container - Run the `geomag.py` command line interface: + ``` docker exec -it geomagio geomag.py ``` + - Run python interactively in a web browser: + ``` open http://localhost:8000 ``` + > In the top right corner, choose "New" then "Python 2" diff --git a/geomagio/Controller.py b/geomagio/Controller.py index 2584ab15ad45001343150060a30c23a9fc589c2b..e923d231a5ce2ac0ea6b73b5fd89145abd942ecd 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -139,13 +139,16 @@ class Controller(object): channels=channels) return timeseries - def run(self, options): + def run(self, options, input_timeseries=None): """run controller Parameters ---------- options: dictionary The dictionary of all the command line arguments. Could in theory contain other options passed in by the controller. + input_timeseries : obspy.core.Stream + Used by run_as_update to save a double input read, since it has + already read the input to confirm data can be produced. """ algorithm = self._algorithm input_channels = options.inchannels or \ @@ -153,7 +156,7 @@ class Controller(object): output_channels = options.outchannels or \ algorithm.get_output_channels() # input - timeseries = self._get_input_timeseries( + timeseries = input_timeseries or self._get_input_timeseries( observatory=options.observatory, starttime=options.starttime, endtime=options.endtime, @@ -253,7 +256,7 @@ class Controller(object): options.endtime = output_gap[1] print >> sys.stderr, 'processing', \ options.starttime, options.endtime - self.run(options) + self.run(options, input_timeseries) def get_input_factory(args): diff --git a/geomagio/iaga2002/IAGA2002Parser.py b/geomagio/iaga2002/IAGA2002Parser.py index 637e7b79c1ecf089698082ae3ae66c808209d1a8..f706ae6a5849f1e739fbacda33551e1f47264619 100644 --- a/geomagio/iaga2002/IAGA2002Parser.py +++ b/geomagio/iaga2002/IAGA2002Parser.py @@ -5,8 +5,8 @@ import numpy from datetime import datetime # values that represent missing data points in IAGA2002 -EIGHTS = numpy.float64('88888.88') -NINES = numpy.float64('99999.99') +EIGHTS = numpy.float64('88888') +NINES = numpy.float64('99999') # placeholder channel name used when less than 4 channels are being written. EMPTY_CHANNEL = 'NUL' @@ -177,7 +177,6 @@ class IAGA2002Parser(object): if channel == EMPTY_CHANNEL: continue data = numpy.array(data, dtype=numpy.float64) - data[data == int(EIGHTS)] = numpy.nan data[data == EIGHTS] = numpy.nan data[data == NINES] = numpy.nan self.data[channel] = data diff --git a/geomagio/imfv122/IMFV122Parser.py b/geomagio/imfv122/IMFV122Parser.py index 2a496728db8a66822f630b305838d52fe23a6699..16f22cbc7385c904029c3fcb354a45b24d76accc 100644 --- a/geomagio/imfv122/IMFV122Parser.py +++ b/geomagio/imfv122/IMFV122Parser.py @@ -5,8 +5,8 @@ import numpy from obspy.core import UTCDateTime # values that represent missing data points in IAGA2002 -EIGHTS = numpy.float64('88888.88') -NINES = numpy.float64('99999.99') +EIGHTS = numpy.float64('88888') +NINES = numpy.float64('99999') class IMFV122Parser(object): @@ -137,7 +137,6 @@ class IMFV122Parser(object): self.times = self._parsedata[0] for channel, data in zip(self.channels, self._parsedata[1:]): data = numpy.array(data, dtype=numpy.float64) - data[data == int(EIGHTS)] = numpy.nan data[data == EIGHTS] = numpy.nan data[data == NINES] = numpy.nan if channel == 'D':