@@ -442,6 +442,26 @@ |
|
return CCONC; |
} |
+ private String[][] removeZeroFlowData(String[][] flowData){ |
+ //Loop through flow data and only keey data greater than zero |
+ ArrayList<String> allDate = new ArrayList<>(); |
+ ArrayList<String> allData = new ArrayList<>(); |
+ for(int i=0; i<flowData.length; i++){ |
+ double flowValue = Double.parseDouble(flowData[i][1]); |
+ if(flowValue > 0){ |
+ allDate.add(flowData[i][0]); |
+ allData.add(flowData[i][1]); |
+ } |
+ } |
+ |
+ String[][] flowDataCleaned = new String[allData.size()][2]; |
+ for(int i=0; i<allData.size(); i++){ |
+ flowDataCleaned[i][0] = allDate.get(i); |
+ flowDataCleaned[i][1] = allData.get(i); |
+ } |
+ |
+ return flowDataCleaned; |
+ } |
/** |
* This will open the file and grab the lines of data from it until it reaches the empty line |
* @return returns the entire text file in textData |
@@ -614,9 +634,12 @@ |
String[][] sortedData_combined = DoubleArray.mergeData(sortedData, sortedData_user, mergeMethod); |
String[][] WQdata_combined = DoubleArray.mergeData(WQdata, WQdata_user, mergeMethod); |
|
+ //remove '0' flow data (incompatible with the model) |
+ String[][] sortedData_combined_clean = removeZeroFlowData(sortedData_combined); |
+ |
//Check if any data exists |
ArrayList<String> errorMessage = new ArrayList<>(); |
- if(sortedData_combined.length == 0){ |
+ if(sortedData_combined_clean.length == 0){ |
if(sortedData.length == 0){ |
errorMessage.add("There is no available flow data in the " + database + " database for station '" + stationId + "' and the specified date range."); |
if(database.equalsIgnoreCase("CDWR")){ |
@@ -650,10 +673,10 @@ |
writeHeader(); |
|
// write the calibration variables based on the number of concentration values with a associated flow value |
- writeCalibration(sortedData_combined, WQdata_combined, wqUnits); |
+ writeCalibration(sortedData_combined_clean, WQdata_combined, wqUnits); |
|
//Get estimation dates for LOADEST variables |
- writeEstimation(sortedData_combined); |
+ writeEstimation(sortedData_combined_clean); |
|
//Call LOADEST exe |
//Expected Input: "CONTROL.INP", "HEADER.INP", "CALIB.INP", and "EST.INP" |