Skip to content

Commit 4cc306b

Browse files
authored
Merge pull request #46 from nfsi-canada/v015
V015
2 parents 30e58dc + 5452e5a commit 4cc306b

File tree

2 files changed

+61
-45
lines changed

2 files changed

+61
-45
lines changed

obstools/__init__.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
Dependencies
5151
++++++++++++
5252
53-
The current version has been tested using **Python 3.6, 3.7 and 3.8** \
53+
The current version has been tested using **Python 3.10** \
5454
The following package is required before install ``obstools``:
5555
5656
- `stdb <https://github.com/paudetseis/StDb>`_
@@ -66,29 +66,26 @@
6666
6767
.. sourcecode:: bash
6868
69-
conda create -n obs python=3.7 obspy -c conda-forge
69+
conda create -n obs "python=3.10" "setuptools=60"" obspy -c conda-forge
7070
7171
Activate the newly created environment:
7272
7373
.. sourcecode:: bash
7474
7575
conda activate obs
7676
77-
Installing from Pypi
78-
++++++++++++++++++++
79-
80-
- Install dependencies:
77+
Install dependency:
8178
8279
.. sourcecode:: bash
8380
8481
pip install stdb
8582
86-
- Install ``obstools``:
83+
Installing development branch on GitHub
84+
+++++++++++++++++++++++++++++++++++++++
8785
8886
.. sourcecode:: bash
8987
90-
pip install obstools
91-
88+
pip install obstools@git+https://github.com/nfsi-canada/obstools
9289
9390
Installing from source
9491
++++++++++++++++++++++
@@ -104,7 +101,6 @@
104101
105102
.. sourcecode:: bash
106103
107-
pip install stdb
108104
pip install .
109105
110106
"""

obstools/scripts/atacr_download_data.py

+55-35
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ def get_daylong_arguments(argv=None):
8989
"correction. [Default '12,P' looks for both horizontal and " +
9090
"pressure and allows for both tilt AND compliance corrections]")
9191
parser.add_argument(
92-
"--zcomp",
92+
"--zcomp",
9393
dest="zcomp",
9494
type=str,
9595
default="Z",
96-
help="Specify the Vertical Component Channel Identifier. "+
96+
help="Specify the Vertical Component Channel Identifier. " +
9797
"[Default Z].")
9898
parser.add_argument(
9999
"-O", "--overwrite",
@@ -131,17 +131,17 @@ def get_daylong_arguments(argv=None):
131131
"waveform server (--user-auth='username:authpassword') to access " +
132132
"and download restricted data. [Default no user and password]")
133133
ServerGroup.add_argument(
134-
"--eida-token",
135-
action="store",
134+
"--eida-token",
135+
action="store",
136136
type=str,
137-
dest="tokenfile",
138-
default=None,
137+
dest="tokenfile",
138+
default=None,
139139
help="Token for EIDA authentication mechanism, see " +
140140
"http://geofon.gfz-potsdam.de/waveform/archive/auth/index.php. "
141141
"If a token is provided, argument --user-auth will be ignored. "
142142
"This mechanism is only available on select EIDA nodes. The token can "
143-
"be provided in form of the PGP message as a string, or the filename of "
144-
"a local file with the PGP message in it. [Default None]")
143+
"be provided in form of the PGP message as a string, or the filename "
144+
"of a local file with the PGP message in it. [Default None]")
145145

146146
"""
147147
# Database Settings
@@ -271,8 +271,8 @@ def get_daylong_arguments(argv=None):
271271
if args.userauth is not None:
272272
tt = args.userauth.split(':')
273273
if not len(tt) == 2:
274-
msg = ("Error: Incorrect Username and Password Strings for User "
275-
"Authentification")
274+
msg = ("Error: Incorrect Username and Password Strings for " +
275+
"User Authentification")
276276
parser.error(msg)
277277
else:
278278
args.userauth = tt
@@ -292,8 +292,8 @@ def get_daylong_arguments(argv=None):
292292
# args.ndval = nan
293293

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

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

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

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

