diff --git a/etc/examples/1-hazard-curve/README.md b/etc/examples/1-hazard-curve/README.md index ed8da976693fdf3b5a0cf561651a8f1efaa79b35..6891e5968155a05c4e77ae30a9f7286efcf21571 100644 --- a/etc/examples/1-hazard-curve/README.md +++ b/etc/examples/1-hazard-curve/README.md @@ -14,11 +14,9 @@ testing. See the [PEER directory](../../peer/) for more information. The result of this calculation should be available as a single comma-delimited file containing several total mean hazard curves for PGA in a newly created `hazout` directory. In this example, - the calculation configuration was derived from the model directory and the site was specified - as a comma-delimited string. The string must have the form: - `name,lon,lat[,vs30,vsInf[,z1p0,z2p5]]`, where `vs30`, `vsInf`, `z1p0`, and `z2p5` - are optional. See the [site specification](https://github.com/usgs/nshmp-haz/wiki/sites) - page for more details. +the calculation configuration was derived from the model directory and the site is defined in +file `site.csv`. See the [site specification](https://github.com/usgs/nshmp-haz/wiki/sites) +page for more details. Note that not all [calculation configuration](https://github.com/usgs/nshmp-haz/wiki/Configuration) parameters need be supplied; see the [configuration file](../../peer/models/Set1-Case1/config.json) diff --git a/etc/examples/1-hazard-curve/site.csv b/etc/examples/1-hazard-curve/site.csv new file mode 100644 index 0000000000000000000000000000000000000000..3eb309c0a0b37ab58057d996bea031f7ead61273 --- /dev/null +++ b/etc/examples/1-hazard-curve/site.csv @@ -0,0 +1,2 @@ +name,lon,lat +Test Site, -122.0, 38.0 diff --git a/etc/examples/2-custom-config/README.md b/etc/examples/2-custom-config/README.md index 33c8c381aa8b47f57fbff49085da83b6d064fd7b..ca5163209413c937d88b172a5215c677a1899f2c 100644 --- a/etc/examples/2-custom-config/README.md +++ b/etc/examples/2-custom-config/README.md @@ -5,7 +5,7 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/2-custom-config` Navigate to the directory above and execute the following: ```Shell -hazard ../../peer/models/Set1-Case1 "San Francisco, -122.40, 37.75" config.json +hazard ../../peer/models/Set1-Case1 site.csv config.json ``` In this example we've overridden the configuration supplied by the model. Specifically: diff --git a/etc/examples/2-custom-config/site.csv b/etc/examples/2-custom-config/site.csv new file mode 100644 index 0000000000000000000000000000000000000000..e2bca493abcc930c0e3ec1edffe778fda85363ec --- /dev/null +++ b/etc/examples/2-custom-config/site.csv @@ -0,0 +1,2 @@ +name,lon,lat +San Francisco, -122.40, 37.75 diff --git a/etc/examples/3-sites-file/README.md b/etc/examples/3-sites-file/README.md index f70f356a496a5177fdbae1418bcdc53b144ab576..65aa2ba681db02df0ac2a9c789f6851e3b8b8657 100644 --- a/etc/examples/3-sites-file/README.md +++ b/etc/examples/3-sites-file/README.md @@ -19,9 +19,6 @@ The [site specification](https://github.com/usgs/nshmp-haz/wiki/sites) wiki page provides details on the two file formats. Note that with either format, if the name of a site is supplied, it will be included in the first column of any output curve files. -Note that both formats ([CSV](sites.csv) and [GeoJSON](sites.geojson)) are elegantly -rendered by GitHub. - __Results directory structure:__ ```text diff --git a/etc/examples/4-hazard-map/README.md b/etc/examples/4-hazard-map/README.md index 0c26c4102630b610eba586085ff2cd66b96b7110..023b1f6be12eaecd95d21675573d96cabc8a4ba8 100644 --- a/etc/examples/4-hazard-map/README.md +++ b/etc/examples/4-hazard-map/README.md @@ -4,8 +4,8 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/4-hazard-map` A hazard map is just a collection of values plucked from a lot of hazard curves. To compute curves at reqularly spaced intervals in latitude and longitude over a region, - a [GeoJSON site file](https://github.com/usgs/nshmp-haz/wiki/sites#geojson-format-geojson) - may instead specify a polygon and a site spacing. +a [GeoJSON site file](https://github.com/usgs/nshmp-haz/wiki/sites#geojson-format-geojson) +may instead specify a polygon and a site spacing. ```Shell hazard ../../peer/models/Set1-Case1 map.geojson config.json diff --git a/etc/examples/5-complex-model/README.md b/etc/examples/5-complex-model/README.md index 79f7b17b1dbbb340077ff22e5e16c755461cd98d..67bd53ae3eb03a622a4bfcd2c5ab58cffce73a5b 100644 --- a/etc/examples/5-complex-model/README.md +++ b/etc/examples/5-complex-model/README.md @@ -4,30 +4,33 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/5-complex-model` Most PSHAs involve the use of more complex source models, the components of which might use different ground motion models. For this and ensuing examples, we'll use the -2008 USGS National Seismic Hazard Model (NSHM) for the western U.S. `nshmp-haz` uses an +2018 USGS National Seismic Hazard Model (NSHM) for the western U.S. `nshmp-haz` uses an in-memory source model. The USGS NSHMs are quite large, so it's helpful to increase the amount memory available to Java when calling `HazardCalc`. For example, set your alias to: ```Shell -alias hazard='java -Xms1g -Xmx4g -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.HazardCalc' +alias hazard='java -Xms4g -Xmx8g -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.HazardCalc' ``` -This will increase the minimum amount of memory Java requires to 1GB and will allow it to claim -up to 4GB, assuming that much is available. +This will increase the minimum amount of memory Java requires to 4GB and will allow it to claim +up to 8GB, assuming that much is available. -First, clone the 2008 USGS NSHM. Assuming you are in the current working directory (above), the -following will create a copy of the model adjacent to nshmp-haz: +First, clone the USGS CONUS NSHM repository and checkout the 2018 CONUS NSHM tag. Assuming you +are in the current working directory (above), the following will create a copy of the model +adjacent to nshmp-haz: ```Shell -git clone https://github.com/usgs/nshm-cous-2008.git ../../../../nshm-cous-2008 +git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus.git ../../../../nshm-conus +# git checkout tags/5.1.0 -b 2018_CONUS_NSHM ``` -The 2008 NSHM repository contains two source models: one for the western U.S. and a one for the -central and eastern U.S. To compute hazard for a few sites in the Western U.S. at 1.0s and 2.0s +TODO: checkout tag for nshm-conus-2018 release (current 5.1.0 tag does not load) + +To compute hazard for a few sites in the Western U.S. at 1.0s and 2.0s spectral periods, execute: ```Shell -hazard ../../../../nshm-cous-2008/Western\ US sites.geojson config-sites.json +hazard ../../../../nshm-conus sites.geojson config-sites.json ``` Note that more complex models take longer to initialize, although this only occurs once per @@ -37,12 +40,12 @@ use all cores available by default and therefore performs better on multi-core s To compute a small, low-resolution map for the central San Francisco bay area, execute: ```Shell -hazard ../../../../nshm-cous-2008/Western\ US map.geojson config-map.json +hazard ../../../../nshm-conus map.geojson config-map.json ``` This computes 121 curves over a 2° by 2° area and will give you a sense of how long a larger map -might take. Note that in the above two examples we specified different output directories in the -config files for each calculation. +might take. This small coarse map may take 10 minutes to complete. Note that in the above two +examples we specified different output directories in the config files for each calculation. __Results directory structure:__ diff --git a/etc/examples/5-complex-model/config-sites.json b/etc/examples/5-complex-model/config-sites.json index 31a32a602930367f4392fe3ace4ea1e025c643d9..a11af3bf61eb2895d2cb02e23ef02b342e9166fa 100644 --- a/etc/examples/5-complex-model/config-sites.json +++ b/etc/examples/5-complex-model/config-sites.json @@ -3,7 +3,6 @@ "imts": ["SA1P0", "SA2P0"] }, "output": { - "directory": "hazout-sites", - "flushLimit": 1 + "directory": "hazout-sites" } } diff --git a/etc/examples/6-enhanced-output/README.md b/etc/examples/6-enhanced-output/README.md index 61fffb7a1390f0e5893c6db546127f08cfb27335..92fb486d7901b187284ea0cab64fe7574e389049 100644 --- a/etc/examples/6-enhanced-output/README.md +++ b/etc/examples/6-enhanced-output/README.md @@ -4,25 +4,26 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/6-enhanced-output` While mean hazard is of broad interest, it can be useful to preserve individual components of a total curve, particularly with more complex models. Execute the following to write curves for -each source type and ground motion model (GMM) used in the 2008 NSHM: +each source type and ground motion model (GMM) used in the 2018 NSHM (cloned in the previous +example): ```Shell -hazard ../../../../nshm-cous-2008/Western\ US sites.geojson config.json +hazard ../../../../nshm-conus sites.geojson config.json ``` -The [config](https://github.com/usgs/nshmp-haz/blob/master/etc/examples/6-enhanced-output/config.json) -file for this example specified `GMM` and `SOURCE` as -[output data types](https://github.com/usgs/nshmp-haz/wiki/configuration#calculation-configuration-parameters). - Note that the output curves directory now contains additional directories of curves by source - type and GMM. We also specified an - [output flush limit](https://github.com/usgs/nshmp-haz/wiki/configuration#calculation-configuration-parameters) - of `1`. Doing so gives feedback on how long it takes each site calculation to run on a particular system. +The config file for this example, `config.json`, specified `GMM` and `SOURCE` as +[output data types][output_types]. Note that the output curves directory now contains additional +directories of curves by source type and GMM. -See the `nshmp-haz` wiki and Javacocs for more information on source types -([Wiki](https://github.com/usgs/nshmp-haz/wiki/source-types), -[JavaDoc](http://usgs.github.io/nshmp-haz/javadoc/index.html?gov/usgs/earthquake/nshmp/eq/model/SourceType.html)) - and GMMs ([Wiki](https://github.com/usgs/nshmp-haz/wiki/ground-motion-models), - [JavaDoc](http://usgs.github.io/nshmp-haz/javadoc/index.html?gov/usgs/earthquake/nshmp/gmm/Gmm.html)). +[output_types]: ../../../docs/pages/Calculation-Configuration.md#calculation-configuration + +See the `nshmp-haz` wiki and javadocs for more information on source types ([Wiki][source_wiki], +[JavaDoc][source_javadoc]) and GMMs ([Wiki][gmm_wiki], [JavaDoc][gmm_javadoc]). + +[source_wiki]: ../../../docs/pages/Source-Types.md +[source_javadoc]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/model/SourceType.html +[gmm_wiki]: ./../../docs/pages/Ground-Motion-Models.md +[gmm_javadoc]: https://earthquake.usgs.gov/nshmp/docs/nshmp-lib/gov/usgs/earthquake/nshmp/gmm/package-summary.html __Results directory structure:__ @@ -32,19 +33,25 @@ __Results directory structure:__ ├─ config.json ├─ HazardCalc.log ├─ PGA/ + │ ├─ curves-truncated.csv │ ├─ curves.csv + │ ├─ map.csv │ ├─ gmm/ - │ │ ├─ AB_03_CASCADIA_SLAB/ - │ │ │ └─ curves.csv + │ │ ├─ AM_09_INTERFACE_BASIN/ + │ │ │ ├─ curves.csv + │ │ │ └─ map.csv │ │ ├─ ... - │ │ └─ ZHAO_06_INTERFACE/ - │ │ └─ curves.csv + │ │ └─ ZHAO_06_SLAB_BASIN/ + │ │ ├─ curves.csv + │ │ └─ map.csv │ └─ source/ │ ├─ FAULT/ - │ │ └─ curves.csv + │ │ ├─ curves.csv + │ │ └─ map.csv │ ├─ ... │ └─ SLAB/ - │ └─ curves.csv + │ ├─ curves.csv + │ └─ map.csv ├─ SA0P2/ │ └─ ... └─ SA1P0/ diff --git a/etc/examples/6-enhanced-output/config.json b/etc/examples/6-enhanced-output/config.json index 1023392b357b71b62837d33b37fc609d3eb3f3a3..9ebae3bb03bef893a2345445464eb4fc3d61429f 100644 --- a/etc/examples/6-enhanced-output/config.json +++ b/etc/examples/6-enhanced-output/config.json @@ -1,6 +1,8 @@ { + "hazard": { + "imts": ["PGA", "SA0P1", "SA0P5", "SA1P0", "SA2P0"] + }, "output": { - "dataTypes": ["TOTAL", "GMM", "SOURCE"], - "flushLimit": 1 + "dataTypes": ["TOTAL", "GMM", "SOURCE"] } } diff --git a/etc/examples/7-deaggregation/README.md b/etc/examples/7-deaggregation/README.md index 4750f2affa3c64fe660c3b4c543d2c4bbeb78ea2..734901617d79d44d51ff27dc11b7a4b1a0c6bb88 100644 --- a/etc/examples/7-deaggregation/README.md +++ b/etc/examples/7-deaggregation/README.md @@ -8,25 +8,21 @@ file of distance, magnitude, and epsilon bins, and a text file of summary statis contributing sources. For this, it can be helpful to create a second system alias: ```Shell -alias deagg='java -Xms1g -Xmx4g -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.DeaggCalc' +alias deagg='java -Xms4g -Xmx8g -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.DeaggCalc' ``` `DeaggCalc` is similar to `HazardCalc` in every way except that the return-period of interest must be specified. For example, execute: ```Shell -deagg ../../../../nshm-cous-2008/Western\ US sites.geojson 2475 config.json +deagg ../../../../nshm-conus sites.geojson 2475 config.json ``` The results of the deaggregation are saved along with hazard curves in `deagg` directories. - As with `HazardCalc`, if the `GMM` ddata type has been specified (as it has in the - [config](https://github.com/usgs/nshmp-haz/blob/master/etc/examples/7-deaggregation/config.json) - file for this example) additional deaggregation results for each GMM are generated as well. - Deaggregations by individual `SOURCE` type are also possible. - -See the following pages for more information on -[deaggregation](https://github.com/usgs/nshmp-haz/wiki/about-deaggregation) -and the meaning of [epsilon](https://github.com/usgs/nshmp-haz/wiki/what-is-epsilon%3F). +As with `HazardCalc`, if the `GMM` ddata type has been specified (as it has in the +[config](../../../docs/pages/Calculation-Configuration.md#calculation-configuration) +file for this example) additional deaggregation results for each GMM are generated as well. +Deaggregations by individual `SOURCE` type are also possible. __Results directory structure:__ @@ -36,8 +32,9 @@ __Results directory structure:__ ├─ config.json ├─ DeaggCalc.log ├─ PGA/ + │ ├─ curves-truncated.csv │ ├─ curves.csv - │ ├─ deagg/ + │ ├─ disagg/ │ │ ├─ Los Angeles CA/ │ │ │ ├─ data.csv │ │ │ └─ summary.txt @@ -51,9 +48,9 @@ __Results directory structure:__ │ │ ├─ data.csv │ │ └─ summary.txt │ └─ gmm/ - │ ├─ AB_03_CASCADIA_SLAB/ + │ ├─ AM_09_INTERFACE_BASIN/ │ │ ├─ curves.csv - │ │ └─ deagg/ + │ │ └─ disagg/ │ │ ├─ San Francisco CA/ │ │ │ ├─ data.csv │ │ │ └─ summary.txt @@ -61,7 +58,7 @@ __Results directory structure:__ │ │ ├─ data.csv │ │ └─ summary.txt │ ├─ ... - │ ├─ CB_08/ + │ ├─ CB_14_BASIN/ │ │ ├─ curves.csv │ │ └─ deagg/ │ │ ├─ Los Angeles CA/ @@ -77,14 +74,13 @@ __Results directory structure:__ │ │ ├─ data.csv │ │ └─ summary.txt │ └─ ... - ├─ SA0P2/ + ├─ SA0P1/ │ └─ ... - └─ SA1P0/ - └─ ... + └─ ... ``` Note that in the output above, there are only deaggregation results for -subduction GMMs (e.g. `AB_03_CASCADIA_SLAB`) for sites closer to the Cascadia subduction zone; +subduction GMMs (e.g. `AM_09_INTERFACE_BASIN`) for sites closer to the Cascadia subduction zone; empty results will not be saved. <!-- markdownlint-disable MD001 --> diff --git a/etc/examples/7-deaggregation/config.json b/etc/examples/7-deaggregation/config.json index e7d35261718b6cdec91e5b0593cad3b6d31582ca..4ca4727af09a69c94e45e8652d8ff679ec87669f 100644 --- a/etc/examples/7-deaggregation/config.json +++ b/etc/examples/7-deaggregation/config.json @@ -1,6 +1,8 @@ { + "hazard": { + "imts": ["PGA", "SA0P1", "SA0P5", "SA1P0", "SA2P0"] + }, "output": { - "dataTypes": ["TOTAL", "GMM"], - "flushLimit": 1 + "dataTypes": ["TOTAL", "GMM"] } } diff --git a/etc/examples/8-probabilities/README.md b/etc/examples/8-probabilities/README.md index 38f3b7a6de77668a70c3187a5cdd9354b8d1f5eb..c8586fbee54525f8e7674d665cf27fec01a92f50 100644 --- a/etc/examples/8-probabilities/README.md +++ b/etc/examples/8-probabilities/README.md @@ -13,19 +13,19 @@ all sources should be included, and a `timespan` used for conversion to Poisson For this example, the following system alias is helpful: ```Shell -alias rate='java -Xms1g -Xmx4g -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.RateCalc' +alias rate='java -Xms4g -Xmx8g -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.RateCalc' ``` -Assuming a copy of the 2008 USGS NSHM is available (see [Example 5](../5-complex-model)), execute: +Assuming a copy of the 2018 USGS NSHM is available (see [Example 5](../5-complex-model)), execute: ```Shell -rate ../../../../nshm-cous-2008/Western\ US sites.csv config-sites.json +rate ../../../../nshm-conus sites.csv config-sites.json ``` to generate incremental, annual-rate output for a list of sites, or ```Shell -rate ../../../../nshm-cous-2008/Western\ US map.geojson config-map.json +rate ../../../../nshm-conus map.geojson config-map.json ``` to generate a map of cumulative Poisson probabilities (i.e. P ≥ M). diff --git a/src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java b/src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java index c3c0270c0dd693c03434f917ef8eeb6757357e3a..6e1e8ce9e133d361dfe9aaea66777a35c5846cb4 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java @@ -143,7 +143,7 @@ public class HazardCalc { Path path = Paths.get(arg); log.info("Sites file: " + path.toAbsolutePath().normalize()); String fname = arg.toLowerCase(); - checkArgument(fname.endsWith(".csv") || fname.endsWith(".json"), + checkArgument(fname.endsWith(".csv") || fname.endsWith(".geojson"), "Sites file [%s] must be a path to a *.csv or *.geojson file", arg); try {