@@ -299,10 +299,10 @@ |
aTopoLength = JSONUtils.getJSONArrayParam(param, KEY_TOPO_LENGTH); |
for (int i = 0; i < aTopoLength.length(); i++) { |
LOG.info("Topo Length [" + i + "]=" + aTopoLength.getDouble(i)); |
- // this is temporary, since R2 will be using slope segments soon |
- if (i == 0) { |
- length = aTopoLength.getDouble(i); |
- } |
+// // this is temporary, since R2 will be using slope segments soon |
+// if (i == 0) { |
+// length = aTopoLength.getDouble(i); |
+// } |
} |
} |
|
@@ -549,49 +549,7 @@ |
fos.write(text.getBytes()); |
} |
|
- if ((contourSystem != null) && (contourSystem.length() > 1)) { |
- // 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)) { |
- // 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"; |
@@ -619,6 +577,10 @@ |
text = " RomeFileSetAttrValue(profile, 'SLOPE_STEEP', '" + steepness + "', 0)\n"; |
fos.write(text.getBytes()); |
|
+ fos.write(" # SET CLIMATE_PTR\n".getBytes()); |
+ fos.write(" RomeFileSetAttrValue(profile, 'CLIMATE_PTR','climates\\\\aaa',0)\n".getBytes()); |
+ fos.write(" print('CLIMATE_PTR=%s' % RomeFileGetAttrValue(profile, 'CLIMATE_PTR', 0))\n".getBytes()); |
+ |
if (JSONUtils.checkKeyExistsB(param, KEY_SIMPLE_ROCK_COVER)) { |
text = " RomeFileSetAttrValue(profile, 'SIMPLE_ROCK_COVER', '" + simpleRockCoverPercent + "' ,0)\n"; |
fos.write(text.getBytes()); |
@@ -684,9 +646,59 @@ |
// text = " RomeFileSetAttrValue(profile, 'MAN_PTR', '" + StringEscapeUtils.escapeJava(managementFormalName[0]) + "',0)\n"; |
// fos.write(text.getBytes()); |
// fos.write(" print('MAN_PTR=%s' % RomeFileGetAttrValue(profile, 'MAN_PTR', 0))\n".getBytes()); |
- fos.write(" # SET CLIMATE_PTR\n".getBytes()); |
- fos.write(" RomeFileSetAttrValue(profile, 'CLIMATE_PTR','climates\\\\aaa',0)\n".getBytes()); |
- fos.write(" print('CLIMATE_PTR=%s' % RomeFileGetAttrValue(profile, 'CLIMATE_PTR', 0))\n".getBytes()); |
+ |
+ if ((contourSystem != null) && (contourSystem.length() > 1)) { |
+ // Contour Systems can simply point to the nginx XML file - no need to prefetch because of no special |
+ // characters in the file name |
+ 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)) { |
+ // for some reason, must reset SLOPE_HORIZ & SLOPE_STEEP immediately before setting a strip and barrier !!! R2 BUG |
+ // This is required for the internal Rusle2 wizard to calculate proper slope segment lengths |
+ text = " RomeFileSetAttrValue(profile, 'SLOPE_HORIZ', '" + length + "', 0)\n"; |
+ fos.write(text.getBytes()); |
+ text = " RomeFileSetAttrValue(profile, 'SLOPE_STEEP', '" + steepness + "', 0)\n"; |
+ fos.write(text.getBytes()); |
+ |
+ fos.write(" stripbarr = RomeFilesOpen(files, '#XML:stripbarr_file0.xml',0)\n".getBytes()); |
+ 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)) { |
+ // 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); |
+ 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 = " RomeFileSetAttrValue(profile, 'FLOW_PATH_HORIZ', '" + length * offsets[i] + "', " + i + ")\n"; |
+ fos.write(text.getBytes()); |
+ if ( i < (numFlowPaths-1)) |
+ { |
+ text = " RomeFileSetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', 'hydraulic-element-flow-paths\\hydelemflowpath1', " + i + ")\n"; |
+ 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 + ")\n"; |
+ fos.write(text.getBytes()); |
+ } |
+ } |
+ } |
+ |
+ |
+ |
|
// if ((contourSystem != null) && (contourSystem.length() > 1)) { |
// text = " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', '" + contourSystem + "',0)\n"; |
@@ -707,29 +719,29 @@ |
} |
|
// Request output for segments (seg 0 for non segmented runs) |
- fos.write(" numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n".getBytes()); |
+ 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('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()); |
+ 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) { |
@@ -836,7 +848,7 @@ |
} |
if (JSONUtils.checkKeyExistsB(param, KEY_HYD_ELEM_SYSTEM_PTR)) { |
String hydelemHttpPtr = r2db + "/" + hydElemSystem.replace("\\", "/") + ".xml"; |
- r2run.prepareHydraulicElementFlowPath(hydelemHttpPtr, new File(getWorkspaceDir(), "hydelemflowpath_file.xml")); |
+ r2run.prepareHydraulicElementFlowPath(hydelemHttpPtr, r2db, new File(getWorkspaceDir(), "hydelemflowpath_file.xml")); |
} |
|
// prepare climate file |