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

Merge branch 'lib-work' into 'master'

Lib work

See merge request !144
parents 711bd921 65967635
No related branches found
No related tags found
1 merge request!144Lib work
Pipeline #31830 passed
......@@ -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) {
......
......@@ -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);
......
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);
}
}
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;
}
}
......@@ -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);
......
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