diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/Hazard.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/Hazard.java index cc73ea7b1911c7298b2f6da74ea42caca0e95ef8..497b95d4f99ef6198f982ce5f83d579e0f04ce40 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/calc/Hazard.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/Hazard.java @@ -119,6 +119,7 @@ public final class Hazard { * model. If only 1 {@code Hazard} is supplied, method returns that * supplied. */ + @Deprecated public static Hazard merge(Hazard... hazards) { checkArgument(hazards.length > 0); if (hazards.length == 1) { diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/Site.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/Site.java index c316c8a3651a7ee0d1f3afa935478035a13a4770..7eccc41782af76c8bf18647d175cc024ab33cc49 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/calc/Site.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/Site.java @@ -30,6 +30,7 @@ import gov.usgs.earthquake.nshmp.NamedLocation; import gov.usgs.earthquake.nshmp.geo.Location; import gov.usgs.earthquake.nshmp.geo.json.Feature; import gov.usgs.earthquake.nshmp.geo.json.Properties; +import gov.usgs.earthquake.nshmp.geo.json.Properties.Style; import gov.usgs.earthquake.nshmp.gmm.GroundMotionModel; /** @@ -287,7 +288,7 @@ public class Site { * parsers in Sites. */ Builder geoJsonProperties(Properties props) { - props.getString(Key.NAME).ifPresent(this::name); + props.getString(Style.TITLE.toString()).ifPresent(this::name); props.getDouble(Key.VS30).ifPresent(this::vs30); props.getBoolean(Key.VS_INF).ifPresent(this::vsInferred); props.getDouble(Key.Z1P0).ifPresent(this::z1p0); diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/Vs30.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/Vs30.java deleted file mode 100644 index b2c5e5421e92df2d801951c82145e2b47243187c..0000000000000000000000000000000000000000 --- a/src/main/java/gov/usgs/earthquake/nshmp/calc/Vs30.java +++ /dev/null @@ -1,63 +0,0 @@ -package gov.usgs.earthquake.nshmp.calc; - -/** - * Identifiers for commonly used values of Vs30. These correspond to the NEHERP - * site classes that have histroically been supported by the NSHMp in hazard - * calculations. - * - * @author U.S. Geological Survey - */ -@Deprecated -public enum Vs30 { - - /** NEHRP site class A. */ - VS_2000("Site class A"), - - /** NEHRP site class B. */ - VS_1150("Site class B"), - - /** NEHRP B/C boundary site class. */ - VS_760("B/C boundary"), - - /** NEHRP site class C. */ - VS_537("Site class C"), - - /** NEHRP C/D boundary site class. */ - VS_360("C/D boundary"), - - /** NEHRP site class D. */ - VS_259("Site class D"), - - /** NEHRP D/E boundary site class. */ - VS_180("D/E boundary"); - - private String label; - private double value; - - private Vs30(String label) { - this.label = label; - this.value = Double.valueOf(name().substring(3)); - } - - @Override - public String toString() { - return this.name().substring(3) + " m/s (" + label + ")"; - } - - /** - * Return the Vs30 value for this identifier. - */ - public double value() { - return value; - } - - /** - * Create a Vs30 constant from a Vs30 {@code value}. - * @param value to process - */ - public static Vs30 fromValue(double value) { - String name = "VS_" + (int) value; - return Enum.valueOf(Vs30.class, name); - } - -} diff --git a/src/main/java/gov/usgs/earthquake/nshmp/gmm/NehrpSiteClass.java b/src/main/java/gov/usgs/earthquake/nshmp/gmm/NehrpSiteClass.java new file mode 100644 index 0000000000000000000000000000000000000000..43b5e36cfaaf48b2b08c732edb6a4265c19851d4 --- /dev/null +++ b/src/main/java/gov/usgs/earthquake/nshmp/gmm/NehrpSiteClass.java @@ -0,0 +1,49 @@ +package gov.usgs.earthquake.nshmp.gmm; + +/** + * NEHRP site class identifier. + * + * <p>Over time, the equivalent Vs30 values for each site class have changed + * slightly and are documented with each NSHM. + * + * @author U.S. Geological Survey + */ +enum NehrpSiteClass { + + /** Site class A, very hard rock. */ + A("very hard rock"), + + /** Site class A/B boundary, hard rock. */ + AB("hard rock"), + + /** Site class B, medium hard rock. */ + B("medium hard rock"), + + /** Site class B/C boundary, soft rock. */ + BC("soft rock"), + + /** Site class C, very dense soil or hard clay. */ + C("very dense soil or hard clay"), + + /** Site class C/D boundary, dense sand or very stiff clay. */ + CD("dense sand or very stiff clay"), + + /** Site class D, medium dense sand or stiff clay. */ + D("medium dense sand or stiff clay"), + + /** Site class D/E boundary, loose sand or medium stiff clay. */ + DE("loose sand or medium stiff clay"), + + /** Site class E, very loose sand or soft clay. */ + E("very loose sand or soft clay"); + + private final String condition; + + private NehrpSiteClass(String condition) { + this.condition = condition; + } + + public String condition() { + return condition; + } +} diff --git a/src/main/java/gov/usgs/earthquake/nshmp/internal/www/WsUtils.java b/src/main/java/gov/usgs/earthquake/nshmp/internal/www/WsUtils.java index b76a1c8586fc93c6ffe79531bb666aeb461358b1..1c2e8bbd100cb0b7edf81c3e5b807c7e762bb642 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/internal/www/WsUtils.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/internal/www/WsUtils.java @@ -12,7 +12,6 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import gov.usgs.earthquake.nshmp.calc.Vs30; import gov.usgs.earthquake.nshmp.gmm.GmmInput; import gov.usgs.earthquake.nshmp.gmm.GmmInput.Field; import gov.usgs.earthquake.nshmp.internal.www.meta.ParamType; @@ -89,12 +88,11 @@ public class WsUtils { @Override public JsonElement serialize(E src, Type type, JsonSerializationContext context) { - String value = (src instanceof Vs30) ? src.name().substring(3) : src.name(); int displayOrder = src.ordinal(); JsonObject jObj = new JsonObject(); jObj.addProperty("id", src.ordinal()); - jObj.addProperty("value", value); + jObj.addProperty("value", src.name()); jObj.addProperty("display", src.toString()); jObj.addProperty("displayorder", displayOrder);