Skip to content
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

V015 #46

Merged
merged 2 commits into from
Apr 7, 2025
Merged

V015 #46

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
16 changes: 6 additions & 10 deletions obstools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
Dependencies
++++++++++++

The current version has been tested using **Python 3.6, 3.7 and 3.8** \
The current version has been tested using **Python 3.10** \
The following package is required before install ``obstools``:

- `stdb <https://github.com/paudetseis/StDb>`_
Expand All @@ -66,29 +66,26 @@

.. sourcecode:: bash

conda create -n obs python=3.7 obspy -c conda-forge
conda create -n obs "python=3.10" "setuptools=60"" obspy -c conda-forge

Activate the newly created environment:

.. sourcecode:: bash

conda activate obs

Installing from Pypi
++++++++++++++++++++

- Install dependencies:
Install dependency:

.. sourcecode:: bash

pip install stdb

- Install ``obstools``:
Installing development branch on GitHub
+++++++++++++++++++++++++++++++++++++++

.. sourcecode:: bash

pip install obstools

pip install obstools@git+https://github.com/nfsi-canada/obstools

Installing from source
++++++++++++++++++++++
Expand All @@ -104,7 +101,6 @@

.. sourcecode:: bash

pip install stdb
pip install .

"""
Expand Down
90 changes: 55 additions & 35 deletions obstools/scripts/atacr_download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def get_daylong_arguments(argv=None):
"correction. [Default '12,P' looks for both horizontal and " +
"pressure and allows for both tilt AND compliance corrections]")
parser.add_argument(
"--zcomp",
"--zcomp",
dest="zcomp",
type=str,
default="Z",
help="Specify the Vertical Component Channel Identifier. "+
help="Specify the Vertical Component Channel Identifier. " +
"[Default Z].")
parser.add_argument(
"-O", "--overwrite",
Expand Down Expand Up @@ -131,17 +131,17 @@ def get_daylong_arguments(argv=None):
"waveform server (--user-auth='username:authpassword') to access " +
"and download restricted data. [Default no user and password]")
ServerGroup.add_argument(
"--eida-token",
action="store",
"--eida-token",
action="store",
type=str,
dest="tokenfile",
default=None,
dest="tokenfile",
default=None,
help="Token for EIDA authentication mechanism, see " +
"http://geofon.gfz-potsdam.de/waveform/archive/auth/index.php. "
"If a token is provided, argument --user-auth will be ignored. "
"This mechanism is only available on select EIDA nodes. The token can "
"be provided in form of the PGP message as a string, or the filename of "
"a local file with the PGP message in it. [Default None]")
"be provided in form of the PGP message as a string, or the filename "
"of a local file with the PGP message in it. [Default None]")

"""
# Database Settings
Expand Down Expand Up @@ -271,8 +271,8 @@ def get_daylong_arguments(argv=None):
if args.userauth is not None:
tt = args.userauth.split(':')
if not len(tt) == 2:
msg = ("Error: Incorrect Username and Password Strings for User "
"Authentification")
msg = ("Error: Incorrect Username and Password Strings for " +
"User Authentification")
parser.error(msg)
else:
args.userauth = tt
Expand All @@ -292,8 +292,8 @@ def get_daylong_arguments(argv=None):
# args.ndval = nan

if args.units not in ['DISP', 'VEL', 'ACC']:
msg = ("Error: invalid --units argument. Choose among "
"'DISP', 'VEL', or 'ACC'")
msg = ("Error: invalid --units argument. Choose among " +
"'DISP', 'VEL', or 'ACC'")
parser.error(msg)

if args.pre_filt is None:
Expand All @@ -302,8 +302,8 @@ def get_daylong_arguments(argv=None):
args.pre_filt = [float(val) for val in args.pre_filt.split(',')]
args.pre_filt = sorted(args.pre_filt)
if (len(args.pre_filt)) != 4:
msg = ("Error: --pre-filt should contain 4 "
"comma-separated floats")
msg = ("Error: --pre-filt should contain 4 " +
"comma-separated floats")
parser.error(msg)

