Skip to content

Commit a14e190

Browse files
authored
Merge pull request #10 from paudetseis/upgrades
added flexibility with Z12
2 parents 56bdae5 + 93c6cbb commit a14e190

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Scripts/rfpy_calc.py

+5
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ def main():
269269
# Save ZNE Traces
270270
pickle.dump(rfdata.data, open(ZNEfile, "wb"))
271271

272+
# Save Z12 if components exist
273+
if rfdata.dataZ12:
274+
Z12file = evtdir / 'Z12_Data.pkl'
275+
pickle.dump(rfdata.dataZ12, open(Z12file, "wb"))
276+
272277
# Rotate from ZNE to 'align' ('ZRT', 'LQT', or 'PVH')
273278
rfdata.rotate(vp=args.vp, vs=args.vs, align=args.align)
274279

rfpy/arguments.py

+7
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ def get_calc_arguments(argv=None):
141141
"search for local data (sometimes for CN stations " +
142142
"the dictionary name for a station may disagree with that " +
143143
"in the filename. [Default Network used]")
144+
DataGroup.add_argument(
145+
"--save-Z12",
146+
action="store_true",
147+
dest="saveZ12",
148+
default=False,
149+
help="Specify to save Z12 (un-rotated) components. [Default "+
150+
"False]")
144151

145152
# Event Selection Criteria
146153
EventGroup = parser.add_argument_group(

rfpy/rfdata.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,18 @@ def download_data(self, client, stdata=[], ndval=np.nan, new_sr=5.,
372372
tr2 = stream.select(component='2')[0]
373373
trZ = stream.select(component='Z')[0]
374374
self.data = Stream(traces=[trZ, tr1, tr2])
375-
self.dataZ12 = Stream(traces=[trZ, tr1, tr2])
376-
377-
# Rotate from Z12 to ZNE using StDb azcorr attribute
378-
self.rotate(align='ZNE')
379375

380376
# Filter Traces and resample
381377
self.data.filter('lowpass', freq=0.5*new_sr,
382378
corners=2, zerophase=True)
383379
self.data.resample(new_sr, no_filter=False)
384380

381+
# Save Z12 components in case it's necessary for later
382+
self.dataZ12 = self.data.copy()
383+
384+
# Rotate from Z12 to ZNE using StDb azcorr attribute
385+
self.rotate(align='ZNE')
386+
385387
except:
386388
self.meta.accept = False
387389

0 commit comments

Comments
 (0)