Skip to content
Snippets Groups Projects
README.md 3.5 KiB
Newer Older
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
# Example 5: A more complex model
Powers, Peter M.'s avatar
Powers, Peter M. committed

__Working directory:__ `/path/to/nshmp-haz/etc/examples/5-complex-model`
Powers, Peter M.'s avatar
Powers, Peter M. committed

Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
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
USGS National Seismic Hazard Model (NSHM) for the Conterminous U.S (CONUS). `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:
alias hazard='java -Xms4g -Xmx8g -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.HazardCalc'
Powers, Peter M.'s avatar
Powers, Peter M. committed

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, download the
[CONUS NSHM version 5.2.0](https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus/-/archive/5.2.0/nshm-conus-5.2.0.zip)
and unzip adjacent to nshmp-haz. Note that in subsequent examples, the name of the model
should match the unzipped directory name (e.g. `../../../../nshm-conus-5.2.0`).

Alternatively, clone the CONUS NSHM repository. The `main` branch is under active development and
may break some of the examples, so you need to checkout a stable version of the NSHM. Assuming you
are in the current working directory (above), the following will create a copy of the model
adjacent to nshmp-haz and checkout version 5.2.0. See [CONTRIBUTING.md](../../../CONTRIBUTING.md)
for more information about contributing to nshmp-haz or nshm-conus.
Powers, Peter M.'s avatar
Powers, Peter M. committed

```Shell
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus.git ../../../../nshm-conus
cd ../../../../nshm-conus
git fetch origin refs/tags/5.2.0
git checkout -b ver-5.2.0 5.2.0
cd ../nshmp-haz/etc/examples/5-complex-model
Powers, Peter M.'s avatar
Powers, Peter M. committed
```

To compute hazard for a few sites at 1.0s and 2.0s spectral periods, execute:
Powers, Peter M.'s avatar
Powers, Peter M. committed

```Shell
hazard ../../../../nshm-conus sites.geojson config-sites.json
Powers, Peter M.'s avatar
Powers, Peter M. committed
```

Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
Note that more complex models take longer to initialize, although this only occurs once per
calculation, and make for longer, per-site calculations. However, `HazardCalc` will automatically
use all cores available by default and therefore performs better on multi-core systems.

To compute a small, low-resolution map for the central San Francisco bay area, execute:
hazard ../../../../nshm-conus map.geojson config-map.json
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
This computes 121 curves over a 2° by 2° area and will give you a sense of how long a larger map
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:__
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed

```text
5-complex-model/
  ├─ hazout-sites/
Powers, Peter M.'s avatar
Powers, Peter M. committed
  │   ├─ calc-config.json
  │   ├─ HazardCalc.log
  │   ├─ SA1P0/
Powers, Peter M.'s avatar
Powers, Peter M. committed
  │   │   ├─ curves.csv
  │   │   ├─ curves-truncated.csv
  │   │   └─ map.csv
  │   └─ SA2P0/
Powers, Peter M.'s avatar
Powers, Peter M. committed
  │       ├─ curves.csv
  │       ├─ curves-truncated.csv
  │       └─ map.csv

  └─ hazout-map/
Powers, Peter M.'s avatar
Powers, Peter M. committed
      ├─ calc-config.json
      ├─ HazardCalc.log
      ├─ SA1P0/
Powers, Peter M.'s avatar
Powers, Peter M. committed
      │   ├─ curves.csv
      │   ├─ curves-truncated.csv
      │   └─ map.csv
Powers, Peter M.'s avatar
Powers, Peter M. committed
          ├─ curves.csv
          ├─ curves-truncated.csv
          └─ map.csv
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
<!-- markdownlint-disable MD001 -->
#### Next: [Example 6 – Enhanced output](../6-enhanced-output/README.md)
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
* [__Documentation Index__](../../../docs/README.md)