GroundModelSuite

GroundModelSuite class definition.

class GroundModelSuite(groundmodel)

Bases: swprepost.suite.Suite

Class for manipulating suites of GroundModel objects.

Variables:gms (list) – List of GroundModel objects, composing the suite.
__init__(groundmodel)

Initialize a GroundModelSuite from a GroundModelObject.

Parameters:groundmodel (GroundModel) – Instantiated GroundModel object.
Returns:GroundModelSuite – Initialized GroundModelSuite.
append(groundmodel, sort=True)

Append GroundModel object to GroundModelSuite object.

Parameters:
  • groundmodel (GroundModel) – refer to :meth: __init__ <swprepost.GroundModelSuite.__init__>.
  • sort (bool) – Sort models according to misfit (smallest to largest), default is True indicating sort will be performed. If it is known that the misfit of appended model is larger than those already part of the suite, setting sort to False can allow for a significant speed improvement.
Returns:

None – Instead updates the attributes gms.

static check_type(groundmodel)

Check input to GroundModelSuite.

Specifically: 1. groundmodel is of type GroundModel.

classmethod from_array(tks, vps, vss, rhs, ids, misfits)

Create from an array of values.

Parameters:
  • tks, vps, vss, rhs (ndarray) – 2D array representation of the ground models composing the suite. Each column represents a particular groundmodel and each row a layer in that ground model.
  • ids, misfits (ndarray) – 1D array where each entry corresponds to a ground model.
Returns:

GroundModelSuite – Instantiated GroundModelSuite.

Raises:

ValueError – If the size of the arrays are inconsistent.

classmethod from_geopsy(fname, nmodels='all', sort=False)

Create from a file following the Geopsy format.

Parameters:
  • fname (str) – Name of file, may contain a relative or the full path.
  • nmodels ({int, ‘all’}, optional) – Number of GroundModels to extract from file, default is all.
  • sort (bool, optional) – Indicates whether the imported data should be sorted from lowest to highest misfit, default is False indicating no sorting is performed.
Returns:

GroundModelSuite – Initialized GroundModelSuite.

classmethod from_list(groundmodels, sort=True)

Create from a list of GroundModel objects.

gms
median(nbest='all')

Calculate the median GroundModel of the GroundModelSuite.

Parameters:nbest ({int, ‘all’}, optional) – Number of the best profiles to consider when calculating the median profile, default is ‘all’, meaning all available models will be used.
Returns:GroundModel – Initialized GroundModel object.
median_simple(nbest='all', parameter='vs')

Calculate layer-by-layer median of a given parameter.

Parameters:
  • nbest ({int, “all”}, optional) – Number of best models to consider, default is ‘all’ so all models will be used.
  • parameter ({‘depth’, ‘vs’, ‘vp’, ‘rho’}, optional) – Parameter along which to calculate the median, default is ‘vs’ for shear-wave velocity.
Returns:

tuple – Of the form (median_thickness, median_parameter) where median_thickness is a list of the median thickness of each layer and median_parameter is a list of the median parameter of each layer.

sigma_ln(dmax=50, dy=0.5, nbest='all', parameter='vs')

Lognormal standard deviation of a parameter.

Parameters:
  • dmax (float, optional) – Depth to which to discretize the parameter profiles in meters, default is 50.
  • dy (float, optional) – Linear-spacing of depth samples in meters, default is 0.5.
  • nbest ({int, ‘all’}, optional) – Number of best profiles to consider for calculation, default is ‘all’.
  • parameter ({‘vs’, ‘vp’, ‘rh’, ‘density’, ‘pr’}, optional) – Parameter to be used for the calculation, default is ‘vs’.
Returns:

Lognormal standard deviation of the nbest discretized profiles.

vs30(nbest='all')

Calculate Vs30 for GroundModelSuite.

Parameters:nbest ({int, “all”}, optional) – Number of lowest misfit profiles to return.
Returns:list – Of the nbest Vs30 values.

See also

Refer()

write_to_txt(fname, nbest='all')

Write to text file, following the Geopsy format.

Parameters:
  • fname (str) – Name of file, may be a relative or the full path.
  • nbest ({int, ‘all’}, optional) – Number of best models to write to file, default is ‘all’ indicating all models will be written.
Returns:

None – Writes file to disk.