Skip to content

Building & Running

Peter Powers edited this page Dec 2, 2016 · 23 revisions

Building and running nshmp-haz programs requires:

  1. Prior installation of Java, Ant, and Git
  2. Setting the JAVA_HOME, ANT_HOME, and PATH environment variables.

See this page for system configuration guidance.

Building

Navigate to a location on your system where you want nshmp-haz code to reside and clone the repository:

git clone https://github.com/usgs/nshmp-haz.git

To build nshmp-haz, navigate to the root of the repository and issue the following command: ant, which automatically reads the build.xml file.

This creates a single dist/nshmp-haz.jar with no dependencies for use in hazard calculations.

Computing Hazard

The HazardCalc program computes hazard curves at one or more sites for a variety of intensity measures. Computing hazard curves requires at least 2, and at most 3, arguments. For example:

java -cp nshmp-haz.jar org.opensha2.HazardCalc model sites [config]

At a minimum, the source model and the site(s) at which to perform calculations must be specified. The source model should be specified as a path to a directory or zip file. A single site may be specified with a string; multiple sites must be specified using either a comma-delimited or GeoJSON file. Under the 2-argument scenario, model initialization and calculation configuration settings are drawn from the configuration file that must reside at the root of the model directory. Alternatively, the path to a custom configuration file may also be supplied as a third argument. It can be used to override any calculation settings, but not model initialization settings.

See the examples directory for more details.

Matlab Access

Another convenient way to use the nshmp-haz library is via Matlab. A sample script contains the necessary instructions.

Clone this wiki locally