Displaying differences for changeset
 
display as  

src/java/m/rhem/rhem01_runmodel/V2_0.java

@@ -70,7 +70,7 @@
 
   double[] latlon;
 
-  ModelDataServiceCall res;
+  ModelDataServiceCall cli;
 
 
   @Override
@@ -141,8 +141,7 @@
     detailedOutputFileName = "scenario_output_summary_" + fileName + ".out";
     runFileName = fileName + ".run";
 
-    Parallel.run(
-        () -> {
+    Parallel.run(() -> {
           try (Connection con = resources().getJDBC(DBResources.CRDB)) {
             parameter.computeParameters(con, aoa);
           }
@@ -153,7 +152,7 @@
           rhemModel.generateRunFile();
         },
         () -> {
-          res = fetchClimate(stormFileName);
+          cli = fetchClimate(stormFileName);
         }
     );
 
@@ -229,12 +228,12 @@
     double asl = new TextParser(sumFile).toLineContaining("Avg-Soil-Loss").rightOfFirst("=").asDouble();
     results().put("TDS", Double.parseDouble(rhemModel.getTDS(asl)), "total dissolved solids");
 
-    results().put("cli_station_id", res.getInt("stationId", 0));
-    results().put("cli_station_name", res.getString("name", "?"));
-    results().put("cli_station_state", res.getInt("state"));
-    results().put("cli_station_elevation", res.getDouble("elevation"));
-    results().put("cli_station_lon", res.getDouble("stationX"));
-    results().put("cli_station_lat", res.getDouble("stationY"));
+    results().put("cli_station_id", cli.getInt("stationId", 0));
+    results().put("cli_station_name", cli.getString("name", "?"));
+    results().put("cli_station_state", cli.getInt("state"));
+    results().put("cli_station_elevation", cli.getDouble("elevation"));
+    results().put("cli_station_lon", cli.getDouble("stationX"));
+    results().put("cli_station_lat", cli.getDouble("stationY"));
 
     TextParser e = new TextParser(workspace().getFile(stormFileName));
     double[] mavg = e.toLineContaining("ave precipitation").nextLine().tokens().asDoubleArray();

src/java/m/rhem/rhem01_runmodel/V2_1.java

@@ -69,7 +69,7 @@
 
   double[] latlon;
 
-  ModelDataServiceCall res;
+  ModelDataServiceCall cli;
 
 
   @Override
@@ -135,8 +135,7 @@
     detailedOutputFileName = "scenario_output_summary_" + fileName + ".out";
     runFileName = fileName + ".run";
 
-    Parallel.run(
-        () -> {
+    Parallel.run(() -> {
           try (Connection con = resources().getJDBC(DBResources.CRDB)) {
             parameter.computeParameters(con, aoa);
           }
@@ -147,7 +146,7 @@
           rhemModel.generateRunFile();
         },
         () -> {
-          res = fetchClimate(stormFileName);
+          cli = fetchClimate(stormFileName);
         }
     );
 
@@ -156,7 +155,7 @@
 
 
   private ModelDataServiceCall fetchClimate(String stormfileName) throws JSONException, Exception {
-    ModelDataServiceCall res = new ModelDataServiceCall()
+    ModelDataServiceCall mdsc = new ModelDataServiceCall()
         .put("duration", 300)
         .put("outputFile", CLIGEN_TXT)
         .put("usePRISM", true)
@@ -179,13 +178,13 @@
         .withDefaultLogger()
         .call();
 
-    if (res.serviceFinished()) {
-      res.download(CLIGEN_TXT, workspace().getFile(stormfileName));
-      res.download(CLIGEN_RECORD_PAR, workspace().getFile(CLIGEN_RECORD_PAR));
-      res.download(CLIGEN_RECORD_PRISM_PAR, workspace().getFile(CLIGEN_RECORD_PRISM_PAR));
-      return res;
+    if (mdsc.serviceFinished()) {
+      mdsc.download(CLIGEN_TXT, workspace().getFile(stormfileName));
+      mdsc.download(CLIGEN_RECORD_PAR, workspace().getFile(CLIGEN_RECORD_PAR));
+      mdsc.download(CLIGEN_RECORD_PRISM_PAR, workspace().getFile(CLIGEN_RECORD_PRISM_PAR));
+      return mdsc;
     } else {
-      throw new ServiceException("Climate service error: " + res.getError());
+      throw new ServiceException("Climate service error: " + mdsc.getError());
     }
   }
 
@@ -196,7 +195,6 @@
     int run = rh.exec();
     if (run != 0) 
       throw new ServiceException("Error running rhem: " + run);
-    
   }
 
 
@@ -230,11 +228,11 @@
     double asl = new TextParser(sumFile).toLineContaining("Avg-Soil-Loss").rightOfFirst("=").asDouble();
     results().put("tds", Double.parseDouble(rhemModel.getTDS(asl)), "total dissolved solids");
 
-    results().put("cli_station_id", res.getInt("stationId", 0));
-    results().put("cli_station_name", res.getString("name", "?"));
-    results().put("cli_station_state", res.getInt("state"));
-    results().put("cli_station_elevation", res.getDouble("elevation"));
-    results().put("cli_station_location", new double[]{res.getDouble("stationY"), res.getDouble("stationX")}, "station location (lat,lon)");
+    results().put("cli_station_id", cli.getInt("stationId", 0));
+    results().put("cli_station_name", cli.getString("name", "?"));
+    results().put("cli_station_state", cli.getInt("state"));
+    results().put("cli_station_elevation", cli.getDouble("elevation"));
+    results().put("cli_station_location", new double[]{cli.getDouble("stationY"), cli.getDouble("stationX")}, "station location (lat,lon)");
 
 //  Observed monthly ave precipitation (mm)
 //   24.9  18.9  16.4   8.0   5.6  14.0  65.6  79.6  38.8  24.2  16.6  27.1