Skip to content

Commit

Permalink
Merge pull request #9 from adjtomo/devel
Browse files Browse the repository at this point in the history
General improvements for better compatibilities w/ external packages
  • Loading branch information
bch0w committed Jul 27, 2022
2 parents 17db9f3 + 152f443 commit 3928d24
Show file tree
Hide file tree
Showing 106 changed files with 1,442,978 additions and 2,514 deletions.
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
Thank your for contributing to Pyatoa.
Please fill out the following before submitting your PR.
-->

### What does this PR do?

### Why was it initiated? Any relevant Issues?

### PR Checklist
- [ ] `develop` base branch selected?
- [ ] This PR is not directly related to an existing issue (which has no PR yet).
- [ ] All tests still pass.
- [ ] Any new features or fixed regressions covered by new tests.
- [ ] Any new or changed features have been fully documented.
- [ ] Significant changes have been added to `CHANGELOG.md`.
- [ ] First time contributors have added your name to CONTRIBUTORS.txt .


7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
## Version 0.0.1
# Current (moving to v0.2.0)

- Replaced Basemap mapping dependency with Cartopy due to Basemap EOL
- Refactored Gatherer class to simplify code structure. API remains the same.
- New Executive class takes care of standalone parallel processing
- Pyaflowa per-station parallel processing using concurrent.futures
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chow, Bryant
File renamed without changes.
155 changes: 0 additions & 155 deletions TODO.md

This file was deleted.

13 changes: 2 additions & 11 deletions pyatoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,12 @@
ch.setFormatter(formatter)
logger.addHandler(ch)

# Actually this is annoying, don't do that
# Redirect warning messages into the logger
# logging.captureWarnings(True)
# warnings_logger = logging.getLogger("py.warnings")
# warnings_logger.addHandler(logger)

from pyatoa.core.config import Config # NOQA
from pyatoa.core.manager import Manager, ManagerError # NOQA
from pyatoa.core.gatherer import (Gatherer, append_focal_mechanism,
get_gcmt_moment_tensor) # NOQA
from pyatoa.core.executive import Executive # NOQA
from pyatoa.core.gatherer import Gatherer # NOQA
from pyatoa.core.inspector import Inspector # NOQA
from pyatoa.core.pyaflowa import Pyaflowa # NOQA
from pyatoa.utils.read import read_sem, read_stations # NOQA
from pyatoa.utils.write import write_sem, write_stations # NOQA

# Dont include this so that Mayavi is not a default requirement
#from pyatoa.visuals.vtk_modeler import VTKModeler # NOQA

19 changes: 12 additions & 7 deletions pyatoa/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
currently it's obscured behind some private functions
"""
import yaml
import numpy as np
from copy import deepcopy
from pyatoa import logger
from pyatoa.utils.form import format_iter, format_step
from pyatoa.plugins.pyflex_presets import pyflex_presets
Expand Down Expand Up @@ -260,8 +262,9 @@ def _check(self):
assert(self.step_count >= 0), "Step count must start from 0"

# Check period range is acceptable
assert(self.min_period < self.max_period), \
"min_period must be less than max_period"
if self.min_period and self.max_period:
assert(self.min_period < self.max_period), \
"min_period must be less than max_period"

# Check if unit output properly set, dictated by ObsPy units
acceptable_units = ['DISP', 'VEL', 'ACC']
Expand Down Expand Up @@ -389,6 +392,12 @@ def _check_io_format(fid, fmt=None):
else:
return fmt

def copy(self):
"""
Simply convenience function to return a deep copy of the Config
"""
return deepcopy(self)

def write(self, write_to, fmt=None):
"""
Wrapper for underlying low-level write functions
Expand Down Expand Up @@ -465,10 +474,6 @@ def _write_asdf(self, ds):
:type ds: pyasdf.asdf_data_set.ASDFDataSet
:param ds: dataset to save the config file to
"""
# Lazy imports because this function isn't always called
from numpy import array
from copy import deepcopy

# Deep copy to ensure that we aren't editing the Config parameters
attrs = vars(deepcopy(self))

Expand Down Expand Up @@ -497,7 +502,7 @@ def _write_asdf(self, ds):
attrs.pop(key)
attrs.update(add_attrs)

ds.add_auxiliary_data(data_type="Configs", data=array([True]),
ds.add_auxiliary_data(data_type="Configs", data=np.array([True]),
path=self.aux_path, parameters=attrs
)

Expand Down
Loading

0 comments on commit 3928d24

Please sign in to comment.