Skip to content

V014 #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 31, 2025
Merged

V014 #44

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@ on:
jobs:
# This workflow contains a single job called "build"
build:
name: Python ${{ matrix.python-version }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9']
os: ["ubuntu-latest"]
python-version: ["3.10"]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: test
auto-activate-base: false
Expand All @@ -40,22 +39,22 @@ jobs:
run: |
conda info
conda config --add channels conda-forge
conda install obspy pandas
conda install obspy pandas libstdcxx-ng
pip install stdb
pip install -e .
pip install .

- name: Tests
shell: bash -l {0}
run: |
export MPLBACKEND=Agg
mkdir empty
cd empty
conda install pytest-cov
pytest -v --cov=obstools ../obstools/tests/
bash <(curl -s https://codecov.io/bash)
# - name: Tests
# shell: bash -l {0}
# run: |
# export MPLBACKEND=Agg
# mkdir empty
# cd empty
# conda install pytest-cov
# pytest -v --cov=obstools ../obstools/tests/
# bash <(curl -s https://codecov.io/bash)

- name: Make docs
if: matrix.python-version == '3.8'
if: matrix.python-version == '3.10'
shell: bash -l {0}
run: |
cd docs
Expand All @@ -66,7 +65,7 @@ jobs:
cd ..

- name: Deploy 🚀
if: matrix.python-version == '3.8'
if: matrix.python-version == '3.10'
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ build
dist

_build
TODO
TODO
atacr_download_data_xml.py
32 changes: 24 additions & 8 deletions docs/atacr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,26 @@ Usage
correction. [Default looks for both horizontal and
pressure and allows for both tilt AND compliance
corrections]
--zcomp ZCOMP Specify the Vertical Component Channel Identifier.
[Default Z].
-O, --overwrite Force the overwriting of pre-existing data. [Default
False]

Server Settings:
Settings associated with which datacenter to log into.

-S SERVER, --Server SERVER
-S SERVER, --server SERVER
Specify the server to connect to. Options include:
BGR, ETH, GEONET, GFZ, INGV, IPGP, IRIS, KOERI, LMU,
NCEDC, NEIP, NERIES, ODC, ORFEUS, RESIF, SCEDC, USGS,
USP. [Default IRIS]
-U USERAUTH, --User-Auth USERAUTH
Enter your IRIS Authentification Username and Password
(--User-Auth='username:authpassword') to access and
--server-url SERVER_URL
Specify the obspy base_url server address (and port if
needed) to open for the fdsn client. Overrides any
settings to '--server'. [Default None]
-U USERAUTH, --user-auth USERAUTH
Enter your Authentification Username and Password
(--user-auth='username:authpassword') to access and
download restricted data. [Default no user and
password]

Expand Down Expand Up @@ -572,20 +578,26 @@ Usage
correction. [Default looks for both horizontal and
pressure and allows for both tilt AND compliance
corrections]
--zcomp ZCOMP Specify the Vertical Component Channel Identifier.
[Default Z].
-O, --overwrite Force the overwriting of pre-existing data. [Default
False]

Server Settings:
Settings associated with which datacenter to log into.

-S SERVER, --Server SERVER
-S SERVER, --server SERVER
Specify the server to connect to. Options include:
BGR, ETH, GEONET, GFZ, INGV, IPGP, IRIS, KOERI, LMU,
NCEDC, NEIP, NERIES, ODC, ORFEUS, RESIF, SCEDC, USGS,
USP. [Default IRIS]
-U USERAUTH, --User-Auth USERAUTH
Enter your IRIS Authentification Username and Password
(--User-Auth='username:authpassword') to access and
--server-url SERVER_URL
Specify the obspy base_url server address (and port if
needed) to open for the fdsn client. Overrides any
settings to '--server'. [Default None]
-U USERAUTH, --user-auth USERAUTH
Enter your Authentification Username and Password
(--user-auth='username:authpassword') to access and
download restricted data. [Default no user and
password]

Expand All @@ -599,6 +611,10 @@ Usage
--pre-filt PRE_FILT Specify four comma-separated corner frequencies
(float, in Hz) for deconvolution pre-filter. [Default
0.001,0.005,45.,50.]
--window WINDOW Specify window length in seconds. Default value is
highly recommended. Program may not be stable for
large deviations from default value. [Default 7200.
(or 2 hours)]

Event Settings:
Settings associated with refining the events to include in matching
Expand Down
2 changes: 1 addition & 1 deletion obstools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

"""

__version__ = '0.1.4'
__version__ = '0.1.5'

__author__ = 'Pascal Audet & Helen Janiszewski'

Expand Down
4 changes: 1 addition & 3 deletions obstools/atacr/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,13 +642,11 @@ def average_daily_spectra(self, calc_rotation=True, fig_average=False,

Attributes
----------
f : :class:`~numpy.ndarray`
Positive frequency axis for corresponding window parameters
power : :class:`~obstools.atacr.classes.Power`
Container for the Power spectra
cross : :class:`~obstools.atacr.classes.Cross`
Container for the Cross power spectra
rotation : :class:`~obstools.atacr.classes.Cross`, optional
rotation : :class:`~obstools.atacr.classes.Rotation`, optional
Container for the Rotated power and cross spectra

Examples
Expand Down
3 changes: 0 additions & 3 deletions obstools/comply/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ class Comply(object):
components (obtained from the
:class:`~obstools.atacr.classes.DayNoise` or the
:class:`~obstools.atacr.classes.StaNoise` noise objects)
complyfunc : Dict
Dictionary of compliance and coherence functions given the available
components.

"""

Expand Down
69 changes: 49 additions & 20 deletions obstools/scripts/atacr_download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ def get_daylong_arguments(argv=None):
"for tilt correction. Specifying 'P' allows for compliance " +
"correction. [Default '12,P' looks for both horizontal and " +
"pressure and allows for both tilt AND compliance corrections]")
parser.add_argument(
"--zcomp",
dest="zcomp",
type=str,
default="Z",
help="Specify the Vertical Component Channel Identifier. "+
"[Default Z].")
parser.add_argument(
"-O", "--overwrite",
action="store_true",
Expand All @@ -102,23 +109,32 @@ def get_daylong_arguments(argv=None):
description="Settings associated with which "
"datacenter to log into.")
ServerGroup.add_argument(
"-S", "--Server",
"-S", "--server",
action="store",
type=str,
dest="Server",
dest="server",
default="IRIS",
help="Specify the server to connect to. Options include: " +
"BGR, ETH, GEONET, GFZ, INGV, IPGP, IRIS, KOERI, LMU, NCEDC, " +
"NEIP, NERIES, ODC, ORFEUS, RESIF, SCEDC, USGS, USP. " +
"[Default IRIS]")
ServerGroup.add_argument(
"-U", "--User-Auth",
"--server-url",
action="store",
type=str,
dest="server_url",
default=None,
help="Specify the obspy base_url server address (and port if needed) " +
"to open for the fdsn client. Overrides any settings to '--server'. " +
"[Default None]")
ServerGroup.add_argument(
"-U", "--user-auth",
action="store",
type=str,
dest="UserAuth",
dest="userauth",
default="",
help="Enter your IRIS Authentification Username and Password " +
"(--User-Auth='username:authpassword') to access and download " +
help="Enter your Authentification Username and Password " +
"(--user-auth='username:authpassword') to access and download " +
"restricted data. [Default no user and password]")

"""
Expand Down Expand Up @@ -243,16 +259,16 @@ def get_daylong_arguments(argv=None):
args.endT = None

# Parse User Authentification
if not len(args.UserAuth) == 0:
tt = args.UserAuth.split(':')
if not len(args.userauth) == 0:
tt = args.userauth.split(':')
if not len(tt) == 2:
parser.error(
"Error: Incorrect Username and Password Strings for " +
"User Authentification")
else:
args.UserAuth = tt
args.userauth = tt
else:
args.UserAuth = []
args.userauth = []

# # Parse Local Data directories
# if args.localdata is not None:
Expand Down Expand Up @@ -323,11 +339,24 @@ def main(args=None):
datapath.mkdir(parents=True)

# Establish client
if len(args.UserAuth) == 0:
client = Client(args.Server)
if len(args.userauth) == 0:
if args.server_url is not None:
client = Client(
base_url=args.server_url)
else:
client = Client(
args.server)
else:
client = Client(
args.Server, user=args.UserAuth[0], password=args.UserAuth[1])
if args.server_url is not None:
client = Client(
base_url=args.server_url,
user=args.userauth[0],
password=args.userauth[1])
else:
client = Client(
args.server,
user=args.userauth[0],
password=args.userauth[1])

# Get catalogue search start time
if args.startT is None:
Expand Down Expand Up @@ -420,7 +449,7 @@ def main(args=None):
continue

channels = sta.channel.upper()+'1,'+sta.channel.upper() + \
'2,'+sta.channel.upper()+'Z'
'2,'+sta.channel.upper()+args.zcomp

# Get waveforms from client
try:
Expand Down Expand Up @@ -455,7 +484,7 @@ def main(args=None):
t2 += dt
continue

channels = sta.channel.upper() + 'Z'
channels = sta.channel.upper() + args.zcomp

# Get waveforms from client
try:
Expand Down Expand Up @@ -517,7 +546,7 @@ def main(args=None):
continue

channels = sta.channel.upper()+'1,'+sta.channel.upper() + \
'2,'+sta.channel.upper()+'Z'
'2,'+sta.channel.upper()+args.zcomp

# Get waveforms from client
try:
Expand Down Expand Up @@ -580,14 +609,14 @@ def main(args=None):
continue

sth = st.select(component='1') + st.select(component='2') + \
st.select(component='Z')
st.select(component=args.zcomp)

# Remove responses
print("* -> Removing responses - Seismic data")
sth.remove_response(pre_filt=args.pre_filt, output=args.units)

# Extract traces - Z
trZ = sth.select(component='Z')[0]
# Extract traces - Z
trZ = sth.select(component=args.zcomp)[0]
trZ = utils.update_stats(
trZ, sta.latitude, sta.longitude, sta.elevation,
sta.channel+'Z')
Expand Down
Loading
Loading