def test_dist_params(self):
        catchment = from_file('floodestimation/tests/data/37017.CD3')

        analysis = GrowthCurveAnalysis(catchment)
        growth_curve = analysis.growth_curve(method='single_site')
        params = growth_curve.params

        self.assertAlmostEqual(params['loc'], 1)
        self.assertAlmostEqual(params['scale'], 0.2202, places=4)
        self.assertAlmostEqual(params['k'], 0.0908, places=4)
        # Kurtosis calculated from L-skew using eqns on
        # http://researcher.watson.ibm.com/researcher/view_group.php?id=2639
        self.assertAlmostEqual(growth_curve.distr_kurtosis, 0.1735, places=4)
    def test_dist_params(self):
        catchment = from_file('floodestimation/tests/data/37017.CD3')

        analysis = GrowthCurveAnalysis(catchment)
        growth_curve = analysis.growth_curve(method='single_site')
        params = growth_curve.params

        self.assertAlmostEqual(params['loc'], 1)
        self.assertAlmostEqual(params['scale'], 0.2202, places=4)
        self.assertAlmostEqual(params['k'], 0.0908, places=4)
        # Kurtosis calculated from L-skew using eqns on
        # http://researcher.watson.ibm.com/researcher/view_group.php?id=2639
        self.assertAlmostEqual(growth_curve.distr_kurtosis, 0.1735, places=4)
    def run_growthcurve(self):
        results = {}

        analysis = GrowthCurveAnalysis(self.catchment, self.gauged_catchments, results_log=results)
        gc = analysis.growth_curve()

        aeps = [0.5, 0.2, 0.1, 0.05, 0.03333, 0.02, 0.01333, 0.01, 0.005, 0.002, 0.001]
        growth_factors = gc(aeps)
        flows = growth_factors * self.qmed

        results['aeps'] = aeps
        results['growth_factors'] = growth_factors
        results['flows'] = flows
        self.results['gc'] = results
    def _run_growthcurve(self):
        results = {}

        analysis = GrowthCurveAnalysis(self.catchment,
                                       self.gauged_catchments,
                                       results_log=results)
        gc = analysis.growth_curve()

        aeps = [
            0.5, 0.2, 0.1, 0.05, 0.03333, 0.02, 0.01333, 0.01, 0.005, 0.002,
            0.001
        ]
        growth_factors = gc(aeps)
        flows = growth_factors * self.qmed

        results['aeps'] = aeps
        results['growth_factors'] = growth_factors
        results['flows'] = flows
        self.results['gc'] = results
 def test_single_site_gev(self):
     gauged_catchments = CatchmentCollections(self.db_session)
     catchment = from_file('floodestimation/tests/data/37017.CD3')
     analysis = GrowthCurveAnalysis(catchment, gauged_catchments)
     dist_func = analysis.growth_curve(method='single_site', distr='gev')
     self.assertAlmostEqual(dist_func(0.5), 1)
    def test_dist_param_location(self):
        catchment = from_file('floodestimation/tests/data/37017.CD3')

        analysis = GrowthCurveAnalysis(catchment)
        growth_curve = analysis.growth_curve(method='single_site')
        self.assertAlmostEqual(growth_curve(0.5), 1)
 def test_single_site_gev(self):
     gauged_catchments = CatchmentCollections(self.db_session)
     catchment = from_file('floodestimation/tests/data/37017.CD3')
     analysis = GrowthCurveAnalysis(catchment, gauged_catchments)
     dist_func = analysis.growth_curve(method='single_site', distr='gev')
     self.assertAlmostEqual(dist_func(0.5), 1)
    def test_dist_param_location(self):
        catchment = from_file('floodestimation/tests/data/37017.CD3')

        analysis = GrowthCurveAnalysis(catchment)
        growth_curve = analysis.growth_curve(method='single_site')
        self.assertAlmostEqual(growth_curve(0.5), 1)