@@ -214,10 +214,10 @@ |
JSONArray aStripBarrierSystems = new JSONArray(r2run.getResultPyromeArray("STRIP_BARRIER_SYS", true, true)); |
results.put(JSONUtils.data(KEY_STRIP_BARRIER_SYSTEMS, aStripBarrierSystems)); |
} |
- if (JSONUtils.checkKeyExistsB(getParamMap(), KEY_CONTOURSYSTEMS)) { |
- JSONArray aContourSystems = new JSONArray(r2run.getResultPyromeArray("CONTOUR_SYS", true, true)); |
- results.put(JSONUtils.data(KEY_CONTOURSYSTEMS, aContourSystems)); |
- } |
+// if (JSONUtils.checkKeyExistsB(getParamMap(), KEY_CONTOURSYSTEMS)) { |
+// JSONArray aContourSystems = new JSONArray(r2run.getResultPyromeArray("CONTOUR_SYS", true, true)); |
+// results.put(JSONUtils.data(KEY_CONTOURSYSTEMS, aContourSystems)); |
+// } |
} |
} else { |
results.put(JSONUtils.data(KEY_CLIMATES, climate)); |
@@ -264,44 +264,37 @@ |
// soilPtr = Integer.toString(aSoils.getInt(i)); |
} |
|
- JSONArray diversions = new JSONArray(); |
- JSONArray contoursytems = new JSONArray(); |
- JSONArray stripBarrrierSystems = new JSONArray(); |
+ //JSONArray diversions = new JSONArray(); |
+ //JSONArray contoursytems = new JSONArray(); |
+ //JSONArray stripBarrrierSystems = new JSONArray(); |
|
// scalar variables for non-segmented runs |
String contourSystem = ""; |
String stripBarrierSystem = ""; |
String hydElemSystem = ""; |
- // Retrieve contourSystem, stripBarrierSystem, hydElemSystem elements: |
- if (JSONUtils.checkKeyExistsB(param, KEY_TOPO_LENGTH)) { // for slope segments |
- if (JSONUtils.checkKeyExistsB(param, KEY_DIVERSIONS)) { |
- diversions = JSONUtils.getJSONArrayParam(param, KEY_DIVERSIONS); |
- } |
- if (JSONUtils.checkKeyExistsB(param, KEY_CONTOURSYSTEMS)) { |
- contoursytems = JSONUtils.getJSONArrayParam(param, KEY_CONTOURSYSTEMS); |
- } |
- if (JSONUtils.checkKeyExistsB(param, KEY_STRIP_BARRIER_SYSTEMS)) { |
- stripBarrrierSystems = JSONUtils.getJSONArrayParam(param, KEY_STRIP_BARRIER_SYSTEMS); |
- } |
- } else { // for single slope segment |
- if (JSONUtils.checkKeyExistsB(param, KEY_CONTOUR_SYSTEM_PTR)) { |
- contourSystem = JSONUtils.getStringParam(param, KEY_CONTOUR_SYSTEM_PTR, ""); |
- } |
- if (JSONUtils.checkKeyExistsB(param, KEY_STRIP_BARRIER_SYSTEM_PTR)) { |
- stripBarrierSystem = JSONUtils.getStringParam(param, KEY_STRIP_BARRIER_SYSTEM_PTR, ""); |
- } |
- if (JSONUtils.checkKeyExistsB(param, KEY_HYD_ELEM_SYSTEM_PTR)) { |
- hydElemSystem = JSONUtils.getStringParam(param, KEY_HYD_ELEM_SYSTEM_PTR, ""); |
- } |
+ |
+ // Get the Contour System if not default |
+ if (JSONUtils.checkKeyExistsB(param, KEY_CONTOUR_SYSTEM_PTR)) { |
+ contourSystem = JSONUtils.getStringParam(param, KEY_CONTOUR_SYSTEM_PTR, ""); |
} |
|
+ // Get the Strip Barrier System |
+ if (JSONUtils.checkKeyExistsB(param, KEY_STRIP_BARRIER_SYSTEM_PTR)) { |
+ stripBarrierSystem = JSONUtils.getStringParam(param, KEY_STRIP_BARRIER_SYSTEM_PTR, ""); |
+ } |
+ |
+ // Get the Hydraylic Element System Pointer |
+ if (JSONUtils.checkKeyExistsB(param, KEY_HYD_ELEM_SYSTEM_PTR)) { |
+ hydElemSystem = JSONUtils.getStringParam(param, KEY_HYD_ELEM_SYSTEM_PTR, ""); |
+ } |
+ |
JSONArray aTopoLength = new JSONArray(); |
JSONArray aTopoSteepness = new JSONArray(); |
JSONArray aSoilIdx = new JSONArray(); |
JSONArray aManIdx = new JSONArray(); |
- JSONArray aDiversionIdx = new JSONArray(); |
- JSONArray aContourIdx = new JSONArray(); |
- JSONArray aStripBarrierIdx = new JSONArray(); |
+// JSONArray aDiversionIdx = new JSONArray(); |
+// JSONArray aContourIdx = new JSONArray(); |
+// JSONArray aStripBarrierIdx = new JSONArray(); |
if (JSONUtils.checkKeyExistsB(param, KEY_TOPO_LENGTH)) { |
aTopoLength = JSONUtils.getJSONArrayParam(param, KEY_TOPO_LENGTH); |
for (int i = 0; i < aTopoLength.length(); i++) { |
@@ -341,24 +334,26 @@ |
} |
} |
|
- if (JSONUtils.checkKeyExistsB(param, KEY_DIVERSION_INDEX)) { |
- aDiversionIdx = JSONUtils.getJSONArrayParam(param, KEY_DIVERSION_INDEX); |
- for (int i = 0; i < aDiversionIdx.length(); i++) { |
- LOG.info("Diversion Index [" + i + "]=" + aDiversionIdx.getInt(i)); |
- } |
- } |
- if (JSONUtils.checkKeyExistsB(param, KEY_CONTOUR_INDEX)) { |
- aContourIdx = JSONUtils.getJSONArrayParam(param, KEY_CONTOUR_INDEX); |
- for (int i = 0; i < aContourIdx.length(); i++) { |
- LOG.info("Contour Index [" + i + "]=" + aContourIdx.getInt(i)); |
- } |
- } |
- if (JSONUtils.checkKeyExistsB(param, KEY_STRIP_BARRIER_INDEX)) { |
- aStripBarrierIdx = JSONUtils.getJSONArrayParam(param, KEY_STRIP_BARRIER_INDEX); |
- for (int i = 0; i < aStripBarrierIdx.length(); i++) { |
- LOG.info("Strip Barrier Index [" + i + "]=" + aStripBarrierIdx.getInt(i)); |
- } |
- } |
+// if (JSONUtils.checkKeyExistsB(param, KEY_DIVERSION_INDEX)) { |
+// aDiversionIdx = JSONUtils.getJSONArrayParam(param, KEY_DIVERSION_INDEX); |
+// for (int i = 0; i < aDiversionIdx.length(); i++) { |
+// LOG.info("Diversion Index [" + i + "]=" + aDiversionIdx.getInt(i)); |
+// } |
+// } |
+ |
+// if (JSONUtils.checkKeyExistsB(param, KEY_CONTOUR_INDEX)) { |
+// aContourIdx = JSONUtils.getJSONArrayParam(param, KEY_CONTOUR_INDEX); |
+// for (int i = 0; i < aContourIdx.length(); i++) { |
+// LOG.info("Contour Index [" + i + "]=" + aContourIdx.getInt(i)); |
+// } |
+// } |
+ |
+// if (JSONUtils.checkKeyExistsB(param, KEY_STRIP_BARRIER_INDEX)) { |
+// aStripBarrierIdx = JSONUtils.getJSONArrayParam(param, KEY_STRIP_BARRIER_INDEX); |
+// for (int i = 0; i < aStripBarrierIdx.length(); i++) { |
+// LOG.info("Strip Barrier Index [" + i + "]=" + aStripBarrierIdx.getInt(i)); |
+// } |
+// } |
|
if (JSONUtils.checkKeyExistsB(param, KEY_TOPO_LENGTH)) { |
if (!allEqual(aTopoLength.length(), aTopoSteepness.length(), aSoilIdx.length(), aManIdx.length())) { |
@@ -524,14 +519,14 @@ |
text += (i == aManIdx.length() - 1) ? "]\n" : ","; |
} |
fos.write(text.getBytes()); |
- if ((aDiversionIdx != null) && (aDiversionIdx.length() > 0)) { |
- text = " diversionIndex=["; |
- for (int i = 0; i < aDiversionIdx.length(); i++) { |
- text += aDiversionIdx.getInt(i) + ""; |
- text += (i == aDiversionIdx.length() - 1) ? "]\n" : ","; |
- } |
- fos.write(text.getBytes()); |
- } |
+// if ((aDiversionIdx != null) && (aDiversionIdx.length() > 0)) { |
+// text = " diversionIndex=["; |
+// for (int i = 0; i < aDiversionIdx.length(); i++) { |
+// text += aDiversionIdx.getInt(i) + ""; |
+// text += (i == aDiversionIdx.length() - 1) ? "]\n" : ","; |
+// } |
+// fos.write(text.getBytes()); |
+// } |
|
} else { |
String text = " slopes=['" + steepness + "']\n"; |
@@ -553,45 +548,71 @@ |
String text = " soil" + i + " = RomeFilesOpen(files, '#XML:soils_file" + i + ".xml',0)\n"; |
fos.write(text.getBytes()); |
} |
+ |
if ((contourSystem != null) && (contourSystem.length() > 1)) { |
- fos.write(" contour = RomeFilesOpen(files, '#XML:contour_file0.xml',0)\n".getBytes()); |
- String text = " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', 'contour-systems\\\\aaa', 0)\n"; |
+ // Contour Systems can simply point to the nginx XML file - no need to prefetch because of no special |
+ // characters in the file name |
+ String text = " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', '" + contourSystem + "', 0)\n"; |
fos.write(text.getBytes()); |
} |
|
+ // To prevent issues with pyrome converting special chars in filenames to invalid chars for web server retrieval, |
+ // we prefetch the file, insert a dummy name, and point to it here |
if ((stripBarrierSystem != null) && (stripBarrierSystem.length() > 1)) { |
fos.write(" stripbarr = RomeFilesOpen(files, '#XML:stripbarr_file0.xml',0)\n".getBytes()); |
String text = " RomeFileSetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', 'strip-barrier-systems\\\\aaa', 0)\n"; |
fos.write(text.getBytes()); |
} |
|
+ // Runs with a Hydraulic Element System, use a hydraulic element flow path |
if ((hydElemSystem != null) && (hydElemSystem.length() > 1)) { |
- fos.write(" hydelem = RomeFilesOpen(files, '#XML:hydelem_file0.xml',0)\n".getBytes()); |
- String text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', 'hydraulic-element-systems\\\\aaa', 0)\n"; |
+ // Load the hyd elem flow path into the workspace |
+ fos.write(" hydelem = RomeFilesOpen(files, '#XML:hydelemflowpath_file.xml',0)\n".getBytes()); |
+// String r2db = Config.getString("r2.db", "http://oms-db.engr.colostate.edu/r2"); |
+// String hydelemHttpPtr = r2db + "/" + hydElemSystem.replace("\\", "/") + ".xml"; |
+ int numFlowPaths = r2run.DetermineNumberOfFlowPaths(hydElemSystem); |
+ String text = " RomeFileSetAttrSize(profile, 'NUM_FLOW_PATHS', " + numFlowPaths + ")\n"; |
fos.write(text.getBytes()); |
+ double offsets[] = r2run.DetermineFlowPathDistribution(hydElemSystem); |
+ for (int i=0 ; i< numFlowPaths; i++) |
+ { |
+ text = " RomeFileSetAttrSize(profile, 'FLOW_PATH_HORIZ', '" + length * offsets[i] + "', " + i + ")\n"; |
+ fos.write(text.getBytes()); |
+ if ( i < numFlowPaths) |
+ { |
+ text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', 'hydraulic-element-flow-paths\\hydelemflowpath1', " + i + ")"; |
+ fos.write(text.getBytes()); |
+ } |
+ else |
+ { |
+ // last flow path is always the default |
+ text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', 'hydraulic-element-flow-paths\\default', " + i + ")"; |
+ fos.write(text.getBytes()); |
+ } |
+ } |
} |
-// need to set these elements based on array settings |
- for (int i = 0; i < aDiversionIdx.length(); i++) { |
- String text = " hydelem = RomeFilesOpen(files, '#XML:hydelem_file" + i + ".xml',0)\n"; |
- fos.write(text.getBytes()); |
-// text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', 'hydraulic-element-systems\\\\aaa" + i + "', 0)\n"; |
+ |
+//// need to set these elements based on array settings |
+// for (int i = 0; i < aDiversionIdx.length(); i++) { |
+// String text = " hydelem = RomeFilesOpen(files, '#XML:hydelem_file" + i + ".xml',0)\n"; |
// fos.write(text.getBytes()); |
- } |
+//// text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', 'hydraulic-element-systems\\\\aaa" + i + "', 0)\n"; |
+//// fos.write(text.getBytes()); |
+// } |
|
- for (int i = 0; i < aStripBarrierIdx.length(); i++) { |
- String text = " stripbarr = RomeFilesOpen(files, '#XML:stripbarr_file" + i + ".xml',0)\n"; |
- fos.write(text.getBytes()); |
-// text = " RomeFileSetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', 'strip-barrier-systems\\\\aaa" + i + "', 0)\n"; |
+// for (int i = 0; i < aStripBarrierIdx.length(); i++) { |
+// String text = " stripbarr = RomeFilesOpen(files, '#XML:stripbarr_file" + i + ".xml',0)\n"; |
// fos.write(text.getBytes()); |
- } |
+//// text = " RomeFileSetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', 'strip-barrier-systems\\\\aaa" + i + "', 0)\n"; |
+//// fos.write(text.getBytes()); |
+// } |
|
- for (int i = 0; i < aContourIdx.length(); i++) { |
- String text = " contour = RomeFilesOpen(files, '#XML:contour_file" + i + ".xml',0)\n"; |
- fos.write(text.getBytes()); |
-// text = " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', 'contour-systems\\\\aaa" + i + "', 0)\n"; |
+// for (int i = 0; i < aContourIdx.length(); i++) { |
+// String text = " contour = RomeFilesOpen(files, '#XML:contour_file" + i + ".xml',0)\n"; |
// fos.write(text.getBytes()); |
- |
- } |
+//// text = " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', 'contour-systems\\\\aaa" + i + "', 0)\n"; |
+//// fos.write(text.getBytes()); |
+// } |
|
String text = " RomeFileSetAttrValue(profile, 'SLOPE_HORIZ', '" + length + "', 0)\n"; |
fos.write(text.getBytes()); |
@@ -633,18 +654,18 @@ |
text = " print('SEG_SOIL_LAYER=%s' % str(soilIndex[" + i + "]), " + i + ")\n"; |
fos.write(text.getBytes()); |
|
- if ((diversions != null) && (diversions.length() > 0)) { |
- text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', 'hydraulic-element-systems\\\\aaa" + aDiversionIdx.getInt(i) + "', " + i + ")\n"; |
- fos.write(text.getBytes()); |
- } |
- if ((stripBarrrierSystems != null) && (stripBarrrierSystems.length() > 0)) { |
- text = " RomeFileSetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', 'strip-barrier-systems\\\\aaa" + aStripBarrierIdx.getInt(i) + "', " + i + ")\n"; |
- fos.write(text.getBytes()); |
- } |
- if ((contoursytems != null) && (contoursytems.length() > 0)) { |
- text = " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', 'contour-systems\\\\aaa" + aContourIdx.getInt(i) + "', " + i + ")\n"; |
- fos.write(text.getBytes()); |
- } |
+// if ((diversions != null) && (diversions.length() > 0)) { |
+// text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', 'hydraulic-element-systems\\\\aaa" + aDiversionIdx.getInt(i) + "', " + i + ")\n"; |
+// fos.write(text.getBytes()); |
+// } |
+// if ((stripBarrrierSystems != null) && (stripBarrrierSystems.length() > 0)) { |
+// text = " RomeFileSetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', 'strip-barrier-systems\\\\aaa" + aStripBarrierIdx.getInt(i) + "', " + i + ")\n"; |
+// fos.write(text.getBytes()); |
+// } |
+// if ((contoursytems != null) && (contoursytems.length() > 0)) { |
+// text = " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', 'contour-systems\\\\aaa" + aContourIdx.getInt(i) + "', " + i + ")\n"; |
+// fos.write(text.getBytes()); |
+// } |
} |
|
} else { |
@@ -685,48 +706,75 @@ |
fos.write(text.getBytes()); |
} |
|
- // request erosion by segment, if a segmented run |
- if (aTopoLength.length() > 1) { |
- for (int i = 0; i < aTopoLength.length(); i++) { |
- text = " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + "))\n"; |
- fos.write(text.getBytes()); |
- text = " print('SEG_SOIL_LOSS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + ")))\n"; |
- fos.write(text.getBytes()); |
-// text = " results.append(float(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + ")))\n"; |
+ // Request output for segments (seg 0 for non segmented runs) |
+ fos.write(" numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n".getBytes()); |
+ fos.write(" print('------------------------------------------------------------------------------')\n".getBytes()); |
+ fos.write(" print('NUMBER OF FLOWPATHS=%d' % numflowpaths)\n".getBytes()); |
+ fos.write(" for xx in range (numflowpaths):\n".getBytes()); |
+ fos.write(" print('FLOW_PATH_HORIZ:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'FLOW_PATH_HORIZ', xx)))\n".getBytes()); |
+ fos.write(" print('HYD_ELEM_FLOW_PATH_PTR:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', xx)))\n".getBytes()); |
+ fos.write(" numsegs = RomeFileGetAttrSize(profile, 'SEGMENT')\n".getBytes()); |
+ fos.write(" print('NUMBER OF SEGMENTS=%d' % numsegs)\n".getBytes()); |
+ fos.write(" for x in range (numsegs):\n".getBytes()); |
+ fos.write(" print('------------------------------------------------------------------------------')\n".getBytes()); |
+ fos.write(" print('SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEGMENT', x)))\n".getBytes()); |
+ fos.write(" print('SEG_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_HORIZ', x)))\n".getBytes()); |
+ fos.write(" print('SEG_STEEP:%d=%s' % (x,RomeFileGetAttrValue(profile, 'SEG_STEEP', x)))\n".getBytes()); |
+ fos.write(" print('SEG_MAN:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n".getBytes()); |
+ fos.write(" print('SEG_SOIL:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n".getBytes()); |
+ fos.write(" results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x))\n".getBytes()); |
+ fos.write(" print('SEG_SOIL_LOSS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x)))\n".getBytes()); |
+ fos.write(" print('SEG_SOIL_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', x)))\n".getBytes()); |
+ fos.write(" print('SEG_MAN_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', x)))\n".getBytes()); |
+ fos.write(" print('HYD_ELEM_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', x)))\n".getBytes()); |
+ fos.write(" print('STRIP_BARRIER_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', x)))\n".getBytes()); |
+ fos.write(" print('CONTOUR_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', x)))\n".getBytes()); |
+ fos.write(" print('------------------------------------------------------------------------------')\n".getBytes()); |
+ |
+// // request erosion by segment, if a segmented run |
+// if (aTopoLength.length() > 1) { |
+// for (int i = 0; i < aTopoLength.length(); i++) { |
+// text = " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + "))\n"; |
// fos.write(text.getBytes()); |
-// text = " print('seg man layer %i =%s' % (" +i + " , RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', " + i + ")))\n"; |
+// text = " print('SEG_SOIL_LOSS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + ")))\n"; |
// fos.write(text.getBytes()); |
-// text = " print('seg soil layer %i =%s' % (" + i + " , RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', " + i + ")))\n"; |
+//// text = " results.append(float(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + ")))\n"; |
+//// fos.write(text.getBytes()); |
+//// text = " print('seg man layer %i =%s' % (" +i + " , RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', " + i + ")))\n"; |
+//// fos.write(text.getBytes()); |
+//// text = " print('seg soil layer %i =%s' % (" + i + " , RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', " + i + ")))\n"; |
+//// fos.write(text.getBytes()); |
+//// text = " print('seg soil loss %i =%s' % (" + i + " , RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + ")))\n"; |
+//// fos.write(text.getBytes()); |
+//// text = " print('slope soil loss %i =%s' % (" + i + " , RomeFileGetAttrValue(profile, 'SLOPE_SOIL_LOSS', " + i + ")))\n"; |
+//// fos.write(text.getBytes()); |
+//// text = " results.append(RomeFileGetAttrValue(profile, 'SLOPE_SOIL_LOSS', " + i + "))\n"; |
+//// fos.write(text.getBytes()); |
+// text = " print('SEG_SOIL:" + i + "=%s' % RomeFileGetAttrValue(profile, 'SOIL_PTR', " + i + "))\n"; |
// fos.write(text.getBytes()); |
-// text = " print('seg soil loss %i =%s' % (" + i + " , RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', " + i + ")))\n"; |
+// text = " print('SEG_MAN:" + i + "=%s' % RomeFileGetAttrValue(profile, 'MAN_PTR', " + i + "))\n"; |
// fos.write(text.getBytes()); |
-// text = " print('slope soil loss %i =%s' % (" + i + " , RomeFileGetAttrValue(profile, 'SLOPE_SOIL_LOSS', " + i + ")))\n"; |
+// text = " print('SEG_SOIL_LAYER " + i + "=%s' % (RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', " + i + ")))\n"; |
// fos.write(text.getBytes()); |
-// text = " results.append(RomeFileGetAttrValue(profile, 'SLOPE_SOIL_LOSS', " + i + "))\n"; |
+// text = " print('SEG_MAN_LAYER " + i + "=%s' % (RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', " + i + ")))\n"; |
// fos.write(text.getBytes()); |
- text = " print('SEG_SOIL:" + i + "=%s' % RomeFileGetAttrValue(profile, 'SOIL_PTR', " + i + "))\n"; |
- fos.write(text.getBytes()); |
- text = " print('SEG_MAN:" + i + "=%s' % RomeFileGetAttrValue(profile, 'MAN_PTR', " + i + "))\n"; |
- fos.write(text.getBytes()); |
- text = " print('SEG_SOIL_LAYER " + i + "=%s' % (RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', " + i + ")))\n"; |
- fos.write(text.getBytes()); |
- text = " print('SEG_MAN_LAYER " + i + "=%s' % (RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', " + i + ")))\n"; |
- fos.write(text.getBytes()); |
- text = " print('HYD_ELEM_SYS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', " + i + ")))\n"; |
- fos.write(text.getBytes()); |
- text = " print('STRIP_BARRIER_SYS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', " + i + ")))\n"; |
- fos.write(text.getBytes()); |
- text = " print('CONTOUR_SYS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', " + i + ")))\n"; |
- fos.write(text.getBytes()); |
- } |
- } else { |
- // always return soil and man ptrs at index 0 - requested by Lucas for IET |
- text = " print('SEG_SOIL:0" + "=%s' % RomeFileGetAttrValue(profile, 'SOIL_PTR', " + 0 + "))\n"; |
- fos.write(text.getBytes()); |
- text = " print('SEG_MAN:0" + "=%s' % RomeFileGetAttrValue(profile, 'MAN_PTR', " + 0 + "))\n"; |
- fos.write(text.getBytes()); |
- // |
- } |
+// text = " print('HYD_ELEM_SYS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', " + i + ")))\n"; |
+// fos.write(text.getBytes()); |
+// text = " print('STRIP_BARRIER_SYS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', " + i + ")))\n"; |
+// fos.write(text.getBytes()); |
+// text = " print('CONTOUR_SYS:" + i + "=%s' % (RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', " + i + ")))\n"; |
+// fos.write(text.getBytes()); |
+// } |
+// } else { |
+// // always return soil and man ptrs at index 0 - requested by Lucas for IET |
+// text = " print('SEG_SOIL:0" + "=%s' % RomeFileGetAttrValue(profile, 'SOIL_PTR', " + 0 + "))\n"; |
+// fos.write(text.getBytes()); |
+// text = " print('SEG_MAN:0" + "=%s' % RomeFileGetAttrValue(profile, 'MAN_PTR', " + 0 + "))\n"; |
+// fos.write(text.getBytes()); |
+// // |
+// } |
+ |
+ |
// fos.write(" print('SLOPE_DELIVERY=%s' % RomeFileGetAttrValue(profile, 'SLOPE_DELIVERY', 0))\n".getBytes()); |
// fos.write(" print('SLOPE_T_VALUE=%s' % RomeFileGetAttrValue(profile, 'SLOPE_T_VALUE', 0))\n".getBytes()); |
// fos.write(" print('SLOPE_DEGRAD=%s' % RomeFileGetAttrValue(profile, 'SLOPE_DEGRAD', 0))\n".getBytes()); |
@@ -756,26 +804,26 @@ |
fos.write(" RomeDatabaseClose(database)\n".getBytes()); |
fos.write(" RomeExit(romeDLL)\n".getBytes()); |
|
- // Prepare multiple soils, contour sys, strips barriers, and hydraulic element files |
+ // Prepare multiple soils, strips barriers, and hydraulic element files |
for (int i = 0; i < aSoils.length(); i++) { |
String soilHttpPtr = r2db + "/" + soilPtr[i].replace("\\", "/") + ".xml"; |
r2run.prepareSoilsFile(soilHttpPtr, new File(getWorkspaceDir(), "soils_file" + i + ".xml"), true, String.valueOf(i)); |
} |
- for (int i = 0; i < contoursytems.length(); i++) { |
- String contourSys = contoursytems.getString(i); |
- String contourHttpPtr = r2db + "/" + contourSys.replace("\\", "/") + ".xml"; |
- r2run.prepareFile(contourHttpPtr, new File(getWorkspaceDir(), "contour_file" + i + ".xml"), "contour", "contour-systems", Integer.toString(i)); |
- } |
- for (int i = 0; i < stripBarrrierSystems.length(); i++) { |
- String stripBarrierSys = stripBarrrierSystems.getString(i); |
- String stripbarrHttpPtr = r2db + "/" + stripBarrierSys.replace("\\", "/") + ".xml"; |
- r2run.prepareFile(stripbarrHttpPtr, new File(getWorkspaceDir(), "stripbarr_file" + i + ".xml"), "strip-barrier", "strip-barrier-systems", Integer.toString(i)); |
- } |
- for (int i = 0; i < diversions.length(); i++) { |
- String hydElemSys = diversions.getString(i); |
- String hydelemHttpPtr = r2db + "/" + hydElemSys.replace("\\", "/") + ".xml"; |
- r2run.prepareFile(hydelemHttpPtr, new File(getWorkspaceDir(), "hydelem_file" + i + ".xml"), "hydraulic-element", "hydraulic-element-systems", Integer.toString(i)); |
- } |
+// for (int i = 0; i < contoursytems.length(); i++) { |
+// String contourSys = contoursytems.getString(i); |
+// String contourHttpPtr = r2db + "/" + contourSys.replace("\\", "/") + ".xml"; |
+// r2run.prepareFile(contourHttpPtr, new File(getWorkspaceDir(), "contour_file" + i + ".xml"), "contour", "contour-systems", Integer.toString(i)); |
+// } |
+// for (int i = 0; i < stripBarrrierSystems.length(); i++) { |
+// String stripBarrierSys = stripBarrrierSystems.getString(i); |
+// String stripbarrHttpPtr = r2db + "/" + stripBarrierSys.replace("\\", "/") + ".xml"; |
+// r2run.prepareFile(stripbarrHttpPtr, new File(getWorkspaceDir(), "stripbarr_file" + i + ".xml"), "strip-barrier", "strip-barrier-systems", Integer.toString(i)); |
+// } |
+// for (int i = 0; i < diversions.length(); i++) { |
+// String hydElemSys = diversions.getString(i); |
+// String hydelemHttpPtr = r2db + "/" + hydElemSys.replace("\\", "/") + ".xml"; |
+// r2run.prepareFile(hydelemHttpPtr, new File(getWorkspaceDir(), "hydelem_file" + i + ".xml"), "hydraulic-element", "hydraulic-element-systems", Integer.toString(i)); |
+// } |
|
// prepare individual contour system, strip barrier system, hyd elem sys, if not provided in an array |
if (JSONUtils.checkKeyExistsB(param, KEY_CONTOUR_SYSTEM_PTR)) { |
@@ -788,7 +836,7 @@ |
} |
if (JSONUtils.checkKeyExistsB(param, KEY_HYD_ELEM_SYSTEM_PTR)) { |
String hydelemHttpPtr = r2db + "/" + hydElemSystem.replace("\\", "/") + ".xml"; |
- r2run.prepareFile(hydelemHttpPtr, new File(getWorkspaceDir(), "hydelem_file0.xml"), "hydraulic-element", "hydraulic-element-systems", ""); |
+ r2run.prepareHydraulicElementFlowPath(hydelemHttpPtr, new File(getWorkspaceDir(), "hydelemflowpath_file.xml")); |
} |
|
// prepare climate file |
@@ -859,7 +907,11 @@ |
//LOG.info("Rusle2 report output obj=" + reportObj.toString()); |
} |
|
- |
+ private void prepareHydraulicFlowElementFile() |
+ { |
+ // Given a Hydraulic Element Pointer, parse the XML and return a Hydraulic Flow Element |
+ } |
+ |
private JSONObject processReportElement(JSONObject obj, String type, String value) throws Exception { |
if ((type.equals("TEXT")) || (type.equals("FILENAME")) || (type.equals("DATE"))) { |
// because the RomeShell returns escaped strings, and the JSONObject in Java re-escapes them |