Skip to content
Snippets Groups Projects
Commit 18ae9a9b authored by Altekruse, Jason Morgan's avatar Altekruse, Jason Morgan
Browse files

update exmaples, fix site file extension check

parent 8887cfe2
No related branches found
No related tags found
2 merge requests!577Production Release | nshmp-haz,!558update examples, fix site file extension check
Showing
with 81 additions and 73 deletions
...@@ -14,11 +14,9 @@ testing. See the [PEER directory](../../peer/) for more information. ...@@ -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 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, 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 the calculation configuration was derived from the model directory and the site is defined in
as a comma-delimited string. The string must have the form: file `site.csv`. See the [site specification](https://github.com/usgs/nshmp-haz/wiki/sites)
`name,lon,lat[,vs30,vsInf[,z1p0,z2p5]]`, where `vs30`, `vsInf`, `z1p0`, and `z2p5` page for more details.
are optional. 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) 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) parameters need be supplied; see the [configuration file](../../peer/models/Set1-Case1/config.json)
......
name,lon,lat
Test Site, -122.0, 38.0
...@@ -5,7 +5,7 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/2-custom-config` ...@@ -5,7 +5,7 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/2-custom-config`
Navigate to the directory above and execute the following: Navigate to the directory above and execute the following:
```Shell ```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: In this example we've overridden the configuration supplied by the model. Specifically:
......
name,lon,lat
San Francisco, -122.40, 37.75
...@@ -19,9 +19,6 @@ The [site specification](https://github.com/usgs/nshmp-haz/wiki/sites) ...@@ -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, 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. 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:__ __Results directory structure:__
```text ```text
......
...@@ -4,8 +4,8 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/4-hazard-map` ...@@ -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. 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, 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) a [GeoJSON site file](https://github.com/usgs/nshmp-haz/wiki/sites#geojson-format-geojson)
may instead specify a polygon and a site spacing. may instead specify a polygon and a site spacing.
```Shell ```Shell
hazard ../../peer/models/Set1-Case1 map.geojson config.json hazard ../../peer/models/Set1-Case1 map.geojson config.json
......
...@@ -4,30 +4,33 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/5-complex-model` ...@@ -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 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 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 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: memory available to Java when calling `HazardCalc`. For example, set your alias to:
```Shell ```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 This will increase the minimum amount of memory Java requires to 4GB and will allow it to claim
up to 4GB, assuming that much is available. up to 8GB, assuming that much is available.
First, clone the 2008 USGS NSHM. Assuming you are in the current working directory (above), the First, clone the USGS CONUS NSHM repository and checkout the 2018 CONUS NSHM tag. Assuming you
following will create a copy of the model adjacent to nshmp-haz: are in the current working directory (above), the following will create a copy of the model
adjacent to nshmp-haz:
```Shell ```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 TODO: checkout tag for nshm-conus-2018 release (current 5.1.0 tag does not load)
central and eastern U.S. To compute hazard for a few sites in the Western U.S. at 1.0s and 2.0s
To compute hazard for a few sites in the Western U.S. at 1.0s and 2.0s
spectral periods, execute: spectral periods, execute:
```Shell ```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 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 ...@@ -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: To compute a small, low-resolution map for the central San Francisco bay area, execute:
```Shell ```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 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 might take. This small coarse map may take 10 minutes to complete. Note that in the above two
config files for each calculation. examples we specified different output directories in the config files for each calculation.
__Results directory structure:__ __Results directory structure:__
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
"imts": ["SA1P0", "SA2P0"] "imts": ["SA1P0", "SA2P0"]
}, },
"output": { "output": {
"directory": "hazout-sites", "directory": "hazout-sites"
"flushLimit": 1
} }
} }
...@@ -4,25 +4,26 @@ __Working directory:__ `/path/to/nshmp-haz/etc/examples/6-enhanced-output` ...@@ -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 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 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 ```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) The config file for this example, `config.json`, specified `GMM` and `SOURCE` as
file for this example specified `GMM` and `SOURCE` as [output data types][output_types]. Note that the output curves directory now contains additional
[output data types](https://github.com/usgs/nshmp-haz/wiki/configuration#calculation-configuration-parameters). directories of curves by source type and GMM.
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.
See the `nshmp-haz` wiki and Javacocs for more information on source types [output_types]: ../../../docs/pages/Calculation-Configuration.md#calculation-configuration
([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)) See the `nshmp-haz` wiki and javadocs for more information on source types ([Wiki][source_wiki],
and GMMs ([Wiki](https://github.com/usgs/nshmp-haz/wiki/ground-motion-models), [JavaDoc][source_javadoc]) and GMMs ([Wiki][gmm_wiki], [JavaDoc][gmm_javadoc]).
[JavaDoc](http://usgs.github.io/nshmp-haz/javadoc/index.html?gov/usgs/earthquake/nshmp/gmm/Gmm.html)).
[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:__ __Results directory structure:__
...@@ -32,19 +33,25 @@ __Results directory structure:__ ...@@ -32,19 +33,25 @@ __Results directory structure:__
├─ config.json ├─ config.json
├─ HazardCalc.log ├─ HazardCalc.log
├─ PGA/ ├─ PGA/
│ ├─ curves-truncated.csv
│ ├─ curves.csv │ ├─ curves.csv
│ ├─ map.csv
│ ├─ gmm/ │ ├─ gmm/
│ │ ├─ AB_03_CASCADIA_SLAB/ │ │ ├─ AM_09_INTERFACE_BASIN/
│ │ │ └─ curves.csv │ │ │ ├─ curves.csv
│ │ │ └─ map.csv
│ │ ├─ ... │ │ ├─ ...
│ │ └─ ZHAO_06_INTERFACE/ │ │ └─ ZHAO_06_SLAB_BASIN/
│ │ └─ curves.csv │ │ ├─ curves.csv
│ │ └─ map.csv
│ └─ source/ │ └─ source/
│ ├─ FAULT/ │ ├─ FAULT/
│ │ └─ curves.csv │ │ ├─ curves.csv
│ │ └─ map.csv
│ ├─ ... │ ├─ ...
│ └─ SLAB/ │ └─ SLAB/
│ └─ curves.csv │ ├─ curves.csv
│ └─ map.csv
├─ SA0P2/ ├─ SA0P2/
│ └─ ... │ └─ ...
└─ SA1P0/ └─ SA1P0/
......
{ {
"hazard": {
"imts": ["PGA", "SA0P1", "SA0P5", "SA1P0", "SA2P0"]
},
"output": { "output": {
"dataTypes": ["TOTAL", "GMM", "SOURCE"], "dataTypes": ["TOTAL", "GMM", "SOURCE"]
"flushLimit": 1
} }
} }
...@@ -8,25 +8,21 @@ file of distance, magnitude, and epsilon bins, and a text file of summary statis ...@@ -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: contributing sources. For this, it can be helpful to create a second system alias:
```Shell ```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 `DeaggCalc` is similar to `HazardCalc` in every way except that the return-period of interest
must be specified. For example, execute: must be specified. For example, execute:
```Shell ```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. 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 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) [config](../../../docs/pages/Calculation-Configuration.md#calculation-configuration)
file for this example) additional deaggregation results for each GMM are generated as well. file for this example) additional deaggregation results for each GMM are generated as well.
Deaggregations by individual `SOURCE` type are also possible. 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).
__Results directory structure:__ __Results directory structure:__
...@@ -36,8 +32,9 @@ __Results directory structure:__ ...@@ -36,8 +32,9 @@ __Results directory structure:__
├─ config.json ├─ config.json
├─ DeaggCalc.log ├─ DeaggCalc.log
├─ PGA/ ├─ PGA/
│ ├─ curves-truncated.csv
│ ├─ curves.csv │ ├─ curves.csv
│ ├─ deagg/ │ ├─ disagg/
│ │ ├─ Los Angeles CA/ │ │ ├─ Los Angeles CA/
│ │ │ ├─ data.csv │ │ │ ├─ data.csv
│ │ │ └─ summary.txt │ │ │ └─ summary.txt
...@@ -51,9 +48,9 @@ __Results directory structure:__ ...@@ -51,9 +48,9 @@ __Results directory structure:__
│ │ ├─ data.csv │ │ ├─ data.csv
│ │ └─ summary.txt │ │ └─ summary.txt
│ └─ gmm/ │ └─ gmm/
│ ├─ AB_03_CASCADIA_SLAB/ │ ├─ AM_09_INTERFACE_BASIN/
│ │ ├─ curves.csv │ │ ├─ curves.csv
│ │ └─ deagg/ │ │ └─ disagg/
│ │ ├─ San Francisco CA/ │ │ ├─ San Francisco CA/
│ │ │ ├─ data.csv │ │ │ ├─ data.csv
│ │ │ └─ summary.txt │ │ │ └─ summary.txt
...@@ -61,7 +58,7 @@ __Results directory structure:__ ...@@ -61,7 +58,7 @@ __Results directory structure:__
│ │ ├─ data.csv │ │ ├─ data.csv
│ │ └─ summary.txt │ │ └─ summary.txt
│ ├─ ... │ ├─ ...
│ ├─ CB_08/ │ ├─ CB_14_BASIN/
│ │ ├─ curves.csv │ │ ├─ curves.csv
│ │ └─ deagg/ │ │ └─ deagg/
│ │ ├─ Los Angeles CA/ │ │ ├─ Los Angeles CA/
...@@ -77,14 +74,13 @@ __Results directory structure:__ ...@@ -77,14 +74,13 @@ __Results directory structure:__
│ │ ├─ data.csv │ │ ├─ data.csv
│ │ └─ summary.txt │ │ └─ summary.txt
│ └─ ... │ └─ ...
├─ SA0P2/ ├─ SA0P1/
│ └─ ... │ └─ ...
└─ SA1P0/ └─ ...
└─ ...
``` ```
Note that in the output above, there are only deaggregation results for 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. empty results will not be saved.
<!-- markdownlint-disable MD001 --> <!-- markdownlint-disable MD001 -->
......
{ {
"hazard": {
"imts": ["PGA", "SA0P1", "SA0P5", "SA1P0", "SA2P0"]
},
"output": { "output": {
"dataTypes": ["TOTAL", "GMM"], "dataTypes": ["TOTAL", "GMM"]
"flushLimit": 1
} }
} }
...@@ -13,19 +13,19 @@ all sources should be included, and a `timespan` used for conversion to Poisson ...@@ -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: For this example, the following system alias is helpful:
```Shell ```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 ```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 to generate incremental, annual-rate output for a list of sites, or
```Shell ```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). to generate a map of cumulative Poisson probabilities (i.e. P ≥ M).
......
...@@ -143,7 +143,7 @@ public class HazardCalc { ...@@ -143,7 +143,7 @@ public class HazardCalc {
Path path = Paths.get(arg); Path path = Paths.get(arg);
log.info("Sites file: " + path.toAbsolutePath().normalize()); log.info("Sites file: " + path.toAbsolutePath().normalize());
String fname = arg.toLowerCase(); 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); "Sites file [%s] must be a path to a *.csv or *.geojson file", arg);
try { try {
......
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