From c52a3fe84052dd584bb09cfe6e7f3ddbdced7f32 Mon Sep 17 00:00:00 2001 From: Jeremy Fee <jmfee@usgs.gov> Date: Fri, 19 Dec 2014 15:58:58 -0700 Subject: [PATCH] Flattened package layout, moved main to bin --- {src/python => bin}/main.py | 8 +++++--- {src/python/geomag => geomagio}/Algorithm.py | 0 {src/python/geomag => geomagio}/ChannelConverter.py | 0 .../python/geomag => geomagio}/ChannelConverterTest.py | 0 {src/python/geomag => geomagio}/StreamConverter.py | 0 .../python/geomag/io => geomagio}/TimeseriesFactory.py | 0 .../io => geomagio}/TimeseriesFactoryException.py | 0 {src/python/geomag => geomagio}/WaveserverFactory.py | 0 {src/python/geomag/io => geomagio}/__init__.py | 10 +++++++--- .../geomag/io => geomagio}/iaga2002/IAGA2002Factory.py | 2 +- .../io => geomagio}/iaga2002/IAGA2002Factory_test.py | 0 .../geomag/io => geomagio}/iaga2002/IAGA2002Parser.py | 0 .../io => geomagio}/iaga2002/IAGA2002Parser_test.py | 0 .../geomag/io => geomagio}/iaga2002/IAGA2002Writer.py | 2 +- .../geomag/io => geomagio}/iaga2002/MagWebFactory.py | 0 .../io => geomagio}/iaga2002/MagWebFactory_test.py | 0 .../python/geomag/io => geomagio}/iaga2002/__init__.py | 0 src/python/geomag/__init__.py | 3 --- 18 files changed, 14 insertions(+), 11 deletions(-) rename {src/python => bin}/main.py (78%) mode change 100644 => 100755 rename {src/python/geomag => geomagio}/Algorithm.py (100%) rename {src/python/geomag => geomagio}/ChannelConverter.py (100%) rename {src/python/geomag => geomagio}/ChannelConverterTest.py (100%) rename {src/python/geomag => geomagio}/StreamConverter.py (100%) rename {src/python/geomag/io => geomagio}/TimeseriesFactory.py (100%) rename {src/python/geomag/io => geomagio}/TimeseriesFactoryException.py (100%) rename {src/python/geomag => geomagio}/WaveserverFactory.py (100%) rename {src/python/geomag/io => geomagio}/__init__.py (53%) rename {src/python/geomag/io => geomagio}/iaga2002/IAGA2002Factory.py (99%) rename {src/python/geomag/io => geomagio}/iaga2002/IAGA2002Factory_test.py (100%) rename {src/python/geomag/io => geomagio}/iaga2002/IAGA2002Parser.py (100%) rename {src/python/geomag/io => geomagio}/iaga2002/IAGA2002Parser_test.py (100%) rename {src/python/geomag/io => geomagio}/iaga2002/IAGA2002Writer.py (99%) rename {src/python/geomag/io => geomagio}/iaga2002/MagWebFactory.py (100%) rename {src/python/geomag/io => geomagio}/iaga2002/MagWebFactory_test.py (100%) rename {src/python/geomag/io => geomagio}/iaga2002/__init__.py (100%) delete mode 100644 src/python/geomag/__init__.py diff --git a/src/python/main.py b/bin/main.py old mode 100644 new mode 100755 similarity index 78% rename from src/python/main.py rename to bin/main.py index 1b0ac2859..e943de4f6 --- a/src/python/main.py +++ b/bin/main.py @@ -1,18 +1,20 @@ +#! /usr/bin/env python + from os import path # ensure geomag is on the path before importing script_dir = path.dirname(path.abspath(__file__)) if __file__ != 'main.py': import sys - sys.path.append(script_dir) + sys.path.append(path.normpath(path.join(script_dir, '..'))) -import geomag.io.iaga2002 as iaga2002 +import geomagio.iaga2002 as iaga2002 from obspy.core.utcdatetime import UTCDateTime def main(): """Example loading IAGA2002 test data from a directory.""" - iaga_dir = path.normpath(path.join(script_dir, '../../etc/iaga2002')) + iaga_dir = path.normpath(path.join(script_dir, '../etc/iaga2002')) factory = iaga2002.IAGA2002Factory('file://' + iaga_dir + '/%(OBS)s/%(interval)s%(type)s/%(obs)s%(ymd)s%(t)s%(i)s.%(i)s', observatory='BOU', channels=('H', 'D', 'Z', 'F'), diff --git a/src/python/geomag/Algorithm.py b/geomagio/Algorithm.py similarity index 100% rename from src/python/geomag/Algorithm.py rename to geomagio/Algorithm.py diff --git a/src/python/geomag/ChannelConverter.py b/geomagio/ChannelConverter.py similarity index 100% rename from src/python/geomag/ChannelConverter.py rename to geomagio/ChannelConverter.py diff --git a/src/python/geomag/ChannelConverterTest.py b/geomagio/ChannelConverterTest.py similarity index 100% rename from src/python/geomag/ChannelConverterTest.py rename to geomagio/ChannelConverterTest.py diff --git a/src/python/geomag/StreamConverter.py b/geomagio/StreamConverter.py similarity index 100% rename from src/python/geomag/StreamConverter.py rename to geomagio/StreamConverter.py diff --git a/src/python/geomag/io/TimeseriesFactory.py b/geomagio/TimeseriesFactory.py similarity index 100% rename from src/python/geomag/io/TimeseriesFactory.py rename to geomagio/TimeseriesFactory.py diff --git a/src/python/geomag/io/TimeseriesFactoryException.py b/geomagio/TimeseriesFactoryException.py similarity index 100% rename from src/python/geomag/io/TimeseriesFactoryException.py rename to geomagio/TimeseriesFactoryException.py diff --git a/src/python/geomag/WaveserverFactory.py b/geomagio/WaveserverFactory.py similarity index 100% rename from src/python/geomag/WaveserverFactory.py rename to geomagio/WaveserverFactory.py diff --git a/src/python/geomag/io/__init__.py b/geomagio/__init__.py similarity index 53% rename from src/python/geomag/io/__init__.py rename to geomagio/__init__.py index 3ed3e9fdc..1f6c5db88 100644 --- a/src/python/geomag/io/__init__.py +++ b/geomagio/__init__.py @@ -1,12 +1,16 @@ """ -Geomag Timeseries IO Module +Geomag Algorithm Module """ - +from Algorithm import Algorithm +import ChannelConverter +import StreamConverter from TimeseriesFactory import TimeseriesFactory from TimeseriesFactoryException import TimeseriesFactoryException - __all__ = [ + 'Algorithm', + 'ChannelConverter', + 'StreamConverter', 'TimeseriesFactory', 'TimeseriesFactoryException' ] diff --git a/src/python/geomag/io/iaga2002/IAGA2002Factory.py b/geomagio/iaga2002/IAGA2002Factory.py similarity index 99% rename from src/python/geomag/io/iaga2002/IAGA2002Factory.py rename to geomagio/iaga2002/IAGA2002Factory.py index e1466d942..849643794 100644 --- a/src/python/geomag/io/iaga2002/IAGA2002Factory.py +++ b/geomagio/iaga2002/IAGA2002Factory.py @@ -3,7 +3,7 @@ import urllib2 import obspy.core import os -from geomag.io import TimeseriesFactory, TimeseriesFactoryException +from geomagio import TimeseriesFactory, TimeseriesFactoryException from IAGA2002Parser import IAGA2002Parser from IAGA2002Writer import IAGA2002Writer diff --git a/src/python/geomag/io/iaga2002/IAGA2002Factory_test.py b/geomagio/iaga2002/IAGA2002Factory_test.py similarity index 100% rename from src/python/geomag/io/iaga2002/IAGA2002Factory_test.py rename to geomagio/iaga2002/IAGA2002Factory_test.py diff --git a/src/python/geomag/io/iaga2002/IAGA2002Parser.py b/geomagio/iaga2002/IAGA2002Parser.py similarity index 100% rename from src/python/geomag/io/iaga2002/IAGA2002Parser.py rename to geomagio/iaga2002/IAGA2002Parser.py diff --git a/src/python/geomag/io/iaga2002/IAGA2002Parser_test.py b/geomagio/iaga2002/IAGA2002Parser_test.py similarity index 100% rename from src/python/geomag/io/iaga2002/IAGA2002Parser_test.py rename to geomagio/iaga2002/IAGA2002Parser_test.py diff --git a/src/python/geomag/io/iaga2002/IAGA2002Writer.py b/geomagio/iaga2002/IAGA2002Writer.py similarity index 99% rename from src/python/geomag/io/iaga2002/IAGA2002Writer.py rename to geomagio/iaga2002/IAGA2002Writer.py index 40a8247f1..a36d6108b 100644 --- a/src/python/geomag/io/iaga2002/IAGA2002Writer.py +++ b/geomagio/iaga2002/IAGA2002Writer.py @@ -1,6 +1,6 @@ from cStringIO import StringIO -from geomag.io import TimeseriesFactoryException +from geomagio import TimeseriesFactoryException import numpy import IAGA2002Parser import textwrap diff --git a/src/python/geomag/io/iaga2002/MagWebFactory.py b/geomagio/iaga2002/MagWebFactory.py similarity index 100% rename from src/python/geomag/io/iaga2002/MagWebFactory.py rename to geomagio/iaga2002/MagWebFactory.py diff --git a/src/python/geomag/io/iaga2002/MagWebFactory_test.py b/geomagio/iaga2002/MagWebFactory_test.py similarity index 100% rename from src/python/geomag/io/iaga2002/MagWebFactory_test.py rename to geomagio/iaga2002/MagWebFactory_test.py diff --git a/src/python/geomag/io/iaga2002/__init__.py b/geomagio/iaga2002/__init__.py similarity index 100% rename from src/python/geomag/io/iaga2002/__init__.py rename to geomagio/iaga2002/__init__.py diff --git a/src/python/geomag/__init__.py b/src/python/geomag/__init__.py deleted file mode 100644 index e9ae2e6b9..000000000 --- a/src/python/geomag/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -Geomag Algorithm Module -""" -- GitLab