Skip to content
Snippets Groups Projects
Commit bf6b2fc7 authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

restructuring prvi class

parent 152aeb15
No related branches found
No related tags found
1 merge request!419rough framework for PRVI background GMC models based on CombinedGmm....
package gov.usgs.earthquake.nshmp.gmm;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.AG_20_GLOBAL_INTERFACE;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.AG_20_GLOBAL_SLAB;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.ASK_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.BSSA_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.CB_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.CY_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.KBCG_20_GLOBAL_INTERFACE;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.KBCG_20_GLOBAL_SLAB;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.MA_05;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.PSBAH_20_GLOBAL_INTERFACE;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.PSBAH_20_GLOBAL_SLAB;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import gov.usgs.earthquake.nshmp.data.DoubleData;
import gov.usgs.earthquake.nshmp.gmm.GmmInput.Constraints;
import gov.usgs.earthquake.nshmp.tree.LogicTree;
/*
*
*/
/**
* PRVI GMC class for backbone GMM implementations.
*
* Copied from CombinedGmm:
*
* Convenience class for combined GMM implementations that compute weight
* averaged ground motions and sigmas for a logic tree of ground motion models.
* These are NOT intended for use in hazard calculations, but are made available
* to support comparative deterministic analysis of GMM logic trees.
*/
class UsgsPrviBackbone implements GroundMotionModel {
private static final String NAME = "PRVI Backbone: ";
static final CoefficientContainer COEFFS_PHIS2S_ACTIVE_CRUST =
new CoefficientContainer("prvi-25-backbone-phiS2S_crustal.csv");
static final CoefficientContainer COEFFS_PHISS_ACTIVE_CRUST =
new CoefficientContainer("prvi-25-backbone-phiSS_crustal.csv");
static final CoefficientContainer COEFFS_SIGMA_SUBDUCTION =
new CoefficientContainer("prvi-25-backbone-sigma_subduction.csv");
static final CoefficientContainer COEFFS_TAU_ACTIVE_CRUST =
new CoefficientContainer("prvi-25-backbone-tau_crustal.csv");
/*
* Bias adjustmnet coefficients from https://github.com/gem/oq-engine/blob/
* 576bf0c6853ca896aae84e68ad848d39de09a396/openquake/hazardlib/gsim/usgs_prvi
* .py last updated Jun 25, 2024
*/
static final CoefficientContainer COEFFS_BIAS_ADJUSTMENT =
new CoefficientContainer("prvi-25-backbone-adjustment_coeffs.csv");
private final double ACTIVE_CRUSTAL_MEAN_ADJUSTMENT = -0.371;
private final double SUBDUCTION_INTERFACE_MEAN_ADJUSTMENT = -1.098;
private final double SUBDUCTION_INTRASLAB_MEAN_ADJUSTMENT = -0.405;
private final Map<Gmm, Double> gmms;
private final Imt imt;
/* Supply map of ground motion models initialized to the required IMT. */
private UsgsPrviBackbone(Imt imt, Map<Gmm, Double> gmms) {
this.gmms = gmms;
this.imt = imt;
double[] weights = gmms.values().stream()
.mapToDouble(Double::doubleValue)
.toArray();
DoubleData.checkWeightSum(weights);
}
@Override
public Imt imt() {
return imt;
}
@Override
public LogicTree<GroundMotion> calc(GmmInput in) {
LogicTree.Builder<GroundMotion> builder = LogicTree.builder(NAME);
gmms.keySet().forEach(key -> builder.addBranch(
key.name(),
GroundMotions.combine(key.instance(imt).calc(in)),
gmms.get(key)));
return builder.build();
}
static Map<Gmm, GroundMotionModel> instancesForImt(
Imt imt,
Map<Gmm, Double> gmms) {
return gmms.entrySet().stream()
.collect(Collectors.toMap(
Entry::getKey,
entry -> entry.getKey().instance(imt)));
}
/*
* Implementations. For each, coefficients are only used to get the set of
* supported IMTs and therefore reference a model that supports the
* intersection of all support IMTs.
*/
/* PRVI 2025 Active Crust */
/* This will eventually include NGA-W2 PRVI adjusted flavors */
static final Map<Gmm, Double> PRVI_2025_ACTIVE_CRUST = Map.of(
ASK_14, 0.22,
BSSA_14, 0.22,
CB_14, 0.22,
CY_14, 0.22,
MA_05, 0.12);
static final class Prvi2025ActiveCrust extends UsgsPrviBackbone {
static final String NAME = UsgsPrviBackbone.NAME + "Active crust 2025";
/* may need to use MA05 constraints? */
static final Constraints CONSTRAINTS = AbrahamsonEtAl_2014.CONSTRAINTS;
static final CoefficientContainer COEFFS = AbrahamsonEtAl_2014.COEFFS;
Prvi2025ActiveCrust(Imt imt) {
super(imt, PRVI_2025_ACTIVE_CRUST);
}
}
/* PRVI 2025 Subduction Interface */
/* This will eventually include NGA-Sub PRVI adjusted flavors */
static final Map<Gmm, Double> PRVI_2025_INTERFACE = Map.of(
AG_20_GLOBAL_INTERFACE, 0.2924,
KBCG_20_GLOBAL_INTERFACE, 0.2838,
PSBAH_20_GLOBAL_INTERFACE, 0.2838,
MA_05, 0.14);
static final class Prvi2025Interface extends UsgsPrviBackbone {
static final String NAME = UsgsPrviBackbone.NAME + "Interface 2025";
/* may need to use MA05 constraints? */
static final Constraints CONSTRAINTS = AbrahamsonGulerce_2020.CONSTRAINTS_INTERFACE;
static final CoefficientContainer COEFFS = AbrahamsonGulerce_2020.COEFFS;
Prvi2025Interface(Imt imt) {
super(imt, PRVI_2025_INTERFACE);
}
}
/* PRVI 2025 Subduction Intraslab */
/* This will eventually include NGA-Sub PRVI adjusted flavors */
static final Map<Gmm, Double> PRVI_2025_INTRASLAB = Map.of(
AG_20_GLOBAL_SLAB, 0.2924,
KBCG_20_GLOBAL_SLAB, 0.2838,
PSBAH_20_GLOBAL_SLAB, 0.2838,
MA_05, 0.14);
static final class Prvi2025Slab extends UsgsPrviBackbone {
static final String NAME = UsgsPrviBackbone.NAME + "Interface 2025";
/* may need to use MA05 constraints? */
static final Constraints CONSTRAINTS = AbrahamsonGulerce_2020.CONSTRAINTS_SLAB;
static final CoefficientContainer COEFFS = AbrahamsonGulerce_2020.COEFFS;
Prvi2025Slab(Imt imt) {
super(imt, PRVI_2025_INTRASLAB);
}
}
// static final Map<Gmm, Double> STABLE_CRUST_2014 = Map.of(
// AB_06_PRIME, 0.22,
// ATKINSON_08_PRIME, 0.08,
// CAMPBELL_03, 0.11,
// FRANKEL_96, 0.06,
// PEZESHK_11, 0.15,
// SILVA_02, 0.06,
// SOMERVILLE_01, 0.1,
// TP_05, 0.11,
// TORO_97_MW, 0.11);
//
// /* Need to allow Vs30=3000 through for comparison plots. */
// private static final Constraints STABLE_2014_CONSTRAINTS =
// Constraints.builder()
// .withDefaults()
// .build();
//
// /* 4.0 Fault variant that includes Somerville. */
// static final class StableCrust2014 extends PrviBackbone {
//
// static final String NAME = PrviBackbone.NAME + "Stable crust 2014 (4.*)";
// static final Constraints CONSTRAINTS = STABLE_2014_CONSTRAINTS;
// static final CoefficientContainer COEFFS = FrankelEtAl_1996.COEFFS;
//
// StableCrust2014(Imt imt) {
// super(imt, STABLE_CRUST_2014);
// }
//
// @Override
// public LogicTree<GroundMotion> calc(GmmInput in) {
// GmmInput.Builder b = GmmInput.builder().fromCopy(in);
// b.vs30(in.vs30 <= 760.0 ? 760.0 : 2000.0);
// return super.calc(b.build());
// }
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment