def test_bins(self): '''Test different bin sizes''' bin1 = np.arange(0, 40.5, 0.5) bin2 = np.arange(0, 40.1, 0.1) self.halfbins = toolbox.weibull_hourly(k=2, A=9, bins=bin1) self.tenthbins = toolbox.weibull_hourly(k=2, A=9, bins=bin2) nt.assert_greater_equal(8760, self.halfbins['Annual Hours'].sum()) nt.assert_less_equal(8755, self.halfbins['Annual Hours'].sum()) nt.assert_greater_equal(8760, self.tenthbins['Annual Hours'].sum()) nt.assert_less_equal(8755, self.tenthbins['Annual Hours'].sum())
# -*- coding: utf-8 -*- ''' Toolbox Examples: weibull_hourly: estimate the annual hours in each wind speed bin based on weibull k and A/Vmean ''' from climatic import toolbox #Using weibull A hour_distribution1 = toolbox.weibull_hourly(2.0, A=9.0) #Using weibull k hour_distribution2 = toolbox.weibull_hourly(2.0, Vmean=8.0)
def test_weib_hourly_AVmean(self): '''Test Vmean and k input''' self.weibullv = toolbox.weibull_hourly(k=2, Vmean=9) assert_almost_equal(self.weibullv, self.hourlyA) nt.assert_almost_equal(self.weibullv['Normalized'].sum(), 1)
def test_weib_hourly_Ak(self): '''Test A and k input''' self.weibull = toolbox.weibull_hourly(k=2, A=9) assert_almost_equal(self.weibull, self.hourlyA) nt.assert_almost_equal(self.weibull['Normalized'].sum(), 1)