diff --git a/docs/pages/Calculation-Configuration.md b/docs/pages/Calculation-Configuration.md index c7a20bde54a9f7407626f35161e8b90837efbd78..8ed8b9276c78b7c8b2341a2f1df058301e359d27 100644 --- a/docs/pages/Calculation-Configuration.md +++ b/docs/pages/Calculation-Configuration.md @@ -14,41 +14,40 @@ may be overridden. See [building and running](./Building-&-Running.md) and the Parameter | Type | Default | Notes | --------- | ---- | ------- | ----- | __`hazard`__ - `.exceedanceModel` |`String` | `TRUNCATION_3SIGMA_UPPER` | [`ExceedanceModel`][url-exceedance] - `.truncationLevel` |`Double` | `3.0` | [1](#notes) + `.exceedanceModel` |`String` | `TRUNCATION_3SIGMA_UPPER` | [`ExceedanceModel`][url-exceedance] + `.truncationLevel` |`Double` | `3.0` | [1](#notes) `.imts` |`String[]` | `[ PGV, PGA, SA0P01, SA0P02, SA0P03, SA0P05, SA0P075, SA0P1, SA0P15, SA0P2, SA0P25, SA0P3, SA0P4, SA0P5, SA0P75, SA1P0, SA1P5, SA2P0, SA3P0, SA4P0, SA5P0, SA7P5, SA10P0 ]` | [`Imt`][url-imt] + `.tectonicSettings` |`String[]` | `[]` | Tectonic setting filter + `.sourceTypes` |`String[]` | `[]` | Source type filter + `.vs30s` |`Double[]` | `[]` | Vs30s to use for batch jobs `.customImls` |`Map<String, Double[]>` | `{}` (empty object) | [2](#notes) - `.gmmUncertainty` |`Boolean` | `false` | [3](#notes) - `.valueFormat` |`String` | `ANNUAL_RATE` | [`ValueFormat`][url-valueformat] + `.gmmDampingRatio` |`Double` | `0.05` (5%) | [3](#notes) + `.gmmSigmaScale` |`Double` | `1.0` (100%, no scaling) | + `.valueFormat` |`String` | `ANNUAL_RATE` | [`ValueFormat`][url-valueformat] __`disagg`__ - `.bins` |`Object` | | [4](#notes) - `.contributorLimit` |`Double` | `0.1` | [5](#notes) + `.retrunPeriod` |`Double` | `2475` | + `.bins` |`Object` | | [4](#notes) + `.contributorLimit` |`Double` | `0.1` | [5](#notes) __`rate`__ - `.bins` |`Object` | | [6](#notes) + `.bins` |`Object` | | [6](#notes) `.distance` |`Double` | `20` km - `.distributionFormat` |`String` | `INCREMENTAL` | [`DistributionFormat`][url-distribution] + `.distributionFormat` |`String` | `INCREMENTAL` | [`DistributionFormat`][url-distribution] `.timespan` |`Double` | `30` years - `.valueFormat` |`String` | `ANNUAL_RATE` | [`ValueFormat`][url-valueformat] -__`site`__ - `.vs30` |`Double` | `760.0` | [`Site`][url-site] - `.vsInferred` |`Boolean` | `true` - `.z1p0` |`Double` | `null` | [7](#notes) - `.z2p5` |`Double` | `null` | [7](#notes) + `.valueFormat` |`String` | `ANNUAL_RATE` | [`ValueFormat`][url-valueformat] __`output`__ | `.directory` |`String` | `hazout` - `.dataTypes` |`String[]` | `[ TOTAL, MAP ]` | [`DataType`][url-datatype] - `.returnPeriods` |`Integer[]`| `[ 475, 975, 2475 ]` | [`ReturnPeriods`][url-returnperiods] + `.dataTypes` |`String[]` | `[ TOTAL, MAP ]` | [`DataType`][url-datatype] + `.returnPeriods` |`Double[]` | `[ 475, 975, 2475, 10000]` | [`ReturnPeriods`][url-returnperiods] __`performance`__ - `.optimizeGrids` |`Boolean` | `true` | [8](#notes) - `.smoothGrids` |`Boolean` | `true` | [9](#notes) - `.systemPartition` |`Integer` | `1000` | [10](#notes) - `.threadCount` |`String` | `ALL` | [`ThreadCount`][url-sheets] + `.optimizeGrids` |`Boolean` | `true` | [7](#notes) + `.smoothGrids` |`Boolean` | `true` | [8](#notes) + `.systemPartition` |`Integer` | `1000` | [9](#notes) + `.threadCount` |`String` | `ALL` | [`ThreadCount`][url-sheets] [url-exceedance]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/calc/ExceedanceModel.html [url-imt]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/gmm/Imt.html [url-valueformat]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/calc/ValueFormat.html [url-distribution]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/calc/DistributionFormat.html -[url-site]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/calc/Site.html [url-datatype]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/calc/DataType.html [url-returnperiods]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/calc/CalcConfig.Output.html#returnPeriods [url-sheets]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/calc/ThreadCount.html @@ -57,12 +56,11 @@ __`performance`__ 1. `hazard.truncationLevel`: This value is only used if the `hazard.exceedanceModel` requires a limit (e.g. `TRUNCATION_UPPER_ONLY`) -2. `hazard.gmmUncertainty`: If values for additional epistemic uncertainty on ground motion have - been defined, this value en/disables this feature. -3. `hazard.customImls`: Hazard is computed at default intensity measure levels (IMLs) for every +2. `hazard.customImls`: Hazard is computed at default intensity measure levels (IMLs) for every supported intenisty measure type (IMT), but a user can specify different IMLs as needed (see [example 2](../../etc/examples/2-custom-config/README.md) and the table of default IMLs, below). +3. `hazard.gmmDampingRatio` currently has no effect. 4. `disagg.bins`: This field maps to a data container that specifies the following default ranges and intervals for distance, magnitude, and epsilon binning: `"bins": { "rMin": 0.0, "rMax": 1000.0, "Δr": 20.0, "mMin": 4.4, "mMax": 9.4, "Δm": 0.2, "εMin": -3.0, "εMax": 3.0, "Δε": 0.5 }`. @@ -72,14 +70,11 @@ __`performance`__ 6. `rate.bins`: This field maps to a data container that specifies the following default magnitude binning range and interval: `"bins": { "mMin": 4.2, "mMax": 9.4, "Δm": 0.1 }`. The `bins` object must be fully specified; partial overrides do not apply to nested JSON objects. -7. `site.z1p0` and `site.z2p5`: Basin terms may be specified as `null` or `NaN` (both unquoted). - `null` is preferred as `NaN` does not conform to the JSON spec. When trying to override default - values, however, a `null` term will be ignored whereas `NaN` will override any existing value. -8. `performance.optimizeGrids`: Gridded seismicity source optimizations are currently implemented +7. `performance.optimizeGrids`: Gridded seismicity source optimizations are currently implemented for any non-fixed strike grid source. For any site, rates across all azimuths are aggregated in tables of distance and magnitude. -9. `performance.smoothGrids`: Resample gridded seismicity sources close to a site. -10. `performance.systemPartition`: The number of ruptures in a fault-system source to process +8. `performance.smoothGrids`: Resample gridded seismicity sources close to a site. +9. `performance.systemPartition`: The number of ruptures in a fault-system source to process concurrently. ## Default Intensity Measure Levels (IMLs) diff --git a/docs/pages/Site-Specification.md b/docs/pages/Site-Specification.md index 48fddc3be34b76d95173d3f7ba82af7d92ae6bfa..796f52840d83657b61c127979a1108727fa56bcd 100644 --- a/docs/pages/Site-Specification.md +++ b/docs/pages/Site-Specification.md @@ -5,21 +5,12 @@ ways. Examples of the file formats described below are available in the resource [`etc/nshm`](../../etc/nshm/README.md). __Note on Coordinates:__ *nshmp-haz* supports longitude and latitude values in the closed -ranges `[-360° ‥ 360°]` and `[-90° ‥ 90°]`. Note, however, that mixing site and/or source +ranges `[-360° ‥ 360°]` and `[-90° ‥ 90°]`. However, mixing site and/or source coordinates across the antimeridian (the -180° to 180° transition) will yield unexpected results. For Pacific models and calculations, always use positive or negative longitudes exclusively. -## Site String - -For the case of running a single site of interest, most *nshmp-haz* programs accept a -comma-delimited string of the form: `name,lon,lat[,vs30,vsInf[,z1p0,z2p5]]`, where `vs30`, `vsInf`, -`z1p0`, and `z2p5` are optional. Note that if `vs30` is supplied, so too must `vsInf`. Likewise if -`z1p0` is supplied, so too must `z2p5`. If the string contains any spaces, escape them or wrap the -entire string in double quotes. - -For any site parameter values that are not supplied on the command line or in the file formats -below, the following defaults are used (see the `site` member of the -[configuration parameter](./Calculation-Configuration.md#calculation-configuration-parameters) table): +For any site parameter values that are not supplied in the file formats below, the following +defaults are used: ```text name: Unnamed @@ -30,7 +21,7 @@ below, the following defaults are used (see the `site` member of the ``` For basin depth parameters `z1p0` and `z2p5`, a `null` value indicates that a GMM should use -it's 'default' basin depth scale factor. +it's 'default' basin depth scale factor, which is usually included in it's Vs30 site term. ## Comma-Delimited Format (\*.csv) diff --git a/etc/matlab/gmmBatchExample.m b/etc/matlab/gmmBatchExample.m index e61fff510598179fff04eba3900568b3f4c4229e..eadd4d9a276d9a689f20b8662c35243507ebb19f 100644 --- a/etc/matlab/gmmBatchExample.m +++ b/etc/matlab/gmmBatchExample.m @@ -14,11 +14,11 @@ clear; % 90.0, % % For a full list of GMM input paramters see: -% http://usgs.github.io/nshmp-haz/javadoc/gov/usgs/earthquake/nshmp/gmm/GmmInput.html +% https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/gmm/GmmInput.html % % If 'null' is supplied as a value or a GMM input field and values are % not given, the default values are used: -% http://usgs.github.io/nshmp-haz/javadoc/gov/usgs/earthquake/nshmp/gmm/GmmInput.Builder.html#withDefaults-- +% https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/gmm/GmmInput.Builder.html#withDefaults() inputs = fileread('gmm-inputs.csv'); diff --git a/etc/matlab/gmmExample.m b/etc/matlab/gmmExample.m index 609bf1799d8f30c973ae46274a4987aec0f09dea..22cbd36331752982ce832b4e6d7fd45e1caf1376 100644 --- a/etc/matlab/gmmExample.m +++ b/etc/matlab/gmmExample.m @@ -54,11 +54,11 @@ input.z2p5 = NaN; % in km; NaN triggers default basin depth model input.z1p0 = NaN; % in km; NaN triggers default basin depth model % Specify a ground motion model. GMM identifiers: -% http://usgs.github.io/nshmp-haz/javadoc/gov/usgs/earthquake/nshmp/gmm/Gmm.html +% https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/gmm/Gmm.html gmm = 'ASK_14'; % Specify an intensity measure type (IMT). IMT identifiers: -% http://usgs.github.io/nshmp-haz/javadoc/gov/usgs/earthquake/nshmp/gmm/Imt.html +% https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/gmm/Imt.html imt = 'PGA'; % Do a calculation. The MatUtil.calc(gmm, imt, gmmInput) method returns an diff --git a/src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java b/src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java index d2a3fd5c0a9fe29ae0098d071eb1bfa89afabdde..581b40dca6728473e1965fdd02f1bc06070f5b96 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java @@ -54,9 +54,9 @@ public class RateCalc { * argument. * * <p>Please refer to the nshmp-haz <a - * href="https://github.com/usgs/nshmp-haz/wiki">wiki</a> for comprehensive - * descriptions of source models, configuration files, site files, and - * earthquake rate calculations. + * href="https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main/docs">documentation</a> + * for comprehensive descriptions of source models, configuration files, site + * files, and earthquake rate calculations. * * @see <a * href="https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/blob/main/docs/pages/Building-&-Running.md"> diff --git a/src/main/java/gov/usgs/earthquake/nshmp/www/ServletUtil.java b/src/main/java/gov/usgs/earthquake/nshmp/www/ServletUtil.java index 49392833d421739bf6c70c3e50dacb640477e869..f4b7b1e98f8ac64783e6eed698dc7d8b60a64beb 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/www/ServletUtil.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/www/ServletUtil.java @@ -29,8 +29,10 @@ import com.google.gson.JsonSerializer; import gov.usgs.earthquake.nshmp.calc.Site; import gov.usgs.earthquake.nshmp.calc.ValueFormat; +import gov.usgs.earthquake.nshmp.geo.Location; import gov.usgs.earthquake.nshmp.gmm.Imt; import gov.usgs.earthquake.nshmp.model.HazardModel; +import gov.usgs.earthquake.nshmp.model.SiteData; import gov.usgs.earthquake.nshmp.www.meta.MetaUtil; import io.micronaut.context.annotation.Value; @@ -188,6 +190,16 @@ public class ServletUtil { return new Server(threads, timer); } + public static Site createSite(Location location, double vs30, SiteData siteData) { + Site.Builder builder = Site.builder() + .location(location) + .vs30(vs30); + SiteData.Values sdValues = siteData.get(location); + sdValues.z1p0.ifPresent(builder::z1p0); + sdValues.z2p5.ifPresent(builder::z2p5); + return builder.build(); + } + private static class Server { final int threads; diff --git a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java index 04c4b44afe320a329c758bf04ad8d9a9eba7ce32..a4e527bf761e48133bd97b69362b0d5b5591f4c9 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/DisaggService.java @@ -136,14 +136,10 @@ public final class DisaggService { // modify config to include service endpoint arguments CalcConfig config = CalcConfig.copyOf(model.config()) .imts(request.imls.keySet()) - // .dataTypes(request.dataTypes) .build(); - // TODO this needs to pick up SiteData, centralize - Site site = Site.builder() - .location(Location.create(request.longitude, request.latitude)) - .vs30(request.vs30) - .build(); + Location loc = Location.create(request.longitude, request.latitude); + Site site = ServletUtil.createSite(loc, request.vs30, model.siteData()); // use HazardService.calcHazard() instead? CompletableFuture<Hazard> hazFuture = CompletableFuture.supplyAsync( @@ -173,14 +169,10 @@ public final class DisaggService { // modify config to include service endpoint arguments CalcConfig config = CalcConfig.copyOf(model.config()) .imts(request.imts) - // .dataTypes(request.dataTypes) .build(); - // TODO this needs to pick up SiteData, centralize - Site site = Site.builder() - .location(Location.create(request.longitude, request.latitude)) - .vs30(request.vs30) - .build(); + Location loc = Location.create(request.longitude, request.latitude); + Site site = ServletUtil.createSite(loc, request.vs30, model.siteData()); // could just get from HazardService CompletableFuture<Hazard> hazFuture = CompletableFuture.supplyAsync( diff --git a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java index 5f767a08df45b20e4ece904d9edc81ef114caddc..e87db5fef77f5f75b96880e89d03e3b3d49ab003 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/www/hazard/HazardService.java @@ -138,11 +138,8 @@ public final class HazardService { .imts(request.imts) .build(); - // TODO this needs to pick up SiteData, centralize - Site site = Site.builder() - .location(Location.create(request.longitude, request.latitude)) - .vs30(request.vs30) - .build(); + Location loc = Location.create(request.longitude, request.latitude); + Site site = ServletUtil.createSite(loc, request.vs30, model.siteData()); CompletableFuture<Hazard> future = CompletableFuture.supplyAsync( () -> HazardCalcs.hazard(