diff --git a/RawDataProcessing/Modules/Submodules/get_grid.py b/RawDataProcessing/Modules/Submodules/get_grid.py index 4e3eaaa..cfad53f 100644 --- a/RawDataProcessing/Modules/Submodules/get_grid.py +++ b/RawDataProcessing/Modules/Submodules/get_grid.py @@ -13,6 +13,10 @@ import matplotlib.pyplot as plt import pandas as pd import numpy as np +from pybalmorel import Balmorel +from pybalmorel.utils import symbol_to_df +from Submodules.municipal_template import DataContainer +from clustering import convert_municipal_code_to_name style = 'report' diff --git a/RawDataProcessing/Modules/energinet_electricity.py b/RawDataProcessing/Modules/energinet_electricity.py index df9ba30..f5bcf7d 100644 --- a/RawDataProcessing/Modules/energinet_electricity.py +++ b/RawDataProcessing/Modules/energinet_electricity.py @@ -91,27 +91,29 @@ energinet_el.to_netcdf('Data/Timeseries/energinet_eldem.nc') if __name__ == '__main__': - # Example on merging with other data - x = DataContainer() - x.muni = x.muni.merge(energinet_el) - - - for user in x.muni.electricity_demand_mwh.coords['user']: - fig, ax = plt.subplots() - x.get_polygons().plot( - column=x.muni.electricity_demand_mwh.sum(dim=['year', 'week', 'hour']).sel(user=user).data, - legend=True, - ax=ax - ).set_title(str(user.data)) - - - dataset = convert_coordname_elements(energinet_el, - 'electricity_demand_mwh', - {'municipality' : 'R', - 'user' : 'DEUSER', - 'year' : 'Y', - 'week' : 'S', - 'hour' : 'T'}, - {'user' : {'industry' : 'PII', - 'public' : 'OTHER', - 'residential' : 'RESE'}}) + merge_example = False + if merge_example: + # Example on merging with other data + x = DataContainer() + x.muni = x.muni.merge(energinet_el) + + + for user in x.muni.electricity_demand_mwh.coords['user']: + fig, ax = plt.subplots() + x.get_polygons().plot( + column=x.muni.electricity_demand_mwh.sum(dim=['year', 'week', 'hour']).sel(user=user).data, + legend=True, + ax=ax + ).set_title(str(user.data)) + + + dataset = convert_coordname_elements(energinet_el, + 'electricity_demand_mwh', + {'municipality' : 'R', + 'user' : 'DEUSER', + 'year' : 'Y', + 'week' : 'S', + 'hour' : 'T'}, + {'user' : {'industry' : 'PII', + 'public' : 'OTHER', + 'residential' : 'RESE'}})