@@ -32,7 +32,7 @@ |
* @since Java version: 16-October-2012 |
*/ |
public class EffectiveDischarge { |
- String mainFolder = "C:/Projects/TylerWible/CodeDirectories/NetBeans/data/Hydraulics"; |
+ String directory = "C:/Projects/TylerWible/CodeDirectories/NetBeans/data/Hydraulics"; |
double[][] fdcData = {{1.0,550}, //a matrix of with the first column of flow duration curve exceedence(s) (1-0) and second column of their assosicated flows |
{0.75,380}, //(set by 'setFlowDurationCurve') |
{0.50,376}, |
@@ -78,32 +78,32 @@ |
//Gets |
public File getEffectiveDischargeOutput(){ |
//This output file is for use with JSHighCharts |
- return new File(mainFolder, "effective_discharge_graph.out"); |
+ return new File(directory, "effective_discharge_graph.out"); |
} |
public File getCummulativeSedimentYieldOutput(){ |
//This output file is for use with JSHighCharts |
- return new File(mainFolder, "sediment_yield_graph.out"); |
+ return new File(directory, "sediment_yield_graph.out"); |
} |
public File getHistogramOutput(){ |
//This output file is for use with JSHighCharts |
- return new File(mainFolder, "flow_histogram.outt"); |
+ return new File(directory, "flow_histogram.outt"); |
//Note that this file has a different extension as a flag for eRAMS to parse the first column as strings not numbers |
} |
public File getRatingCurveOutput_sediment(){ |
//This output file is for use with JSHighCharts |
- return new File(mainFolder, "ratingCurveGraph_sediment.out"); |
+ return new File(directory, "ratingCurveGraph_sediment.out"); |
} |
public File getRatingCurveOutput_area(){ |
//This output file is for use with JSHighCharts |
- return new File(mainFolder, "ratingCurveGraph_area.out"); |
+ return new File(directory, "ratingCurveGraph_area.out"); |
} |
public File getRatingCurveOutput_depth(){ |
//This output file is for use with JSHighCharts |
- return new File(mainFolder, "ratingCurveGraph_depth.out"); |
+ return new File(directory, "ratingCurveGraph_depth.out"); |
} |
public File getRatingCurveOutput_hydRadius(){ |
//This output file is for use with JSHighCharts |
- return new File(mainFolder, "ratingCurveGraph_hydRadius.out"); |
+ return new File(directory, "ratingCurveGraph_hydRadius.out"); |
} |
public String getEffectiveDischargeGraph() { |
return "effective_discharge_graph.jpg"; |
@@ -137,8 +137,8 @@ |
} |
|
//Sets |
- public void setMainFolder(String mainFolder) { |
- this.mainFolder = mainFolder; |
+ public void setDirectory(String directory) { |
+ this.directory = directory; |
} |
public void setFlowDurationCurve(String flowDurationCurve) throws IOException{ |
//Break up formatted cross-section points and create a double array for easier use |
@@ -374,7 +374,7 @@ |
histogramData[j-1][1] = String.valueOf(count); |
} |
//Save histogram data for JHighCharts |
- general.writeXYseries(mainFolder, histogramData, getHistogramOutput().getName()); |
+ general.writeXYseries(directory, histogramData, getHistogramOutput().getName()); |
|
//Define renderer properties for bar graph |
int seriesIndex = 0; |
@@ -409,7 +409,7 @@ |
|
//Save resulting graph for use later |
try{ |
- String path = mainFolder + File.separator + getHistogram(); |
+ String path = directory + File.separator + getHistogram(); |
ChartUtilities.saveChartAsJPEG(new File(path), chart, 1280, 800); |
System.out.println("JFreeChart created properly at: " + path); |
}catch(IOException e){ |
@@ -454,7 +454,7 @@ |
} |
|
//Save results for graphing with JSHighcharts |
- general.writeXYseries(mainFolder, graphData, dataOutputName); |
+ general.writeXYseries(directory, graphData, dataOutputName); |
|
//Graph the effective discharge curve |
XYPlot plot = new XYPlot(); |
@@ -501,7 +501,7 @@ |
legendTitle.setItemFont(general.masterFont); |
|
try{ |
- String path = mainFolder + File.separator + graphOutputName; |
+ String path = directory + File.separator + graphOutputName; |
ChartUtilities.saveChartAsJPEG(new File(path), chart, 1280, 800); |
System.out.println("Graph located at:\t" + path); |
}catch(IOException e){ |
@@ -545,7 +545,7 @@ |
} |
|
//Save results for graphing with JSHighcharts |
- general.writeXYseries(mainFolder, graphData, getCummulativeSedimentYieldOutput().getName()); |
+ general.writeXYseries(directory, graphData, getCummulativeSedimentYieldOutput().getName()); |
|
//Graph the effective discharge curve |
XYPlot plot = new XYPlot(); |
@@ -593,7 +593,7 @@ |
legendTitle.setItemFont(general.masterFont); |
|
try{ |
- String path = mainFolder + File.separator + getSedimentYieldGraph(); |
+ String path = directory + File.separator + getSedimentYieldGraph(); |
ChartUtilities.saveChartAsJPEG(new File(path), chart, 1280, 800); |
System.out.println("Graph located at:\t" + path); |
}catch(IOException e){ |
@@ -637,7 +637,7 @@ |
//plot(q.e1, eff.e, type = "l") (Joel) |
|
//Save results for graphing with JSHighcharts |
- general.writeXYseries(mainFolder, graphData, getEffectiveDischargeOutput().getName()); |
+ general.writeXYseries(directory, graphData, getEffectiveDischargeOutput().getName()); |
|
//Graph the effective discharge curve |
XYPlot plot = new XYPlot(); |
@@ -685,7 +685,7 @@ |
legendTitle.setItemFont(general.masterFont); |
|
try{ |
- String path = mainFolder + File.separator + getEffectiveDischargeGraph(); |
+ String path = directory + File.separator + getEffectiveDischargeGraph(); |
ChartUtilities.saveChartAsJPEG(new File(path), chart, 1280, 800); |
System.out.println("Graph located at:\t" + path); |
}catch(IOException e){ |
@@ -3,9 +3,9 @@ |
import csip.annotations.Description; |
import csip.annotations.Name; |
import csip.annotations.VersionInfo; |
+import csip.api.server.PayloadParameter; |
+import csip.api.server.PayloadResults; |
import csip.ModelDataService; |
-import csip.PayloadParameter; |
-import csip.PayloadResults; |
import java.io.File; |
import javax.ws.rs.Path; |
|
@@ -19,7 +19,7 @@ |
|
@Override |
protected void preProcess() throws Exception { |
- model.setMainFolder(getWorkspaceDir().toString()); |
+ model.setDirectory(workspace().getDir().toString()); |
|
PayloadParameter inputPayload = parameter(); |
model.setFlowDurationCurve(inputPayload.getString("flowDurationCurve")); |
@@ -59,7 +59,7 @@ |
protected void postProcess() throws Exception { |
PayloadResults resultPayload = results(); |
// files |
- File wd = getWorkspaceDir(); |
+ File wd = workspace().getDir(); |
resultPayload.put(new File(wd, model.getEffectiveDischargeGraph()), |
new File(wd, model.getSedimentYieldGraph()), |
new File(wd, model.getHistogram()), |
@@ -28,7 +28,7 @@ |
*/ |
public class StandardStepMethod { |
//Inputs |
- String mainFolder = "U:/Java Projects/StandardStepMethod/RegularGeometryTest"; |
+ String directory = "U:/Java Projects/StandardStepMethod/RegularGeometryTest"; |
boolean irregularGeometry = false; |
boolean downstreamCalculation = true; |
boolean useThalwegElevation = true; |
@@ -76,8 +76,8 @@ |
public void setNumberOfCrossSections(int numberOfCrossSections){ |
this.numberOfCrossSections = numberOfCrossSections; |
} |
- public void setMainFolder(String mainFolder){ |
- this.mainFolder = mainFolder; |
+ public void setDirectory(String directory){ |
+ this.directory = directory; |
} |
public void setIrregularGeometry(boolean irregularGeometry){ |
this.irregularGeometry = irregularGeometry; |
@@ -118,11 +118,11 @@ |
public File getElevationGraphOutput(){ |
if (downstreamCalculation){ |
String title = "_" + measuredDownstreamDepth + "m_StartDepth_DownstreamElevationProfile.out"; |
- return new File(mainFolder, title); |
+ return new File(directory, title); |
} |
else{ |
String title = "_" + measuredDownstreamDepth + "m_StartDepth_UpstreamElevationProfile.out"; |
- return new File(mainFolder, title); |
+ return new File(directory, title); |
} |
} |
public String getSummaryTitle(){ |
@@ -175,7 +175,7 @@ |
|
int numberOfReaches; |
if (irregularGeometry) { |
- numberOfReaches = readLines(mainFolder + File.separator + "reaches.txt"); |
+ numberOfReaches = readLines(directory + File.separator + "reaches.txt"); |
} |
else{ |
numberOfReaches = numberOfCrossSections-1; |
@@ -590,8 +590,8 @@ |
* @throws IOException |
*/ |
public int calcLargestCrossSection() throws IOException { |
- String[] sections = transferTXTFile(mainFolder + File.separator + "crossSections.txt"); |
- int numberOfLines = readLines(mainFolder + File.separator + "crossSections.txt"); |
+ String[] sections = transferTXTFile(directory + File.separator + "crossSections.txt"); |
+ int numberOfLines = readLines(directory + File.separator + "crossSections.txt"); |
|
int i; |
int n; |
@@ -617,8 +617,8 @@ |
* @throws IOException |
*/ |
public double[][][] setCrossSectionGeometries() throws IOException { |
- int numberOfSections = readLines(mainFolder + File.separator + "crossSections.txt"); |
- String[] sections = transferTXTFile(mainFolder + File.separator + "crossSections.txt"); |
+ int numberOfSections = readLines(directory + File.separator + "crossSections.txt"); |
+ String[] sections = transferTXTFile(directory + File.separator + "crossSections.txt"); |
int length = calcLargestCrossSection(); |
String[][] xypointlist; |
int i; |
@@ -649,8 +649,8 @@ |
* @throws IOException |
*/ |
public double[][] setReachProperties() throws IOException { |
- int numberOfSections = readLines(mainFolder + File.separator + "reaches.txt"); |
- String[] reaches = transferTXTFile(mainFolder + File.separator + "reaches.txt"); |
+ int numberOfSections = readLines(directory + File.separator + "reaches.txt"); |
+ String[] reaches = transferTXTFile(directory + File.separator + "reaches.txt"); |
double[][] reachProperties = new double[numberOfSections][4]; |
int i; |
for (i = 0; i < numberOfSections; i++) { |
@@ -958,7 +958,7 @@ |
legendTitle.setItemFont(general.masterFont); |
|
try { |
- String path = mainFolder + File.separator + graphOutputName; |
+ String path = directory + File.separator + graphOutputName; |
ChartUtilities.saveChartAsJPEG(new File(path), chart, 1280, 800); |
System.out.println(path); |
} catch (IOException e) { |
@@ -977,7 +977,7 @@ |
double reachResultsArray[][]) throws IOException { |
//open the file writer and set path |
String summaryOutputName = getSummary(); |
- String path = mainFolder + File.separator + summaryOutputName; |
+ String path = directory + File.separator + summaryOutputName; |
FileWriter writer = new FileWriter(path, false); |
PrintWriter print_line = new PrintWriter(writer); |
|
@@ -3,9 +3,9 @@ |
import csip.annotations.Description; |
import csip.annotations.Name; |
import csip.annotations.VersionInfo; |
+import csip.api.server.PayloadParameter; |
+import csip.api.server.PayloadResults; |
import csip.ModelDataService; |
-import csip.PayloadParameter; |
-import csip.PayloadResults; |
import java.io.File; |
import javax.ws.rs.Path; |
|
@@ -20,7 +20,7 @@ |
@Override |
protected void preProcess() throws Exception { |
//Also requires "reaches.txt" and "crossSections" input files |
- model.setMainFolder(getWorkspaceDir().toString()); |
+ model.setDirectory(workspace().getDir().toString()); |
|
PayloadParameter inputPayload = parameter(); |
model.setBottomWidth(inputPayload.getDouble("bottomWidth")); |
@@ -47,7 +47,7 @@ |
@Override |
protected void postProcess() throws Exception { |
PayloadResults resultPayload = results(); |
- File wd = getWorkspaceDir(); |
+ File wd = workspace().getDir(); |
resultPayload.put(new File(wd, model.getElevationGraph()), |
new File(wd, model.getSummary()), |
//Below are the result graph files for use by JHighCharts on eRAMS for duplicating the above graphs |