Package adlzanchetta.hydrology.hydrographAnaliser.hydrographElements

Examples of adlzanchetta.hydrology.hydrographAnaliser.hydrographElements.RecessionCurve


    public static double getK3(DataSequence dataSeq_arg,
                               Date startDate_arg,
                               Date endDate_arg){
        ArrayList<RecessionCurve> recCurveList;
        Iterator<RecessionCurve> recCurveIt;
        RecessionCurve curRecCurve;
       
        // 1 - get all recession curves
        // 2 - evaluate all rec. curves data
       
        // 1
        recCurveList = HydrographAnaliser.getAllRecessionCurves(dataSeq_arg,
                                                                startDate_arg,
                                                                endDate_arg);
       
        // 2
        recCurveIt = recCurveList.iterator();
        while(recCurveIt.hasNext()){
            curRecCurve = recCurveIt.next();
            System.out.println("Curve X: k3=" + curRecCurve.getK3Value() + "; stdDev=" + curRecCurve.getK3StdDeviation());
        }
       
        // 3 - correct that
        return(Double.NaN);
    }
View Full Code Here


                                                                  Date endDate_arg){
        ArrayList<RecessionCurve> recCurveList;
        ArrayList<Peak<Double>> allPeaks;
        Iterator<Peak<Double>> itPeaks;
        Peak<Double> curPeak, prevPeak;
        RecessionCurve curRecCurve;
       
        // 0 - basic check
        // 1 - identify all peaks
        // 2 - for each superior peak followed by a inferior peak
        // 2a - get its ressecion curve
        // 2b - analyse it
        // 3 - return recession curve
       
        // basic check - list not null
        if (dataSeq_arg == null) return (null);
       
        // basic check - start date inside data seq.
        if ((startDate_arg != null) && (!HydrographAnaliser.isInside(dataSeq_arg,
                                                                     startDate_arg))){
            return (null);
        }
        if ((startDate_arg != null) && (!HydrographAnaliser.isInside(dataSeq_arg,
                                                                     endDate_arg))){
            return (null);
        }
       
        // 1
        allPeaks = HydrographAnaliser.identifyPeaks(dataSeq_arg,
                                                    startDate_arg,
                                                    endDate_arg);
        if (allPeaks == null) return (null);
        recCurveList = new ArrayList<>();
       
        // 2
        itPeaks = allPeaks.iterator();
        prevPeak = null;
        while(itPeaks.hasNext()){
            curPeak = itPeaks.next();
           
            if ((curPeak.getPeakType() == Peak.INFERIOR) &&
                    (prevPeak != null) &&
                    (prevPeak.getPeakType() == Peak.SUPERIOR)){
               
                try{
                    //2a
                    curRecCurve = new RecessionCurve(dataSeq_arg,
                                                     prevPeak.getPeakDate(),
                                                     curPeak.getPeakDate());
                   
                    //2b
                    curRecCurve.determineK3((short)0);
                    recCurveList.add(curRecCurve);
                   
                } catch (Exception exp){
                    System.err.println("EXCEPTION: " + exp.getMessage());
                }
View Full Code Here

            return;
        }
       
        Iterator<RecessionCurve> allRecCurvesIt;
        ArrayList<RecessionCurve> allRecCurves;
        RecessionCurve curRecCurve;
       
        //k3found = HydrographAnaliser.getK3(dataSeq);
        allRecCurves = HydrographAnaliser.getAllRecessionCurves(dataSeq);
        allRecCurvesIt = allRecCurves.iterator();
        countCurve = 0;
        while(allRecCurvesIt.hasNext()) {
            curRecCurve = allRecCurvesIt.next();
            System.out.println(countCurve + ": 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());
            countCurve++;
        }
    }
View Full Code Here

        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;
        }           
    }
View Full Code Here

        double secDeriv;
        long[] xValues;
        Date curentDate;
        int count;
        DataSequence<Float> evaluatedDataSeq;
        RecessionCurve rCurve;
       
        yValues = new float[]{7.6f, 7.4f, 6.3f, 3.2f, 1.3f, 0.9f};
        xValues = new long[]{0, 1, 2, 3, 4, 5};
       
        evaluatedDataSeq = new DataSequence<>();
        for(count = 0; count < yValues.length; count++){
            curentDate = new Date();
            curentDate.setTime(xValues[count]);
            evaluatedDataSeq.addData(curentDate, yValues[count]);
        }
       
        //
        try{
            rCurve = new RecessionCurve(evaluatedDataSeq);
           
        } catch (Exception exp) {
            System.err.println("Exception: " + exp.getMessage());
            return;
        }
       
        rCurve.determineBpoint();
       
        System.out.println("Second derivative: " + rCurve.getBPoint());
    }
View Full Code Here

TOP

Related Classes of adlzanchetta.hydrology.hydrographAnaliser.hydrographElements.RecessionCurve

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.