def fig_scaled_electricity_profile(): """ Comparison of different methods to fetch the annual electricity demand to scale the entso-e profile. """ ax = plt.figure(figsize=(8, 4)).add_subplot(1, 1, 1) fs = geometries.get_federal_states_polygon() p = pd.Series() p1 = demand_elec.get_entsoe_profile_by_region(fs, 2014, "test", "entsoe") p["entsoe"] = p1.sum().sum() p2 = demand_elec.get_entsoe_profile_by_region(fs, 2013, "test", "bmwi") p["bmwi"] = p2.sum().sum() p3 = demand_elec.get_entsoe_profile_by_region(fs, 2013, "test", "openego") p["openego"] = p3.sum().sum() p4 = demand_elec.get_entsoe_profile_by_region(fs, 2011, "test", 555555) p["user value"] = p4.sum().sum() p.plot(kind="bar", ax=ax) plt.xticks(rotation=0) ax.set_ylabel("energy demand [GWh]") plt.title("Energy demand of Germany to scale the overall demand.") plt.subplots_adjust(right=0.95, left=0.13, bottom=0.13, top=0.91) return "scaled_electricity_profile"
def test_profile_by_region_with_wrong_annual_values(self): msg = ( "200 of type <class 'str'> is not a valid input for " "'annual_demand'" ) with assert_raises_regexp(ValueError, msg): demand_elec.get_entsoe_profile_by_region( self.geo, 2011, "test", "200" )
def scenario_elec_demand(table, regions, year, name, weather_year=None): """ Parameters ---------- table regions year name weather_year Returns ------- """ if weather_year is None: demand_year = year else: demand_year = weather_year df = demand_elec.get_entsoe_profile_by_region(regions, demand_year, name, annual_demand="bmwi") df = pd.concat([df], axis=1, keys=["electrical_load"]).swaplevel(0, 1, 1) df = df.reset_index(drop=True) if not calendar.isleap(year) and len(df) > 8760: df = df.iloc[:8760] return pd.concat([table, df], axis=1).sort_index(1)
def fig_electricity_profile_from_entsoe(): """ Electricity profile from entso-e scaled on the annual demand of three different federal states. """ ax = plt.figure(figsize=(10, 4)).add_subplot(1, 1, 1) fs = geometries.get_federal_states_polygon() df = demand_elec.get_entsoe_profile_by_region(fs, 2014, "federal_states", "bmwi") df[["NW", "NI", "MV"]].mul(1000).plot(ax=ax) plt.title("Demand profile for three federal states in 2014") ax.set_ylabel("electricity demand [GW]") ax.set_xlabel("hour of the year") box = ax.get_position() ax.set_position([box.x0, box.y0, box.width * 0.8, box.height]) ax.legend(loc="upper left", bbox_to_anchor=(1, 0.5)) plt.subplots_adjust(right=0.91, left=0.08, bottom=0.13, top=0.91) return "electricity_profile_from_entsoe"
def test_profile_by_region_with_user_annual_values(self): d4 = demand_elec.get_entsoe_profile_by_region( self.geo, 2011, "test", 200 ) eq_(int(round(d4.sum().sum(), 0)), 200)
def test_profile_by_region_with_openego_annual_values(self): d3 = demand_elec.get_entsoe_profile_by_region( self.geo, 2013, "test", "openego" ) eq_(int(d3.sum().sum()), 31726254)
def test_profile_by_region_with_bmwi_annual_values(self): d2 = demand_elec.get_entsoe_profile_by_region( self.geo, 2013, "test", "bmwi" ) eq_(int(d2.sum().sum()), 535684999)
def test_profile_by_region_with_entsoe_annual_values(self): d1 = demand_elec.get_entsoe_profile_by_region( self.geo, 2014, "test", "entsoe" ) eq_(int(d1.sum().sum()), 519752444)
def test_profile_by_region_with_entsoe_annual_values(self): d1 = demand_elec.get_entsoe_profile_by_region(self.geo, 2016, "test", "entsoe") eq_(round(d1.sum().sum() / 1e6, 1), 487.0) # TWh