Skip to content

v0.2.54..v0.2.55 changeset DeriveChangesetReplacementCommand.java

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-services/src/main/java/hoot/services/controllers/grail/DeriveChangesetReplacementCommand.java b/hoot-services/src/main/java/hoot/services/controllers/grail/DeriveChangesetReplacementCommand.java
index d2204f2..3f60d4c 100644
--- a/hoot-services/src/main/java/hoot/services/controllers/grail/DeriveChangesetReplacementCommand.java
+++ b/hoot-services/src/main/java/hoot/services/controllers/grail/DeriveChangesetReplacementCommand.java
@@ -38,8 +38,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 import org.apache.commons.io.FileUtils;
 
@@ -71,13 +69,9 @@ class DeriveChangesetReplacementCommand extends GrailCommand {
 
         List<String> options = new LinkedList<>();
         options.add("api.db.email=" + params.getUser().getEmail());
-
-//        List<String> bounds = Arrays.asList(params.getBounds().split(","));
-//        Double width = Double.valueOf(bounds.get(2)) - Double.valueOf(bounds.get(0));
-//        Double height = Double.valueOf(bounds.get(1)) - Double.valueOf(bounds.get(3));
-//        Double delta = Math.min(width, height);
-//        Integer alpha = adaptiveAlpha(delta);
-//        options.add("cookie.cutter.alpha=" + alpha);
+	options.add("reader.add.source.datetime=false");
+	options.add("writer.include.circular.error.tags=false");
+	options.add("convert.bounding.box.remove.missing.elements=false");
 
         List<String> hootOptions = toHootOptions(options);
 
@@ -99,37 +93,12 @@ class DeriveChangesetReplacementCommand extends GrailCommand {
         substitutionMap.put("OSC_FILE", params.getOutput());
         substitutionMap.put("HOOT_OPTIONS", hootOptions);
         substitutionMap.put("DEBUG_LEVEL", debugLevel);
-        substitutionMap.put("ADV_OPTIONS", String.join(" ", advancedOptions));
+        substitutionMap.put("ADV_OPTIONS", advancedOptions);
+        substitutionMap.put("STATS_FILE", new File(params.getWorkDir(), "stats.json").getPath());
 
-        String command = "hoot changeset-derive-replacement --${DEBUG_LEVEL} -C DeriveChangeset.conf ${HOOT_OPTIONS} ${INPUT1} ${INPUT2} ${BOUNDS} ${OSC_FILE} ${ADV_OPTIONS} --stats";
+        String command = "hoot.bin changeset-derive-replacement --${DEBUG_LEVEL} -C DeriveChangeset.conf ${HOOT_OPTIONS} ${INPUT1} ${INPUT2} ${BOUNDS} ${OSC_FILE} ${ADV_OPTIONS} --stats ${STATS_FILE}";
 
         super.configureCommand(command, substitutionMap, caller);
     }
 
-    public static final Pattern pattern = Pattern.compile("[+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE]([+\\-])?(\\d+))?");
-    /*
-     * returns the power base ten portion of scientific notation for a number
-     * ie. .001 will return -3, while 10 will return 1
-     */
-    public static int exponent(Double d) {
-        int exp = 0;
-        String scinote = String.format("%.3E", d);
-        Matcher matcher = pattern.matcher(scinote);
-        if (matcher.find()) {
-            exp = Integer.parseInt(scinote.split("E")[1]);
-        }
-
-        return exp;
-    }
-
-    /*
-     * returns an adaptive alpha shape based on exent of dataset
-     * (width or height) in decimal degrees
-     */
-    public static int adaptiveAlpha(Double d) {
-        int exp = 5 + exponent(d); //follows table here https://en.wikipedia.org/wiki/Decimal_degrees
-        //to provide an alpha distance one order of magnitude less than the extent of the dataset
-
-        return (int) Math.max(100, Math.pow(10, exp));
-    }
 }
Clone this wiki locally