diff --git a/requake/catalog/__init__.py b/requake/catalog/__init__.py index 8cc4132..97ba276 100644 --- a/requake/catalog/__init__.py +++ b/requake/catalog/__init__.py @@ -9,5 +9,9 @@ GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html) """ +from .catalog import ( # noqa + RequakeCatalog, RequakeEvent, generate_evid, + fix_non_locatable_events, read_stored_catalog +) from .read_catalog import read_catalog # noqa from .print_catalog import print_catalog # noqa diff --git a/requake/catalog/catalog.py b/requake/catalog/catalog.py index 6526be1..3092d84 100644 --- a/requake/catalog/catalog.py +++ b/requake/catalog/catalog.py @@ -12,8 +12,8 @@ import numpy as np from obspy import UTCDateTime from ..config import config -from ..formulas.conversion import float_or_none -from ..waveforms.station_metadata import get_traceid_coords +from ..formulas import float_or_none +from ..waveforms import get_traceid_coords class RequakeEvent(): diff --git a/requake/catalog/print_catalog.py b/requake/catalog/print_catalog.py index 8afbd2f..de422db 100644 --- a/requake/catalog/print_catalog.py +++ b/requake/catalog/print_catalog.py @@ -10,9 +10,8 @@ (https://www.gnu.org/licenses/gpl-3.0-standalone.html) """ import logging -from ..config import rq_exit +from ..config import rq_exit, generic_printer from .catalog import read_stored_catalog -from ..config.generic_printer import generic_printer logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/catalog/read_catalog.py b/requake/catalog/read_catalog.py index dc7e3d7..ac1e015 100644 --- a/requake/catalog/read_catalog.py +++ b/requake/catalog/read_catalog.py @@ -13,7 +13,7 @@ import logging import contextlib from ..config import config, rq_exit -from ..catalog.catalog import RequakeCatalog +from ..catalog import RequakeCatalog from .read_catalog_from_fdsnws import read_catalog_from_fdsnws from .read_catalog_from_quakeml import read_catalog_from_quakeml from .read_catalog_from_csv import read_catalog_from_csv diff --git a/requake/catalog/read_catalog_from_csv.py b/requake/catalog/read_catalog_from_csv.py index 2501a89..eade415 100644 --- a/requake/catalog/read_catalog_from_csv.py +++ b/requake/catalog/read_catalog_from_csv.py @@ -12,9 +12,8 @@ import logging import csv from obspy import UTCDateTime -from ..formulas.conversion import float_or_none, int_or_none -from ..catalog.catalog import ( - RequakeCatalog, RequakeEvent, generate_evid) +from ..formulas import float_or_none, int_or_none +from ..catalog import RequakeCatalog, RequakeEvent, generate_evid logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/catalog/read_catalog_from_fdsnws.py b/requake/catalog/read_catalog_from_fdsnws.py index bf2683f..ae13180 100644 --- a/requake/catalog/read_catalog_from_fdsnws.py +++ b/requake/catalog/read_catalog_from_fdsnws.py @@ -15,7 +15,7 @@ from obspy import UTCDateTime from obspy.clients.fdsn.header import URL_MAPPINGS from ..config import config -from ..catalog.catalog import RequakeCatalog, RequakeEvent +from ..catalog import RequakeCatalog, RequakeEvent logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/catalog/read_catalog_from_quakeml.py b/requake/catalog/read_catalog_from_quakeml.py index 741c87c..55487b9 100644 --- a/requake/catalog/read_catalog_from_quakeml.py +++ b/requake/catalog/read_catalog_from_quakeml.py @@ -11,7 +11,7 @@ """ import logging from obspy import read_events -from ..catalog.catalog import RequakeCatalog, RequakeEvent +from ..catalog import RequakeCatalog, RequakeEvent logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/config/__init__.py b/requake/config/__init__.py index 2eea1cd..1c5d48b 100644 --- a/requake/config/__init__.py +++ b/requake/config/__init__.py @@ -10,6 +10,7 @@ (https://www.gnu.org/licenses/gpl-3.0-standalone.html) """ from .rq_setup import rq_exit # noqa +from .generic_printer import generic_printer # noqa # The config object is created in config.py and needs to be populated # when using requake from command line, this is done by the configure() # function in rq_setup.py diff --git a/requake/families/__init__.py b/requake/families/__init__.py index c11ac97..e6fe05d 100644 --- a/requake/families/__init__.py +++ b/requake/families/__init__.py @@ -15,3 +15,8 @@ from .print_families import print_families # noqa from .flag_family import flag_family # noqa from .build_templates import build_templates # noqa +from .families import ( # noqa + read_families, read_selected_families, + get_family_aligned_waveforms_and_template, + FamilyNotFoundError +) diff --git a/requake/families/families.py b/requake/families/families.py index 0fab44f..9ab9372 100644 --- a/requake/families/families.py +++ b/requake/families/families.py @@ -15,12 +15,9 @@ from obspy import UTCDateTime, Stream from obspy.geodetics import gps2dist_azimuth from ..config import config -from ..formulas.conversion import float_or_none -from ..catalog.catalog import RequakeEvent -from ..waveforms.waveforms import ( - get_event_waveform, align_traces, build_template) -from ..formulas.slip import mag_to_slip_in_cm -from ..formulas.moment import mag_to_moment +from ..formulas import float_or_none, mag_to_slip_in_cm, mag_to_moment +from ..catalog import RequakeEvent +from ..waveforms import get_event_waveform, align_traces, build_template logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/families/pairs.py b/requake/families/pairs.py index 9c22118..6ecdb05 100644 --- a/requake/families/pairs.py +++ b/requake/families/pairs.py @@ -13,8 +13,8 @@ import csv from obspy import UTCDateTime from ..config import config -from ..formulas.conversion import float_or_none -from ..catalog.catalog import RequakeEvent +from ..formulas import float_or_none +from ..catalog import RequakeEvent logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/families/print_families.py b/requake/families/print_families.py index b89ea1d..01e4919 100644 --- a/requake/families/print_families.py +++ b/requake/families/print_families.py @@ -11,9 +11,8 @@ """ import logging import numpy as np +from ..config import generic_printer, rq_exit from .families import FamilyNotFoundError, read_selected_families -from ..config.generic_printer import generic_printer -from ..config import rq_exit logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/families/print_pairs.py b/requake/families/print_pairs.py index c7902d1..8a0d416 100644 --- a/requake/families/print_pairs.py +++ b/requake/families/print_pairs.py @@ -10,8 +10,7 @@ (https://www.gnu.org/licenses/gpl-3.0-standalone.html) """ import logging -from ..config import config, rq_exit -from ..config.generic_printer import generic_printer +from ..config import config, rq_exit, generic_printer from .pairs import read_pairs_file logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/formulas/__init__.py b/requake/formulas/__init__.py index a101303..bfbeb1d 100644 --- a/requake/formulas/__init__.py +++ b/requake/formulas/__init__.py @@ -10,4 +10,5 @@ (https://www.gnu.org/licenses/gpl-3.0-standalone.html) """ from .moment import mag_to_moment # noqa -from .slip import mag_to_slip_in_cm # noqa +from .slip import mag_to_slip_in_cm # noqa +from .conversion import float_or_none, int_or_none # noqa diff --git a/requake/plot/map_families.py b/requake/plot/map_families.py index 12bdb77..b968697 100644 --- a/requake/plot/map_families.py +++ b/requake/plot/map_families.py @@ -17,6 +17,7 @@ import cartopy.feature as cfeature from obspy.geodetics import gps2dist_azimuth from ..config import config, rq_exit +from ..families import FamilyNotFoundError, read_selected_families from .plot_utils import ( plot_title, hover_annotation, duration_string, family_colors, plot_colorbar ) @@ -29,7 +30,6 @@ StamenTerrain, WorldStreetMap ) -from ..families.families import FamilyNotFoundError, read_selected_families logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) # Reduce logging level for Matplotlib to avoid DEBUG messages mpl_logger = logging.getLogger('matplotlib') diff --git a/requake/plot/plot_cumulative.py b/requake/plot/plot_cumulative.py index f12ffe6..a9d5511 100644 --- a/requake/plot/plot_cumulative.py +++ b/requake/plot/plot_cumulative.py @@ -15,12 +15,12 @@ import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator from ..config import config, rq_exit +from ..families import FamilyNotFoundError, read_selected_families +from ..formulas import mag_to_slip_in_cm, mag_to_moment from .plot_utils import ( format_time_axis, plot_title, hover_annotation, duration_string, family_colors, plot_colorbar ) -from ..families.families import FamilyNotFoundError, read_selected_families -from ..formulas import mag_to_slip_in_cm, mag_to_moment logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) # Reduce logging level for Matplotlib to avoid DEBUG messages mpl_logger = logging.getLogger('matplotlib') diff --git a/requake/plot/plot_families.py b/requake/plot/plot_families.py index c1bad44..b35a3f1 100644 --- a/requake/plot/plot_families.py +++ b/requake/plot/plot_families.py @@ -17,11 +17,12 @@ from obspy.signal.filter import envelope from obspy.signal.util import smooth from ..config import config, rq_exit -from ..families.families import ( +from ..families import ( FamilyNotFoundError, read_selected_families, - get_family_aligned_waveforms_and_template) -from ..waveforms.waveforms import process_waveforms + get_family_aligned_waveforms_and_template +) +from ..waveforms import process_waveforms logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) # Reduce logging level for Matplotlib to avoid DEBUG messages mpl_logger = logging.getLogger('matplotlib') diff --git a/requake/plot/plot_pair.py b/requake/plot/plot_pair.py index df79f0f..7c9fe13 100644 --- a/requake/plot/plot_pair.py +++ b/requake/plot/plot_pair.py @@ -13,9 +13,8 @@ import matplotlib as mpl import matplotlib.pyplot as plt from ..config import config, rq_exit -from ..catalog.catalog import fix_non_locatable_events, read_stored_catalog -from ..waveforms.waveforms import ( - get_waveform_pair, process_waveforms, align_pair) +from ..catalog import fix_non_locatable_events, read_stored_catalog +from ..waveforms import get_waveform_pair, process_waveforms, align_pair logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) # Reduce logging level for Matplotlib to avoid DEBUG messages mpl_logger = logging.getLogger('matplotlib') diff --git a/requake/plot/plot_timespans.py b/requake/plot/plot_timespans.py index 994bbd9..c3676aa 100644 --- a/requake/plot/plot_timespans.py +++ b/requake/plot/plot_timespans.py @@ -14,11 +14,11 @@ import matplotlib.pyplot as plt import numpy as np from ..config import config, rq_exit +from ..families import FamilyNotFoundError, read_selected_families from .plot_utils import ( format_time_axis, plot_title, hover_annotation, duration_string, family_colors, plot_colorbar ) -from ..families.families import FamilyNotFoundError, read_selected_families logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) # Reduce logging level for Matplotlib to avoid DEBUG messages mpl_logger = logging.getLogger('matplotlib') diff --git a/requake/scan/scan_catalog.py b/requake/scan/scan_catalog.py index 1a49c59..3d35a63 100644 --- a/requake/scan/scan_catalog.py +++ b/requake/scan/scan_catalog.py @@ -16,10 +16,10 @@ from tqdm import tqdm from obspy.geodetics import gps2dist_azimuth from ..config import config, rq_exit -from ..catalog.catalog import fix_non_locatable_events, read_stored_catalog -from ..waveforms.station_metadata import NoMetadataError, MetadataMismatchError -from ..waveforms.waveforms import ( - get_waveform_pair, cc_waveform_pair, NoWaveformError, +from ..catalog import fix_non_locatable_events, read_stored_catalog +from ..waveforms import ( + get_waveform_pair, cc_waveform_pair, + NoWaveformError, NoMetadataError, MetadataMismatchError ) logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) diff --git a/requake/scan/scan_templates.py b/requake/scan/scan_templates.py index f491eba..120af2f 100644 --- a/requake/scan/scan_templates.py +++ b/requake/scan/scan_templates.py @@ -14,11 +14,11 @@ import sys from obspy import read from ..config import config, rq_exit -from ..families.families import ( - FamilyNotFoundError, read_families, read_selected_families) -from ..waveforms.waveforms import get_waveform, cc_waveform_pair -from ..waveforms.arrivals import get_arrivals -from ..catalog.catalog import RequakeEvent, generate_evid +from ..families import ( + FamilyNotFoundError, read_families, read_selected_families +) +from ..waveforms import get_waveform, cc_waveform_pair, get_arrivals +from ..catalog import RequakeEvent, generate_evid from .._version import get_versions logger = logging.getLogger(__name__.rsplit('.', maxsplit=1)[-1]) trace_cache = {} diff --git a/requake/waveforms/__init__.py b/requake/waveforms/__init__.py index b74f5e0..50f98f7 100644 --- a/requake/waveforms/__init__.py +++ b/requake/waveforms/__init__.py @@ -9,3 +9,15 @@ GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html) """ +from .waveforms import ( # noqa + get_waveform, get_event_waveform, + get_waveform_pair, cc_waveform_pair, + process_waveforms, + align_pair, align_traces, + build_template, + NoWaveformError +) +from .station_metadata import ( # noqa + get_traceid_coords, NoMetadataError, MetadataMismatchError +) +from .arrivals import get_arrivals # noqa