String startDateStr, endingDataStr, bPointDateStr;
Iterator<RecessionCurve> allRecCurvesIt;
ArrayList<RecessionCurve> allRecCurves;
ChronoDataCsvImporter csvImporter;
DataSequence<Float> dataSeq;
RecessionCurve curRecCurve;
Date startDate, endingData;
char csvCharFileSeparator;
String csvDateFormat;
String csvFilePath;
char decSeparator;
File csvFileFile;
boolean hasTitle;
int countCurve;
double k3found;
Date bPointDate;
// 1 - read CSV file with data sequence
// 2 - extract k3 from data sequence
csvFilePath = "D:\\andre\\trabalho\\2013_udem\\proyecto_incendio\\1_visualData\\hydroDischarge\\discharge_2004_2007.csv";
//csvDateFormat = "HH:mm:ss MM/dd/yyyy";
csvDateFormat = "yyyyMMddHHmmss";
csvCharFileSeparator = ';';
decSeparator = ',';
hasTitle = true;
startDateStr = "05:15 26/02/2004";
endingDataStr = "16:15 01/03/2004";
startDate = HydrographAnaliser.getDate(startDateStr);
endingData = HydrographAnaliser.getDate(endingDataStr);
// enforcing B point
bPointDateStr = "07:30 26/02/2004";
bPointDate = HydrographAnaliser.getDate(bPointDateStr);
// define file reading
csvFileFile = new File(csvFilePath);
csvImporter = new ChronoDataCsvImporter();
csvImporter.setCsvFile(csvFileFile);
csvImporter.setDateFormat(csvDateFormat);
csvImporter.setCharDivider(csvCharFileSeparator);
csvImporter.setToIgnoreFirstLine(hasTitle);
csvImporter.setDecimalSeparator(decSeparator);
csvImporter.setDateColumn(0);
csvImporter.setDataColumn(1);
// read file
try{
dataSeq = csvImporter.readCsvFile();
} catch (IOException exp) {
System.err.println("IOException: " + exp.getMessage());
return;
} catch (ParseException exp) {
System.err.println("ParseException: " + exp.getMessage());
return;
}
try{
curRecCurve = new RecessionCurve(dataSeq, startDate, endingData);
curRecCurve.determineK3((short)0);
//curRecCurve.determineBpoint();
curRecCurve.enforcePointB(bPointDate);
curRecCurve.determineKI((short)0);
System.out.println("De " + HydrographAnaliser.readDate(curRecCurve.getStartingDate()) + " a " + HydrographAnaliser.readDate(curRecCurve.getEndingDate()));
System.out.println("-B: " + HydrographAnaliser.readDate(curRecCurve.getBPoint()));
System.out.println("-C: " + HydrographAnaliser.readDate(curRecCurve.getCPoint()));
System.out.println("-KI:" + curRecCurve.getKIValue() + " +/- " + curRecCurve.getKIStdDeviation());
System.out.println("-K3:" + curRecCurve.getK3Value() + " +/- " + curRecCurve.getK3StdDeviation());
} catch (Exception exp) {
System.err.println("Exception: " + exp.getMessage());
return;
}
}