aurora.sandbox.io_helpers package¶
Submodules¶
aurora.sandbox.io_helpers.emtf_band_setup module¶
In this module is a class that emulates the old EMTF Band Setup File
- class aurora.sandbox.io_helpers.emtf_band_setup.EMTFBandSetupFile(filepath: str | Path | None = None, sample_rate: float | None = None)[source]¶
Bases:
object
- Attributes:
decimation_levels
Return the decimation level names (they are integers) in an array
num_bands
return the number of bands in the band setup file
num_decimation_levels
Return the number of decimation levels
Methods
compute_band_edges
(decimation_factors, ...)Adds columns to df defining the upper and lower bounds of the frequency bands in Hz.
get_decimation_level
(decimation_level[, order])Return a sub-dataframe with only the rows that correspond to the requested decimation level
load
([filepath])Loads an EMTF band setup file and casts it to a dataframe.
- compute_band_edges(decimation_factors: list, num_samples_window: int) dict [source]¶
Adds columns to df defining the upper and lower bounds of the frequency bands in Hz.
- property decimation_levels: ndarray¶
Return the decimation level names (they are integers) in an array
- get_decimation_level(decimation_level: int, order: str = 'ascending_frequency') DataFrame [source]¶
Return a sub-dataframe with only the rows that correspond to the requested decimation level
aurora.sandbox.io_helpers.fdsn_dataset module¶
This module contains a class that can be used to create mth5 datasets from FDSN servers
TODO: Review usages and consider replace with MTH5 FDSN class.
- class aurora.sandbox.io_helpers.fdsn_dataset.FDSNDataset[source]¶
Bases:
object
This class contains the information needed to uniquely specify a dataset that will be accessed from IRIS, NCEDC, or other FDSN client. This config will only work for single stations.
Need: -fdsn_metadata_parameters -data_parameters (how to rover, or load from local) -a way to specify station-channel, this config will only work for single stations.
- Attributes:
client
Returns the client (creates if doesn’t exist)
h5_filebase
retruns an h5 filename
Methods
describe
()logs some info to terminal
Gets data from client
get_inventory
([...])Gets inventory object from FDSN client
Initialize the client
- property client¶
Returns the client (creates if doesn’t exist)
- get_inventory(ensure_inventory_stages_are_named=True, level='response')[source]¶
Gets inventory object from FDSN client
- property h5_filebase¶
retruns an h5 filename
aurora.sandbox.io_helpers.inventory_review module¶
In this module are some helper functions for working with FDSN inventory objects.
- aurora.sandbox.io_helpers.inventory_review.describe_inventory_stages(inventory: Inventory, assign_names: bool | None = False, verbose: bool | None = False) None [source]¶
Scans inventory looking for stages. Has option to assign names to stages, these names are used as keys in MTH5. Modifies inventory in place.
- aurora.sandbox.io_helpers.inventory_review.scan_inventory_for_nonconformity(inventory, verbose=False)[source]¶
One off method for dealing with issues of historical data. Checks for the following: 1. Channel Codes: Q2, Q3 –> Q1, Q2 2. Field-type code: “T” instead of “F” 3. Tesla to nT :param inventory: Object containing metadata about station and channels :type inventory: obspy.core.inventory.inventory.Inventory
- Returns:
inventory – Object containing metadata about station and channels Might be modified during this function
- Return type:
obspy.core.inventory.inventory.Inventory
aurora.sandbox.io_helpers.make_mth5_helpers module¶
This module contains helper functions for making mth5 from FDSN clients.
aurora.sandbox.io_helpers.zfile_murphy module¶
This module contains a class that was contributed by Ben Murphy for working with EMTF “Z-files”
- class aurora.sandbox.io_helpers.zfile_murphy.ZFile(filename: str | Path)[source]¶
Bases:
object
Methods
apparent_resistivity
([angle])compute the apparent resistivity from the impedance.
get station ID from zfile
impedance
([angle])Compute the Impedance and errors from the transfer function.
load
()load Z-file and populate attributes of class
attempt to open file
phi
(mode)Return the phase for the given mode.
read coordinates and declination
rho
(mode)Return the apparent resistivity for the given mode.
Skip over the header when reading
tippers
([angle])compute the tipper from transfer function
- apparent_resistivity(angle: float = 0.0)[source]¶
compute the apparent resistivity from the impedance.
- impedance(angle: float | None = 0.0)[source]¶
Compute the Impedance and errors from the transfer function. - note u,v are identity matrices if angle=0
- Parameters:
angle (float) – The angle about the vertical axis by which to rotate the Z tensor.
- Returns:
z (np.ndarray) – The impedance tensor
error (np.ndarray) – Errors for the impedance tensor
- phi(mode)[source]¶
Return the phase for the given mode.
Convenience function to help with streamlining synthetic tests - to be eventually replaced by functionality in mt_metadata.tf :param mode: “xy” or “yx” :type mode: str
- Return type:
phi
- aurora.sandbox.io_helpers.zfile_murphy.read_z_file(z_file_path, angle=0.0) ZFile [source]¶
Reads a zFile and returns a ZFile object.
- Parameters:
z_file_path (string or pathlib.Path) – The name of the EMTF-style z-file to operate on
angle (float) – How much rotation to apply. This is a kludge variable used to help compare legacy SPUD results which are rotated onto a cardinal grid, vs aurora which store the TF in the coordinate system of acquisition
- Returns:
z_obj – The zFile as an object.
- Return type: