Skip to content

Commit

Permalink
Merge pull request #10 from paudetseis/upgrades
Browse files Browse the repository at this point in the history
added flexibility with Z12
  • Loading branch information
paudetseis authored Jun 23, 2020
2 parents 56bdae5 + 93c6cbb commit a14e190
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Scripts/rfpy_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ def main():
# Save ZNE Traces
pickle.dump(rfdata.data, open(ZNEfile, "wb"))

# Save Z12 if components exist
if rfdata.dataZ12:
Z12file = evtdir / 'Z12_Data.pkl'
pickle.dump(rfdata.dataZ12, open(Z12file, "wb"))

# Rotate from ZNE to 'align' ('ZRT', 'LQT', or 'PVH')
rfdata.rotate(vp=args.vp, vs=args.vs, align=args.align)

Expand Down
7 changes: 7 additions & 0 deletions rfpy/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ def get_calc_arguments(argv=None):
"search for local data (sometimes for CN stations " +
"the dictionary name for a station may disagree with that " +
"in the filename. [Default Network used]")
DataGroup.add_argument(
"--save-Z12",
action="store_true",
dest="saveZ12",
default=False,
help="Specify to save Z12 (un-rotated) components. [Default "+
"False]")

# Event Selection Criteria
EventGroup = parser.add_argument_group(
Expand Down
10 changes: 6 additions & 4 deletions rfpy/rfdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,18 @@ def download_data(self, client, stdata=[], ndval=np.nan, new_sr=5.,
tr2 = stream.select(component='2')[0]
trZ = stream.select(component='Z')[0]
self.data = Stream(traces=[trZ, tr1, tr2])
self.dataZ12 = Stream(traces=[trZ, tr1, tr2])

# Rotate from Z12 to ZNE using StDb azcorr attribute
self.rotate(align='ZNE')

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

# Save Z12 components in case it's necessary for later
self.dataZ12 = self.data.copy()

# Rotate from Z12 to ZNE using StDb azcorr attribute
self.rotate(align='ZNE')

except:
self.meta.accept = False

Expand Down

0 comments on commit a14e190

Please sign in to comment.