rtm.grid module
- rtm.grid.calculate_time_buffer(grid, max_station_dist)[source]
Utility function for estimating the amount of time needed for an infrasound signal to propagate from a source located anywhere in the RTM grid to the station farthest from the RTM grid center. This “travel time buffer” helps ensure that enough data is downloaded.
- Parameters:
grid (
DataArray
) – Grid to use; output ofdefine_grid()
max_station_dist (int or float) – [km] The longest distance from the grid center to a station
- Returns:
Maximum travel time [s] expected for a source anywhere in the grid to the station farthest from the grid center
- rtm.grid.define_grid(lon_0, lat_0, x_radius, y_radius, spacing, projected=False, plot_preview=False)[source]
Define the spatial grid of trial source locations. Grid can be defined in either a latitude/longitude or projected UTM (i.e., Cartesian) coordinate system.
- Parameters:
x_radius (int or float) – [deg or m] Distance from lon_0 to edge of grid (i.e., radius)
y_radius (int or float) – [deg or m] Distance from lat_0 to edge of grid (i.e., radius)
projected (bool) – Toggle whether a latitude/longitude or UTM grid is used. If True, a UTM grid is used and the units of x_radius, y_radius, and spacing are interpreted in meters instead of in degrees (default: False)
plot_preview (bool) – Toggle plotting a preview of the grid for reference and troubleshooting (default: False)
- Returns:
DataArray
object containing the grid coordinates and metadata
- rtm.grid.grid_search(processed_st, grid, time_method, starttime=None, endtime=None, stack_method='sum', window=None, overlap=0.5, **time_kwargs)[source]
Perform a grid search over \(x\) and \(y\) and return a 3-D object with dimensions \((t, y, x)\). If a UTM grid is used, then the UTM \((x, y)\) coordinates for each station (tr.stats.utm_x, tr.stats.utm_y) are added to processed_st. Optionally provide a 2-D array of elevation values to enable 3-D distance computation.
- Parameters:
processed_st (
Stream
) – Pre-processed data; output ofprocess_waveforms()
grid (
DataArray
) – Grid to use; output ofdefine_grid()
time_method (str) –
Method to use for calculating travel times. One of ‘celerity’ or ‘fdtd’
’celerity’ A single celerity is assumed for propagation. Distances are either 2-D or 3-D (if a DEM is supplied)
’fdtd’ Travel times are calculated using a finite-difference time-domain algorithm which accounts for wave interactions with topography. Only valid for UTM grids
starttime (
UTCDateTime
) – Start time for grid search (default: None, which translates to processed_st[0].stats.starttime)endtime (
UTCDateTime
) – End time for grid search (default: None, which translates to processed_st[0].stats.endtime)stack_method (str) –
Method to use for stacking aligned waveforms. One of ‘sum’, ‘product’, or ‘semblance’ (default: ‘sum’)
’sum’ Sum the aligned waveforms sample-by-sample
’product’ Multiply the aligned waveforms sample-by-sample. Results in a more spatially concentrated stack maximum
’semblance’ Multi-channel coherence computed over defined time windows
window (int or float) – Time window [s] needed for ‘semblance’ stacking (default: None)
overlap (int or float) – Overlap of time window for ‘semblance’ stacking (default: 0.5). Must be between 0 and 1, inclusive.
**time_kwargs – Keyword arguments to be passed on to
celerity_travel_time()
orfdtd_travel_time()
functions. For details, see the docstrings of those functions.
- Returns:
DataArray
containing the 3-D \((t, y, x)\) stack function
- rtm.grid.produce_dem(grid, external_file=None, plot_output=True, output_file=False)[source]
Produce a digital elevation model (DEM) with the same extent, spacing, and UTM projection as an input projected RTM grid. The data source can be either a user-supplied file or global SRTM 1 arc-second (~30 m) data taken from the GMT server. A DataArray and (optionally) a GeoTIFF file are created. Optionally plot the output DEM. Output GeoTIFF files are placed in
./rtm_dem
(relative to where this function is called).NOTE 1
The filename convention for output files is
rtm_dem_<lat_0>_<lon_0>_<x_radius>x_<y_radius>y_<spacing>m.tif
See the docstring for
define_grid()
for details/units.NOTE 2
PyGMT caches downloaded SRTM tiles in the directory
~/.gmt/server/earth/
. If you’re concerned about space, you can delete this directory. It will be created again the next time an SRTM tile is requested.- Parameters:
grid (
DataArray
) – Projected \((x, y)\) grid; i.e., output ofdefine_grid()
with projected=Trueexternal_file (str) – Filename of external DEM file to use. If None, then SRTM data is used (default: None)
plot_output (bool) – Toggle plotting a hillshade of the output DEM - useful for identifying voids or artifacts (default: True)
output_file (bool) – Toggle creation of output GeoTIFF file (default: False)
- Returns:
2-D
DataArray
of elevation values with identical shape to input grid.