From e270ecfa1222c09359a683529803f5fc23b389b8 Mon Sep 17 00:00:00 2001 From: Peter Powers <pmpowers@usgs.gov> Date: Fri, 25 Mar 2016 14:00:49 -0600 Subject: [PATCH] minor build update --- .gitignore | 1 + build.xml | 50 +++++++++++++++----------- etc/examples/2-custom-config/README.md | 2 +- src/org/opensha2/HazardCalc.java | 13 ++++--- src/org/opensha2/calc/Site.java | 2 +- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index d27f7d99d..999181937 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ /tmp curves*/ Scratch*.java +nshmp-haz-log* /src/META-INF diff --git a/build.xml b/build.xml index cbc260939..deda1ed3b 100644 --- a/build.xml +++ b/build.xml @@ -11,8 +11,8 @@ <property name="dist.dir" value="dist/" /> <property name="javadoc.dir" value="../nshmp-haz.gh-pages/javadoc" /> - <defaultexcludes add="**/Scratch*.java"/> - + <defaultexcludes add="**/Scratch*.java" /> + <path id="library.classpath"> <fileset dir="${lib.dir}"> <include name="**/*.jar" /> @@ -42,7 +42,7 @@ destdir="${classes.dir}" classpathref="library.classpath" nowarn="true" - fork="true" + fork="true" source="1.7" target="1.7" encoding="UTF-8" @@ -57,15 +57,14 @@ </copy> </target> - + <target name="compile-tests"> - + </target> <target name="javadoc"> - <defaultexcludes echo="true"/> <!-- Clean the docs directory; .git data preserved by defaultexcludes --> <delete includeEmptyDirs="true" failonerror="yes" verbose="no"> <fileset dir="${javadoc.dir}" /> @@ -82,25 +81,36 @@ verbose="false" encoding="UTF-8" docencoding="UTF-8" - charset="UTF-8"> + charset="UTF-8" + additionalparam="-notimestamp"> <fileset dir="${src.dir}"> <include name="**/*.java" /> </fileset> - <link href="http://docs.oracle.com/javase/7/docs/api/" /> - <link href="http://commons.apache.org/proper/commons-math/apidocs/" /> - <link href="http://google.github.io/guava/releases/19.0/api/docs/" /> - <link href="http://google.github.io/gson/apidocs/" /> - - </javadoc> - - <!-- Copy images --> - <copy todir="${javadoc.dir}/resources"> - <fileset dir="etc/resources/docs" includes="*.jpg" /> - </copy> - - </target> + <bottom> + <![CDATA[ + <div style="float: right; font-size: 14px; padding: 4px;"> + <span style="font-weight: bold;">U.S. Geological Survey</span> + – National Seicmic Hazard Mapping Project + (<a href="https://github.com/usgs/nshmp-haz" target="_top">NSHMP</a>) + </div> + ]]> + </bottom> + + <link href="http://docs.oracle.com/javase/7/docs/api/" /> + <link href="http://commons.apache.org/proper/commons-math/apidocs/" /> + <link href="http://google.github.io/guava/releases/19.0/api/docs/" /> + <link href="http://google.github.io/gson/apidocs/" /> + + </javadoc> + + <!-- Copy images --> + <copy todir="${javadoc.dir}/resources"> + <fileset dir="etc/resources/docs" includes="*.jpg" /> + </copy> + +</target> </project> diff --git a/etc/examples/2-custom-config/README.md b/etc/examples/2-custom-config/README.md index 10b3a22ac..f7920c20c 100644 --- a/etc/examples/2-custom-config/README.md +++ b/etc/examples/2-custom-config/README.md @@ -6,7 +6,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 "San Francisco, -122.40, 37.75" config.json ``` In this example we've overridden the configuration supplied by the model. Specifically: diff --git a/src/org/opensha2/HazardCalc.java b/src/org/opensha2/HazardCalc.java index 4a0b3528f..35856b85b 100644 --- a/src/org/opensha2/HazardCalc.java +++ b/src/org/opensha2/HazardCalc.java @@ -107,8 +107,9 @@ public class HazardCalc { } log.info(config.toString()); - Iterable<Site> sites = readSites(args[1]); + log.info(""); + Iterable<Site> sites = readSites(args[1], log); log.info("Sites: " + sites); Path out = calc(model, config, sites, log); @@ -132,13 +133,17 @@ public class HazardCalc { } } - static Iterable<Site> readSites(String arg) { + private static Iterable<Site> readSites(String arg, Logger log) { try { if (arg.toLowerCase().endsWith(".csv")) { - return Sites.fromCsv(Paths.get(arg)); + Path path = Paths.get(arg); + log.info("Site file: " + path.toAbsolutePath().normalize()); + return Sites.fromCsv(path); } if (arg.toLowerCase().endsWith(".geojson")) { - return Sites.fromJson(Paths.get(arg)); + Path path = Paths.get(arg); + log.info("Site file: " + path.toAbsolutePath().normalize()); + return Sites.fromJson(path); } return Sites.fromString(arg); } catch (Exception e) { diff --git a/src/org/opensha2/calc/Site.java b/src/org/opensha2/calc/Site.java index 1fb8ba1f3..ddcfe9e09 100644 --- a/src/org/opensha2/calc/Site.java +++ b/src/org/opensha2/calc/Site.java @@ -125,7 +125,7 @@ public class Site implements Named { @Override public String toString() { - return new StringBuilder(Strings.padEnd(name, 20, ' ')) + return new StringBuilder(Strings.padEnd(name, 28, ' ')) .append(String.format("%.3f %.3f Vs30=%s ", location.lon(), location.lat(), vs30)) .append(vsInferred ? "inferred " : "measured ") .append(String.format("Z1.0=%s Z2.5=%s", z1p0, z2p5)) -- GitLab