Displaying differences for changeset
 
display as  

src/java/m/rhem/model/Parameter.java

@@ -74,7 +74,7 @@
 
 
   public Parameter(AoA aoa) throws ServiceException {
-    if (null != aoa) {
+    if (aoa != null) {
       this.cv = "1.00";
       this.sat = "0.25;";
       this.komega = "0.000007747";

src/java/m/rhem/model/RhemModel.java

@@ -228,4 +228,26 @@
     return stateId.toLowerCase().startsWith("intl_");
   }
 
+
+  public double getYearlyPrecipIntl() throws Exception {
+    File sf = new File(workSpaceDir, stormFileName);
+    try (BufferedReader r = new BufferedReader(new FileReader(sf))) {
+      String line;
+      while ((line = r.readLine()) != null) {
+        if (line.contains("Observed monthly ave precipitation (mm)")) {
+          line = r.readLine();
+          String v[] = line.trim().split("\\s+");
+          if (v.length != 12) {
+            throw new ServiceException("cannot find monthly ave precip in " + sf.toString());
+          }
+          double sum = 0.0;
+          for (int i = 0; i < v.length; i++) {
+            sum += Double.parseDouble(v[i]);
+          }
+          return sum;
+        }
+      }
+    }
+    throw new ServiceException("cannot find monthly ave precip in " + sf.toString());
+  }
 }

src/java/m/rhem/rhem01_runmodel/V1_0.java

@@ -132,7 +132,8 @@
     if (slopeSteepness <= 0.0) {
       throw new ServiceException("The slopesteepness input parameter must be greater than 0.");
     }
-    //
+    
+    
     //  END Validations
     ///////////////////////////////
 
@@ -146,7 +147,7 @@
 
 
   @Override
-  public void doProcess() throws ServiceException, URISyntaxException {
+  public void doProcess() throws Exception {
     SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd, YYYY, hh:mm a");
     String today = sdf.format(new Date());
 
@@ -155,6 +156,7 @@
       fileName = fileName.substring(0, 15);
     }
     fileName = fileName.replace(' ', '_');
+
     parameterFileName = "scenario_input_" + fileName + ".par";
     stormFileName = "storm_input_" + fileName + ".pre";
     summaryFileName = "scenario_output_summary_" + fileName + ".sum";
@@ -184,15 +186,19 @@
 
     //If the run is successful then edit the summary file.
     double avgYearlyPrecip = 0;
-    try (Connection connection = resources().getJDBC(DBResources.CRDB);
-        Statement statement = connection.createStatement();) {
-      try (ResultSet rs = statement.executeQuery(DBQueries.RHEM01Query02(aoa.getClimateStationId()))) {
-        while (rs.next()) {
-          avgYearlyPrecip = rs.getDouble("avg_yearly_precip_mm");
+    if (rhemModel.isIntl()) {
+      avgYearlyPrecip = rhemModel.getYearlyPrecipIntl();
+    } else {
+      try (Connection connection = resources().getJDBC(DBResources.CRDB);
+          Statement statement = connection.createStatement();) {
+        try (ResultSet rs = statement.executeQuery(DBQueries.RHEM01Query02(aoa.getClimateStationId()))) {
+          while (rs.next()) {
+            avgYearlyPrecip = rs.getDouble("avg_yearly_precip_mm");
+          }
         }
+      } catch (SQLException e) {
+        throw new ServiceException(e);
       }
-    } catch (SQLException e) {
-      throw new ServiceException(e);
     }
     rhemModel.appendToSumFile(avgYearlyPrecip);
   }
@@ -210,28 +216,26 @@
 
   @Override
   public void postProcess() {
-    PayloadResults results = results();
-
-    results.put("AoAID", aoa.getAoaId(), "Area of Analysis Identifier");
-    results.put("rhem_site_id", aoa.getRhemSiteId(), "RHEM Evaluation Site Identifier");
-    results.put("CLEN", parameter.getClen(), "characteristic length of hillsope");
-    results.put("UNITS", (unit == 1) ? "metric" : "English", "unit of measure, metric or English");
-    results.put("DIAMS", parameter.getDiams(), "list of representative soil particle diameters for up to 5 particle classes");
-    results.put("DENSITY", parameter.getDensity(), "list of densities corresponding to the DIAMS particle classes");
-    results.put("CHEZY", parameter.getChezy(), "overland flow Chezy coefficient");
-    results.put("RCHEZY", parameter.getRchezy(), "concentrated flow Chezy coefficient");
-    results.put("SL", parameter.getSl(), "slope expressed as fractional rise/run");
-    results.put("SX", parameter.getSx(), "normalized distance");
-    results.put("KSS", parameter.getKss(), "splash and sheet erodibility coefficient");
-    results.put("KE", parameter.getKe(), "effective hydraulic conductivity");
-    results.put("G", parameter.getG(), "mean capillary drive");
-    results.put("DIST", parameter.getDist(), "pore size distribution index");
-    results.put("POR", parameter.getPor(), "porosity");
-    results.put("FRACT", parameter.getFract(), "list of particle class fractions");
-    results.put("TDS", rhemModel.getTDS(), "total dissolved solids");
-    results.put(getWorkspaceFile(parameterFileName), "Parameter input file");
-    results.put(getWorkspaceFile(stormFileName), "Storm input file");
-    results.put(getWorkspaceFile(summaryFileName), "Summary file");
-    results.put(getWorkspaceFile(detailedOutputFileName), "Detailed summary file");
+    results().put("AoAID", aoa.getAoaId(), "Area of Analysis Identifier");
+    results().put("rhem_site_id", aoa.getRhemSiteId(), "RHEM Evaluation Site Identifier");
+    results().put("CLEN", parameter.getClen(), "characteristic length of hillsope");
+    results().put("UNITS", (unit == 1) ? "metric" : "English", "unit of measure, metric or English");
+    results().put("DIAMS", parameter.getDiams(), "list of representative soil particle diameters for up to 5 particle classes");
+    results().put("DENSITY", parameter.getDensity(), "list of densities corresponding to the DIAMS particle classes");
+    results().put("CHEZY", parameter.getChezy(), "overland flow Chezy coefficient");
+    results().put("RCHEZY", parameter.getRchezy(), "concentrated flow Chezy coefficient");
+    results().put("SL", parameter.getSl(), "slope expressed as fractional rise/run");
+    results().put("SX", parameter.getSx(), "normalized distance");
+    results().put("KSS", parameter.getKss(), "splash and sheet erodibility coefficient");
+    results().put("KE", parameter.getKe(), "effective hydraulic conductivity");
+    results().put("G", parameter.getG(), "mean capillary drive");
+    results().put("DIST", parameter.getDist(), "pore size distribution index");
+    results().put("POR", parameter.getPor(), "porosity");
+    results().put("FRACT", parameter.getFract(), "list of particle class fractions");
+    results().put("TDS", rhemModel.getTDS(), "total dissolved solids");
+    results().put(getWorkspaceFile(parameterFileName), "Parameter input file");
+    results().put(getWorkspaceFile(stormFileName), "Storm input file");
+    results().put(getWorkspaceFile(summaryFileName), "Summary file");
+    results().put(getWorkspaceFile(detailedOutputFileName), "Detailed summary file");
   }
 }

src/java/m/rhem/rhem07_editparfile/V1_0.java

@@ -103,7 +103,7 @@
 
 
   @Override
-  public void doProcess() throws ServiceException, URISyntaxException {
+  public void doProcess() throws Exception {
 
     SimpleDateFormat sdf = new SimpleDateFormat("MMMM dd, YYYY, hh:mm a");
     Date now = new Date();

web/WEB-INF/csip-defaults.json

@@ -1,5 +1,5 @@
 {  
-    "csip.context.version": "$version: 2.1.2 default 176 bdcaf0b18354 2020-07-17 od, built at 2020-07-17 17:18 by od$",
+    "csip.context.version": "$version: 2.1.4 default 178 959e11daee59 2020-07-17 od, built at 2020-07-20 14:34 by od$",
     "csip.archive.max.filesize": "1KB",
     "esd.db": "jdbc:sqlserver://129.82.20.129:1433;databaseName=esd;user=sa;password=csurams#1",
     "crdb.db": "jdbc:sqlserver://129.82.20.129:1433;databaseName=conservation_resources;user=sa;password=csurams#1",