Displaying differences for changeset
 
display as  

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

@@ -63,6 +63,7 @@
     private static final int DEFAULT_MOISTURE_CONTENT = 25;
     private static final double DEFAULT_SLOPE_LENGTH_1 = 50.0;
     private static final double DEFAULT_SLOPE_LENGTH_2 = 164.04;
+    private static final double DEFAULT_MINIMUM_SLOPE_STEEPNESS = 0.01;
     
     private AoA aoa;
     private String parameterFileName;
@@ -87,7 +88,7 @@
         String climatestationId = parameters.getString("climatestationid");
         String soilTexture = parameters.getString("soiltexture");
         String slopeShape = parameters.getString("slopeshape");
-        double slopeSteepness = parameters.getDouble("slopesteepness", 0.0);
+        double slopeSteepness = parameters.getDouble("slopesteepness", DEFAULT_MINIMUM_SLOPE_STEEPNESS);
         double bunchGgrassCanopyCover = parameters.getDouble("bunchgrasscanopycover", 0.0);
         double forbsCanopyCover = parameters.getDouble("forbscanopycover", 0.0);
         double shrubsCanopyCover = parameters.getDouble("shrubscanopycover", 0.0);
@@ -97,7 +98,8 @@
         double litterCover = parameters.getDouble("littercover", 0.0);
         double cryptogamsCover = parameters.getDouble("cryptogamscover", 0.0);
 
-        //Validations
+        ///////////////////////////////
+        //  BEGIN  Validations of input 
         //The values allowed for the field unit in the request are 1 and 2. 1 is for metric units and 2 is for English units
         double slopeLength;
         switch (unit) {
@@ -114,6 +116,14 @@
                 throw new ServiceException("Unit should be 1-metric or 2-English. The value, " + unit + ", is not valid.");
         }
 
+        if ( slopeSteepness <= 0.0 ){
+            throw new ServiceException("The slopesteepness input parameter must be greater than 0.");
+        }
+        //
+        //  END Validations
+        ///////////////////////////////
+        
+        
         aoa = new AoA(aoaId, rhemSiteId, scenarioName,
                 scenarioDescription, unit, stateId, climatestationId,
                 soilTexture, slopeLength, slopeShape, slopeSteepness,