Skip to content

Commit

Permalink
updated component name in SAC files
Browse files Browse the repository at this point in the history
  • Loading branch information
paudetseis committed Mar 9, 2021
1 parent 1802c92 commit 1246f43
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/atacr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ M08A and send the prompt to a logfile
pattern matching. To find out, just type `ps -p $$`, which will return
`zsh` under the `CMD` field if you are using a Z shell. In this case, just
enclose the `?H?` in single or double quotes (e.g.,
`query_fdsn_stdb.py -N 7D -C "?H?"" -S M08A M08A > logfile`)
`query_fdsn_stdb.py -N 7D -C "?H?" -S M08A M08A > logfile`)

To check the station info for M08A, use the program ``ls_stdb.py``:

Expand Down
1 change: 1 addition & 0 deletions obstools/atacr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def update_stats(tr, stla, stlo, stel, cha):
tr.stats.sac.stla = stla
tr.stats.sac.stlo = stlo
tr.stats.sac.stel = stel
tr.stats.sac.kcmpnm = cha
tr.stats.channel = cha

return tr
Expand Down
12 changes: 8 additions & 4 deletions obstools/scripts/atacr_download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,17 +585,20 @@ def main(args=None):
# Extract traces - Z
trZ = sth.select(component='Z')[0]
trZ = utils.update_stats(
trZ, sta.latitude, sta.longitude, sta.elevation, 'Z')
trZ, sta.latitude, sta.longitude, sta.elevation,
sta.channel+'Z')
trZ.write(str(fileZ), format='SAC')

# Extract traces - H
if "H" in args.channels:
tr1 = sth.select(component='1')[0]
tr2 = sth.select(component='2')[0]
tr1 = utils.update_stats(
tr1, sta.latitude, sta.longitude, sta.elevation, '1')
tr1, sta.latitude, sta.longitude, sta.elevation,
sta.channel+'1')
tr2 = utils.update_stats(
tr2, sta.latitude, sta.longitude, sta.elevation, '2')
tr2, sta.latitude, sta.longitude, sta.elevation,
sta.channel+'2')
tr1.write(str(file1), format='SAC')
tr2.write(str(file2), format='SAC')

Expand All @@ -606,7 +609,8 @@ def main(args=None):
stp.remove_response(pre_filt=args.pre_filt)
trP = stp[0]
trP = utils.update_stats(
trP, sta.latitude, sta.longitude, sta.elevation, 'P')
trP, sta.latitude, sta.longitude, sta.elevation,
sta.channel[0]+'P')
trP.write(str(fileP), format='SAC')

t1 += dt
Expand Down
12 changes: 8 additions & 4 deletions obstools/scripts/atacr_download_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,8 @@ def main(args=None):
# Extract traces - Z
trZ = sth.select(component='Z')[0]
trZ = utils.update_stats(
trZ, sta.latitude, sta.longitude, sta.elevation, 'Z')
trZ, sta.latitude, sta.longitude, sta.elevation,
sta.channel+'Z')
trZ.write(str(fileZ), format='SAC')

# Extract traces and write out in SAC format
Expand All @@ -692,9 +693,11 @@ def main(args=None):
tr1 = sth.select(component='1')[0]
tr2 = sth.select(component='2')[0]
tr1 = utils.update_stats(
tr1, sta.latitude, sta.longitude, sta.elevation, '1')
tr1, sta.latitude, sta.longitude, sta.elevation,
sta.channel+'1')
tr2 = utils.update_stats(
tr2, sta.latitude, sta.longitude, sta.elevation, '2')
tr2, sta.latitude, sta.longitude, sta.elevation,
sta.channel+'2')
tr1.write(str(file1), format='SAC')
tr2.write(str(file2), format='SAC')

Expand All @@ -705,7 +708,8 @@ def main(args=None):
stp.remove_response(pre_filt=args.pre_filt)
trP = stp[0]
trP = utils.update_stats(
trP, sta.latitude, sta.longitude, sta.elevation, 'P')
trP, sta.latitude, sta.longitude, sta.elevation,
sta.channel[0]+'DH')
trP.write(str(fileP), format='SAC')

else:
Expand Down

0 comments on commit 1246f43

Please sign in to comment.