test_utils#

Test the general utility functions of Pysep which includes quality checking waveforms and formatting data with metadata

TODO add function testing clipped station, need to find example data

Module Contents#

Functions#

test_event()

Pre-saved event object

test_inv()

Pre-saved event object

test_st()

Pre-saved event object

test_append_sac_headers(test_st, test_inv, test_event)

Make sure we can write SAC headers correctly

test_event_tag_and_event_tag_legacy(test_event)

Check that event tagging works as expected

test_format_sac_headers_w_taup_traveltimes(test_st, ...)

Make sure we can write SAC headers correctly

test_sac_header_correct_origin_time(tmpdir, test_st, ...)

Make sure SAC headers are being written with 0 as the event origin time and

test_rename_channels(test_st)

Edit some waveforms to be obviously bad and make sure we can catch it

test_remove_stations_for_insufficient_length(test_st)

Some of these data already have insufficient length

test_remove_stations_for_missing_channels(test_st)

Edit some stations to be obviously bad and make sure we can catch it

test_traces_for_bad_data_types(test_st)

Make sure data types that aren't float or integer arent' allowed through

test_plot_map(test_event, test_inv)

Make a simple source-receiver map

test_read_sem()

Test reading SPECFEM-generated synthetics in as SAC formatted files

test_estimate_prefilter_corners(test_st)

Test prefilter corner estimation based on trace starts time and samp rate

test_remove_for_clipped_amplitudes(test_st)

TODO

test_subset_streams(test_st)

Make sure subsetting streams works by removing additional trace

test_get_usgs_moment_tensor()

Just ensure that getting via USGS works as intended using an example event

test_get_gcmt_moment_tensor()

Just ensure that getting via GCMT works as intended using an example event

test_utils.test_event()[source]#

Pre-saved event object

test_utils.test_inv()[source]#

Pre-saved event object

test_utils.test_st()[source]#

Pre-saved event object

test_utils.test_append_sac_headers(test_st, test_inv, test_event)[source]#

Make sure we can write SAC headers correctly

test_utils.test_event_tag_and_event_tag_legacy(test_event)[source]#

Check that event tagging works as expected

test_utils.test_format_sac_headers_w_taup_traveltimes(test_st, test_inv, test_event)[source]#

Make sure we can write SAC headers correctly

test_utils.test_sac_header_correct_origin_time(tmpdir, test_st, test_inv, test_event)[source]#

Make sure SAC headers are being written with 0 as the event origin time and not the trace start time

test_utils.test_rename_channels(test_st)[source]#

Edit some waveforms to be obviously bad and make sure we can catch it

TODO add function testing clipped station

test_utils.test_remove_stations_for_insufficient_length(test_st)[source]#

Some of these data already have insufficient length

test_utils.test_remove_stations_for_missing_channels(test_st)[source]#

Edit some stations to be obviously bad and make sure we can catch it

test_utils.test_traces_for_bad_data_types(test_st)[source]#

Make sure data types that aren’t float or integer arent’ allowed through Sometimes LOG streams are stored as |S1 dtype which is string of len 1

test_utils.test_plot_map(test_event, test_inv)[source]#

Make a simple source-receiver map

TODO This should probably have an image comparison to a baseline but for

now we just make sure plotting works

test_utils.test_read_sem()[source]#

Test reading SPECFEM-generated synthetics in as SAC formatted files

test_utils.test_estimate_prefilter_corners(test_st)[source]#

Test prefilter corner estimation based on trace starts time and samp rate

test_utils.test_remove_for_clipped_amplitudes(test_st)[source]#

TODO

test_utils.test_subset_streams(test_st)[source]#

Make sure subsetting streams works by removing additional trace

TODO this test will FAIL if data has multiple traces for a single component

present in one stream but not another. This is due to how subset streams matches data (only by station ID). Users will need to merge data or take care that they do not have data gaps/ multiple traces.

test_utils.test_get_usgs_moment_tensor()[source]#

Just ensure that getting via USGS works as intended using an example event

test_utils.test_get_gcmt_moment_tensor()[source]#

Just ensure that getting via GCMT works as intended using an example event