rtm.travel_time module
- rtm.travel_time.celerity_travel_time(grid, st, celerity=343, dem=None)[source]
Compute travel times by dividing by a single celerity value. For projected grids, distances can be 2-D or 3-D. For lat/lon grids, distances are great circles.
NOTE
If an input DEM is provided, this function will overwrite the
tr.stats.elevationattribute for each Trace in the input st with the “clamped-to-ground” value from the DEM.- Parameters:
grid (
DataArray) – Grid to use; output ofdefine_grid()st (
Stream) – Stream containing coordinates for each stationcelerity (int or float) – [m/s] Single celerity to use for travel time removal (default: 343)
dem (
DataArray) – Grid of elevation values for 3-D Euclidean distance time removal, such as output fromproduce_dem. If None, only performs 2-D Euclidian distance time removal (default: None)
- Returns:
3-D array with dimensions \((\text{station}, y, x)\) containing travel times from each station to each \((x, y)\) point in seconds
- Return type:
- rtm.travel_time.fdtd_travel_time(grid, st, FILENAME_ROOT, FDTD_DIR=None)[source]
Computes travel time from each station to each grid point using FDTD output surface pressure files.
- Parameters:
grid (
DataArray) – Grid to use; output ofdefine_grid()st (
Stream) – Stream containing coordinates for each stationFILENAME_ROOT (str) – FDTD filename prefix
FDTD_DIR (str) – Output directory for FDTD run. If None, uses os.getcwd() (default: None)
- Returns:
3-D array with dimensions \((\text{station}, y, x)\) containing travel times from each station to each \((x, y)\) point in seconds (interpolated to input grid)
- Return type:
- rtm.travel_time.infresnel_travel_time(grid, st, celerity=343, stored_result=None, dem_file=None, n_jobs=1)[source]
Compute travel times by calculating the shortest diffracted path over topography, then dividing by a single celerity value. Can use a previously calculated result (or store the newly calculated result) via the stored_result argument.
- Parameters:
grid (
DataArray) – Grid to use; output ofdefine_grid()st (
Stream) – Stream containing coordinates for each stationcelerity (int or float) – [m/s] Single celerity to use for travel time removal (default: 343)
stored_result (str or None) – Path to a stored NetCDF (.nc) result file to either load (if file exists) or write to (if file doesn’t exist). If None, does not store the result
dem_file (str or None) – Path to DEM file (see
infresnel.infresnel.calculate_paths())n_jobs (int) – Number of parallel jobs to run, passed on to
infresnel.infresnel.calculate_paths(). A value of -2 will result in all CPUs but one being used.
- Returns:
3-D array with dimensions \((\text{station}, y, x)\) containing travel times from each station to each \((x, y)\) point in seconds
- Return type:
- rtm.travel_time.prepare_fdtd_run(FDTD_DIR, FILENAME_ROOT, station, dem, H_MAX, TEMP, MAX_T, DT, SRC_FREQ, SNAPOUT)[source]
Prepare and write RTM/FDTD files. Writes station, elevation, density, and sound speed file. Also parameter files for each station and shell script for FDTD calculation.
- Parameters:
FDTD_DIR (str) – Output directory for FDTD run
FILENAME_ROOT (str) – FDTD input filename prefix
station (str) – SEED station code
dem (
DataArray) – Grid containing the elevation values as well as grid coordinates and metadataTEMP (int or float) – Temperature for sound speed calculation [K]
MAX_T (int or float) – Duration of FDTD simulation [s] (make sure it extends across your grid)
DT (int or float) – Simulation time (DT \(\leq\) dem.spacing / \(c\sqrt{3}\), where \(c\) is sound speed)
SRC_FREQ (int or float) – Source frequency [Hz] (make sure at least 20 wavelengths per dem.spacing)