@@ -455,9 +455,13 @@ def main(args=None):
455455
"*SAC ")
456456
print("* -> Downloading Seismic data... ")
457457
sth = client.get_waveforms(
458-
network=sta.network, station=sta.station,
459-
location=sta.location[0], channel=channels,
460-
starttime=t1, endtime=t2, attach_response=True)
458+
network=sta.network,
459+
station=sta.station,
460+
location=sta.location[0],
461+
channel=channels,
462+
starttime=t1,
463+
endtime=t2,
464+
attach_response=True)
461465
print("* ...done")
462466

463467
except Exception:
@@ -467,7 +471,7 @@ def main(args=None):
467471
t2 += dt
468472
continue
469473

470-
st = sth
474+
st = sth.merge()
471475

472476
elif "12" not in args.channels:
473477

@@ -490,9 +494,13 @@ def main(args=None):
490494
"*SAC ")
491495
print("* -> Downloading Seismic data... ")
492496
sth = client.get_waveforms(
493-
network=sta.network, station=sta.station,
494-
location=sta.location[0], channel=channels,
495-
starttime=t1, endtime=t2, attach_response=True)
497+
network=sta.network,
498+
station=sta.station,
499+
location=sta.location[0],
500+
channel=channels,
501+
starttime=t1,
502+
endtime=t2,
503+
attach_response=True)
496504
print("* ...done")
497505

498506
except Exception:
@@ -504,9 +512,13 @@ def main(args=None):
504512
try:
505513
print("* -> Downloading Pressure data...")
506514
stp = client.get_waveforms(
507-
network=sta.network, station=sta.station,
508-
location=sta.location[0], channel='?DH',
509-
starttime=t1, endtime=t2, attach_response=True)
515+
network=sta.network,
516+
station=sta.station,
517+
location=sta.location[0],
518+
channel='?DH',
519+
starttime=t1,
520+
endtime=t2,
521+
attach_response=True)
510522
print("* ...done")
511523
if len(stp) > 1:
512524
print("WARNING: There are more than one ?DH trace")
@@ -527,7 +539,7 @@ def main(args=None):
527539
t2 += dt
528540
continue
529541

530-
st = sth + stp
542+
st = sth.merge() + stp.merge()
531543

532544
else:
533545

@@ -552,9 +564,13 @@ def main(args=None):
552564
"*SAC ")
553565
print("* -> Downloading Seismic data... ")
554566
sth = client.get_waveforms(
555-
network=sta.network, station=sta.station,
556-
location=sta.location[0], channel=channels,
557-
starttime=t1, endtime=t2, attach_response=True)
567+
network=sta.network,
568+
station=sta.station,
569+
location=sta.location[0],
570+
channel=channels,
571+
starttime=t1,
572+
endtime=t2,
573+
attach_response=True)
558574
print("* ...done")
559575

560576
except Exception:
@@ -566,9 +582,13 @@ def main(args=None):
566582
try:
567583
print("* -> Downloading Pressure data...")
568584
stp = client.get_waveforms(
569-
network=sta.network, station=sta.station,
570-
location=sta.location[0], channel='?DH',
571-
starttime=t1, endtime=t2, attach_response=True)
585+
network=sta.network,
586+
station=sta.station,
587+
location=sta.location[0],
588+
channel='?DH',
589+
starttime=t1,
590+
endtime=t2,
591+
attach_response=True)
572592
print("* ...done")
573593
if len(stp) > 1:
574594
print("WARNING: There are more than one ?DH trace")
@@ -589,7 +609,7 @@ def main(args=None):
589609
t2 += dt
590610
continue
591611

592-
st = sth + stp
612+
st = sth.merge() + stp.merge()
593613

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

616-
# Extract traces - Z
636+
# Extract traces - Z
617637
trZ = sth.select(component=args.zcomp)[0]
618638
trZ = utils.update_stats(
619639
trZ, sta.latitude, sta.longitude, sta.elevation,

0 commit comments

Comments
 (0)