src/java/m/hydrotools/efh2/V1_0.json
@@ -1,42 +1,42 @@ |
{ |
- "metainfo": {}, |
- "parameter": [ |
- { |
- "name": "precip", |
- "description": "precip", |
- "unit": "inch", |
- "min": "1", |
- "max": "15", |
- "value": 14 |
- }, |
- { |
- "name": "runoffcurvenumber", |
- "description": "runoffcurvenumber", |
- "unit": "", |
- "min": "40", |
- "max": "95", |
- "value": 90 |
- }, |
- { |
- "name": "stormtype", |
- "description": "stormtype", |
- "value": "I" |
- }, |
- { |
- "name": "watershedlength", |
- "description": "watershedlength", |
- "unit": "foot", |
- "min": "200", |
- "max": "26000", |
- "value": 1500 |
- }, |
- { |
- "name": "watershedslope", |
- "description": "watershedslope", |
- "unit": "%", |
- "min": "0.1", |
- "max": "64", |
- "value": 0.5 |
- } |
- ] |
+ "metainfo": {}, |
+ "parameter": [ |
+ { |
+ "name": "precip", |
+ "description": "precip", |
+ "unit": "inch", |
+ "min": "1", |
+ "max": "15", |
+ "value": 14 |
+ }, |
+ { |
+ "name": "runoffcurvenumber", |
+ "description": "runoffcurvenumber", |
+ "unit": "", |
+ "min": "40", |
+ "max": "95", |
+ "value": 90 |
+ }, |
+ { |
+ "name": "stormtype", |
+ "description": "stormtype", |
+ "value": "I" |
+ }, |
+ { |
+ "name": "watershedlength", |
+ "description": "watershedlength", |
+ "unit": "foot", |
+ "min": "200", |
+ "max": "26000", |
+ "value": 1500 |
+ }, |
+ { |
+ "name": "watershedslope", |
+ "description": "watershedslope", |
+ "unit": "%", |
+ "min": "0.1", |
+ "max": "64", |
+ "value": 0.5 |
+ } |
+ ] |
} |
\ No newline at end of file |
src/java/m/hydrotools/efh2/V2_0.java
@@ -6,13 +6,13 @@ |
package m.hydrotools.efh2; |
|
import csip.Executable; |
+import csip.ModelDataService; |
import csip.annotations.*; |
import static csip.annotations.ResourceType.EXECUTABLE; |
import java.io.File; |
import java.io.FileWriter; |
import java.io.IOException; |
import java.io.Writer; |
-import java.util.Arrays; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
@@ -33,7 +33,7 @@ |
@Path("m/efh2/2.0") |
@Resource(file = "/bin/lin-amd64/TR20.exe", type = EXECUTABLE, id = "tr20") |
@Polling(first = 10000, next = 2000) |
-public class V2_0 extends csip.ModelDataService { |
+public class V2_0 extends ModelDataService { |
|
// parameter |
static final String WATERSHED_NAME = "watershed_name"; |
@@ -56,7 +56,7 @@ |
String st_name; |
String toc; |
|
- static String format = "%-10.3f"; |
+ static final String format = "%-10.3f"; |
|
|
@Override |
@@ -175,11 +175,11 @@ |
props.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); |
|
VelocityContext context = new VelocityContext(inp); |
- Writer writer = new FileWriter(file); |
- VelocityEngine ve = new VelocityEngine(); |
- ve.init(props); |
- ve.getTemplate("m/hydrotools/efh2/V2_0_input.vm").merge(context, writer); |
- writer.close(); |
+ try (Writer writer = new FileWriter(file)) { |
+ VelocityEngine ve = new VelocityEngine(); |
+ ve.init(props); |
+ ve.getTemplate("m/hydrotools/efh2/V2_0_input.vm").merge(context, writer); |
+ } |
} |
|
|
src/java/m/hydrotools/efh2/V2_0.json
@@ -1,57 +1,48 @@ |
{ |
- "metainfo": { |
- "tr20_version": "3.10 tag:May062014" |
- }, |
- "parameter": [ |
- { |
+ "metainfo": {}, |
+ "parameter": [{ |
"name": "watershed_name", |
- "description": "watershed name", |
- "value": "test olaf" |
- }, |
- { |
+ "description": "Watershed Name", |
+ "value": "WebRun" |
+ }, { |
"name": "drainage_area", |
- "description": "Drainage area", |
- "value": "1", |
- "min" : 1, |
- "max" : 2000 |
- }, |
- { |
+ "description": "Drainage Area", |
+ "min": "1", |
+ "max": "2000", |
+ "value": "0.01" |
+ }, { |
"name": "curve_number", |
"description": "Curve Number", |
- "value": "80", |
- "min" : 30, |
- "max" : 100 |
- }, |
- { |
+ "min": "30", |
+ "max": "100", |
+ "value": "72" |
+ }, { |
"name": "watershed_slope", |
"description": "Watershed Slope", |
- "value": "3", |
- "min" : 0.5, |
- "max" : 64 |
- }, |
- { |
+ "unit": "percent", |
+ "min": "0.5", |
+ "max": "64", |
+ "value": "8" |
+ }, { |
"name": "watershed_length", |
"description": "Watershed Length", |
- "value": "6000", |
- "min" : 200, |
- "max" : 26000 |
- }, |
- { |
+ "min": "200", |
+ "max": "26000", |
+ "value": "2500" |
+ }, { |
"name": "storm_name", |
- "description": "Storm name", |
- "value": "storm1" |
- }, |
- { |
+ "description": "Storm Name", |
+ "value": "Storm1" |
+ }, { |
"name": "rain_depth", |
- "description": "Rain depth", |
- "value": "5", |
- "min" : 0, |
- "max" : 26 |
- }, |
- { |
+ "description": "Rain Depth", |
+ "unit": "in", |
+ "min": "0", |
+ "max": "26", |
+ "value": "4.45" |
+ }, { |
"name": "rain_dist", |
"description": "Rainfall distribution type", |
- "value": "TYPE NO_D" |
- } |
- ] |
+ "value": "Type NR_B" |
+ }] |
} |
\ No newline at end of file |