return args
Expand Down Expand Up @@ -416,8 +416,8 @@ def main(args=None):
tstamp = str(t1.year).zfill(4)+'.'+str(t1.julday).zfill(3)+'.'

print("\n"+"*"*60)
print("* Downloading day-long data for key "+stkey +
" and day "+str(t1.year)+"."+str(t1.julday))
print("* Downloading day-long data for key {0} " +
" and day {1}.{2:03d}".format(stkey, t1.year, t1.julday))
print("*")
print("* Channels selected: "+str(args.channels)+' and vertical')

Expand Down Expand Up @@ -455,9 +455,13 @@ def main(args=None):
"*SAC ")
print("* -> Downloading Seismic data... ")
sth = client.get_waveforms(
network=sta.network, station=sta.station,
location=sta.location[0], channel=channels,
starttime=t1, endtime=t2, attach_response=True)
network=sta.network,
station=sta.station,
location=sta.location[0],
channel=channels,
starttime=t1,
endtime=t2,
attach_response=True)
print("* ...done")

except Exception:
Expand All @@ -467,7 +471,7 @@ def main(args=None):
t2 += dt
continue

st = sth
st = sth.merge()

elif "12" not in args.channels:

Expand All @@ -490,9 +494,13 @@ def main(args=None):
"*SAC ")
print("* -> Downloading Seismic data... ")
sth = client.get_waveforms(
network=sta.network, station=sta.station,
location=sta.location[0], channel=channels,
starttime=t1, endtime=t2, attach_response=True)
network=sta.network,
station=sta.station,
location=sta.location[0],
channel=channels,
starttime=t1,
endtime=t2,
attach_response=True)
print("* ...done")

except Exception:
Expand All @@ -504,9 +512,13 @@ def main(args=None):
try:
print("* -> Downloading Pressure data...")
stp = client.get_waveforms(
network=sta.network, station=sta.station,
location=sta.location[0], channel='?DH',
starttime=t1, endtime=t2, attach_response=True)
network=sta.network,
station=sta.station,
location=sta.location[0],
channel='?DH',
starttime=t1,
endtime=t2,
attach_response=True)
print("* ...done")
if len(stp) > 1:
print("WARNING: There are more than one ?DH trace")
Expand All @@ -527,7 +539,7 @@ def main(args=None):
t2 += dt
continue

st = sth + stp
st = sth.merge() + stp.merge()

else:

Expand All @@ -552,9 +564,13 @@ def main(args=None):
"*SAC ")
print("* -> Downloading Seismic data... ")
sth = client.get_waveforms(
network=sta.network, station=sta.station,
location=sta.location[0], channel=channels,
starttime=t1, endtime=t2, attach_response=True)
network=sta.network,
station=sta.station,
location=sta.location[0],
channel=channels,
starttime=t1,
endtime=t2,
attach_response=True)
print("* ...done")

except Exception:
Expand All @@ -566,9 +582,13 @@ def main(args=None):
try:
print("* -> Downloading Pressure data...")
stp = client.get_waveforms(
network=sta.network, station=sta.station,
location=sta.location[0], channel='?DH',
starttime=t1, endtime=t2, attach_response=True)
network=sta.network,
station=sta.station,
location=sta.location[0],
channel='?DH',
starttime=t1,
endtime=t2,
attach_response=True)
print("* ...done")
if len(stp) > 1:
print("WARNING: There are more than one ?DH trace")
Expand All @@ -589,7 +609,7 @@ def main(args=None):
t2 += dt
continue

st = sth + stp
st = sth.merge() + stp.merge()

# Detrend, filter
st.detrend('demean')
Expand All @@ -613,7 +633,7 @@ def main(args=None):
print("* -> Removing responses - Seismic data")
sth.remove_response(pre_filt=args.pre_filt, output=args.units)

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