This repository is currently under development so the functionality and organization of the code is changing rapidly.
Linux build | |
Code quality | |
Code coverage |
This is a project designed to provide a number of functions related to parsing and processing ground motion data, building on top of the ObsPy library. Most of the extensions that we provide are to handle strong motion data and related issues.
Current functionality includes:
- Readers for a variety of formats not supported by ObsPy. See the
gmprocess.io
subpackage. All readers return ObsPy streams. - Ground motion record summary methods (i.e., intensity measures, or metrics)
in
gmprocess.metrics
subpackage. - The
gmprocess.processing.py
module uses ObsPy and our own methods for processing ground motion records. We are working towards logging each processing step with the SEIS-PROV provenance standard. - We are also working towards storing records, event/station metadata, and provenance information in the ASDF format.
- Mac OSX or Linux operating systems
- bash shell, gcc, git, curl
- On OSX, Xcode and command line tools
- The
install.sh
script installs this package and all other dependencies, including python and the required python libraries. It is regularly tested on OSX, CentOS, and Ubuntu. - Alternative install with conda:
conda install gmprocess
- Run
gmsetup
to install config files in the.gmprocess
subdirectory under the home directory.
The data file readers are modeled after ObsPy file readers, and have a standard interface.
Data file readers are located in gmprocess/io/[format]/core.py
.
This core.py module should take the following form:
def is_format(filename):
# code to examine candidate file and determine if it is of the type specified.
# return True if file is correct type, False otherwise.
def read_format(filename,**kwargs):
# code to read file and return an ObsPy Stream object.
In order to add an intensity measurement type (IMT) calculation, add
a file with the type as the file name under pgm/imt/
. The calculation
should be called calculate_[TYPE]
, where [TYPE]
matches the file
name. The argument should always be stream. The second function
should always be imcs (a list of requested intensity measure components,
e.g., CHANNELS
or RotD50
). All other
functions in the file should be hidden by an underscore (example
def _get_horizontals(stream)
). The calculate function should return
a dictionary of each component and the resulting values.
Example:
{
'HN2': 81.234,
'GMROTD0.0': 86.784,
'GMROTD100.0': 96.446,
'HN1': 99.249,
'HNZ': 183.772,
'GMROTD50.0': 92.177,
'GREATER_OF_TWO_HORIZONTALS': 99.249
}
StationSummary should be updated to handle the new IMT in gather_pgms
.
In order to add an intensity measurement component (IMC) calculation,
add a file with the component as the file name under pgm/imc/
. The
calculation should be called calculate_[COMPONENT]
, where [COMPONENT]
matches the file name. The argument should always be stream. All
other functions in the file should be hidden by an underscore (example
def _get_horizontals(stream)
). The calculate function should return
a single value or a dictionary of each component and the resulting
values. IMT calculations should be updated to handle a dictionary if
one is returned. Otherwise, single values will automatically be
handled.
Greater of two horizontals example:
99.249
Channels example:
{
'HN1': 99.249,
'HN2': 81.234,
'HNZ': 183.772
}
GMRotD example:
{
0.0: 103.299,
50.0: 119.925,
100.0: 125.406
}
For examples of the API see the example notebooks.