From a975266d509d8d5abfc7f23e9b3f262e39c1f4f4 Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Thu, 28 Jan 2016 14:15:07 -0700
Subject: [PATCH] readme and example edits

---
 README.md                                     |  2 +-
 etc/examples/4-hazard-map/config.json         | 11 +++-------
 etc/examples/5-complex-model/README.md        | 14 ++++++++++---
 etc/examples/5-complex-model/config-map.json  | 12 +++++++++++
 .../5-complex-model/config-sites.json         | 20 +++++++++++++++++++
 src/org/opensha2/programs/HazardCalc.java     |  7 ++++---
 6 files changed, 51 insertions(+), 15 deletions(-)
 create mode 100644 etc/examples/5-complex-model/config-map.json
 create mode 100644 etc/examples/5-complex-model/config-sites.json

diff --git a/README.md b/README.md
index db3033806..9e8f8132a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 nshmp-haz
 =========
 
-USGS National Seismic Hazard Model Program Codes
+U.S. Geological Survey (USGS) National Seismic Hazard Model Project (NSHMP) codes.
 
 Information relevant to obtaining, building, and running the code may be found in the [wiki](https://github.com/usgs/nshmp-haz/wiki/).
diff --git a/etc/examples/4-hazard-map/config.json b/etc/examples/4-hazard-map/config.json
index 8b06f574d..c81727a86 100644
--- a/etc/examples/4-hazard-map/config.json
+++ b/etc/examples/4-hazard-map/config.json
@@ -2,18 +2,13 @@
   "exceedanceModel": "TRUNCATION_UPPER_ONLY",
   "truncationLevel": 3.0,
   "imts": ["PGA", "SA0P2", "SA1P0"],
-  "customImls": {
-    "PGA":   [0.0050, 0.0070, 0.0098, 0.0137, 0.0192, 0.0269, 0.0376, 0.0527, 0.0738, 0.103, 0.145, 0.203, 0.284, 0.397, 0.556, 0.778, 1.09, 1.52, 2.2, 3.3],
-    "SA0P2": [0.0050, 0.0075, 0.0113, 0.0169, 0.0253, 0.0380, 0.0570, 0.0854, 0.128, 0.192, 0.288, 0.432, 0.649, 0.973, 1.46, 2.19, 3.28, 4.92, 7.38],
-    "SA1P0": [0.0025, 0.00375, 0.00563, 0.00844, 0.0127, 0.0190, 0.0285, 0.0427, 0.0641, 0.0961, 0.144, 0.216, 0.324, 0.487, 0.730, 1.09, 1.64, 2.46, 3.69, 5.54]
-  },
   "sites": {  
     "region": {
-      "name": "Downtown San Francisco",
+      "name": "Bay Area",
       "spacing": 0.1,
       "border": [  
-        [-122.7, 37.5],
-        [-122.2, 38.0]
+        [-123.0, 37.0],
+        [-121.0, 39.0]
       ],
       "vs30": 760,
       "vsInf": true
diff --git a/etc/examples/5-complex-model/README.md b/etc/examples/5-complex-model/README.md
index 567a07e34..68590eb6b 100644
--- a/etc/examples/5-complex-model/README.md
+++ b/etc/examples/5-complex-model/README.md
@@ -8,13 +8,21 @@ Most PSHAs involve the use of more complex source models, the components of whic
 First, clone the 2008 USGS NSHM. Assuming `examples/` is the current working directory, the following will create a copy of the model adjacent to nshmp-haz:
 
 ```Shell
-git clone https://github.com/usgs/nshmp-model-cous-2008.git ../../..
+git clone https://github.com/usgs/nshmp-model-cous-2008.git ../../../nshmp-model-cous-2008
 ```
 
 The 2008 NSHM repository contains two source models: one for the western U.S. and a one for the central and eastern U.S. More complex models make for longer, per-site calculations. To compute hazard for a few sites in the Western U.S., execute:
 
 ```Shell
-hazard ../../../nshmp-model-cous-2008/Western\ US 5-complex-model/config.json
+hazard ../../../nshmp-model-cous-2008/Western\ US 5-complex-model/config-sites.json
 ```
 
-#### Next: [Example 6](../4-enhanced-output)
+More complex models make for longer, per-site calculations. `HazardCalc` will automatically use all cores available and therefore performs better on multi-core systems. To compute a small, low-resolution map for the central San Francisco Bay Area, execute:
+
+```Shell
+hazard ../../../nshmp-model-cous-2008/Western\ US 5-complex-model/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.
+
+#### Next: [Example 6 – Enhanced output](../4-enhanced-output)
diff --git a/etc/examples/5-complex-model/config-map.json b/etc/examples/5-complex-model/config-map.json
new file mode 100644
index 000000000..178352754
--- /dev/null
+++ b/etc/examples/5-complex-model/config-map.json
@@ -0,0 +1,12 @@
+{
+  "sites": {  
+    "region": {
+      "name": "Bay Area",
+      "spacing": 0.2,
+      "border": [  
+        [-123.0, 37.0],
+        [-121.0, 39.0]
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/etc/examples/5-complex-model/config-sites.json b/etc/examples/5-complex-model/config-sites.json
new file mode 100644
index 000000000..c913fccbb
--- /dev/null
+++ b/etc/examples/5-complex-model/config-sites.json
@@ -0,0 +1,20 @@
+{
+  "sites": [
+    {
+    "name": "Los Angeles",
+    "location": [-118.25, 34.05]
+    },
+    {
+    "name": "San Francisco",
+    "location": [-122.40, 37.75]
+    },
+    {
+    "name": "Seattle",
+    "location": [-122.30, 47.60]
+    },
+    {
+    "name": "Salt Lake City",
+    "location": [-111.90, 40.75]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/src/org/opensha2/programs/HazardCalc.java b/src/org/opensha2/programs/HazardCalc.java
index 9b344e739..b59781e02 100644
--- a/src/org/opensha2/programs/HazardCalc.java
+++ b/src/org/opensha2/programs/HazardCalc.java
@@ -176,10 +176,11 @@ public class HazardCalc {
 				OpenOption[] opts = firstBatch ? WRITE_OPTIONS : APPEND_OPTIONS;
 				firstBatch = false;
 				Results.writeResults(out, results, opts);
-				log.info("     batch: " + (count + 1) + "  " + batchWatch + "  total: " +
-					totalWatch);
+				log.info(
+					"     batch: " + (count + 1) + "  " + batchWatch +
+					"  total: " + totalWatch);
 				results.clear();
-				batchWatch.reset();
+				batchWatch.reset().start();
 			}
 
 			count++;
-- 
GitLab