Skip to content

Commit

Permalink
Increasing time-range for RF plot/export
Browse files Browse the repository at this point in the history
* Time-range for both plotting and exporting RFs has been extended to
  [-5, 30]s
  • Loading branch information
geojunky committed Nov 17, 2022
1 parent 732c654 commit d6fadd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions seismic/receiver_fn/rf_inversion_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def rf_inversion_export(input_h5_file, output_folder, network_list="*", station_
min_station_weight=-1, apply_amplitude_filter=False, apply_similarity_filter=False,
min_slope_ratio=-1, dereverberate=False, baz_range=(0, 360),
apply_phase_weighting=False, pw_exponent=1.,
component='R', resample_freq=6.25, trim_window=(-5.0, 20.0), moveout=True):
component='R', resample_freq=6.25, trim_window=(-5.0, 30.0), moveout=True):
"""Export receiver function to text format for ingestion into Fortran RF inversion code.
:param input_h5_file: Input hdf5 file containing receiver function data
Expand All @@ -94,7 +94,7 @@ def rf_inversion_export(input_h5_file, output_folder, network_list="*", station_
:type component: str, optional
:param resample_freq: Sampling rate (Hz) of the output files, defaults to 6.25 Hz
:type resample_freq: float, optional
:param trim_window: Time window to export relative to onset, defaults to (-5.0, 20.0). If data needs
:param trim_window: Time window to export relative to onset, defaults to (-5.0, 30.0). If data needs
to be resampled, the samples are anchored to the start of this time window.
:type trim_window: tuple, optional
:param moveout: Whether to apply moveout correction prior to exporting, defaults to True
Expand Down Expand Up @@ -274,6 +274,9 @@ def rf_inversion_export(input_h5_file, output_folder, network_list="*", station_
stack.interpolate(sampling_rate=resample_freq, method='lanczos', a=10, starttime=exact_start_time)
stack.trim2(*trim_window, reftime='onset')

# Apply a 2 s taper to the right side
trace.taper(max_percentage=None, max_length=2, side='right')

times = trace.times() - (trace.stats.onset - trace.stats.starttime)
# TODO: Remove hardwired scaling factor.
# This scaling factor only applies to iterative deconvolution with default Gaussian width
Expand Down
4 changes: 2 additions & 2 deletions seismic/receiver_fn/rf_plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def apply(st):
return result
# end func

def plot_rf_psd(rf_stream, ax, time_window=(-10.0, 25.0), min_slope_ratio=-1):
def plot_rf_psd(rf_stream, ax, time_window=(-10.0, 30.0), min_slope_ratio=-1):
if(time_window): rf_stream = rf_stream.copy().slice2(*time_window, reftime='onset')

all_trace_lens = np.array([len(tr) for tr in rf_stream])
Expand Down Expand Up @@ -72,7 +72,7 @@ def plot_rf_psd(rf_stream, ax, time_window=(-10.0, 25.0), min_slope_ratio=-1):
# end if
# end func

def plot_rf_stack(rf_stream, time_window=(-10.0, 25.0), trace_height=0.2, stack_height=0.8, save_file=None, **kwargs):
def plot_rf_stack(rf_stream, time_window=(-10.0, 30.0), trace_height=0.2, stack_height=0.8, save_file=None, **kwargs):
"""Wrapper function of rf.RFStream.plot_rf() to help do RF plotting with consistent formatting and layout.
:param rf_stream: RFStream to plot
Expand Down

0 comments on commit d6fadd0

Please sign in to comment.