Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/#367 fix texts charts units #369

Merged
merged 7 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe
- RES share calculation for SQ
- power and heat demand scaling for future scenario
- swap mapping of PV roof and PV ground in result calculation
- heat per capita calculation in results
- round chart values to decent fps

## [0.6.0] - 2023-09-01
### Added
Expand Down
12 changes: 6 additions & 6 deletions digiplan/map/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def capacities_per_municipality_2045(simulation_id: int) -> pd.DataFrame:
renewables = renewables * calculate_potential_shares(parameters)
renewables["bioenergy"] = 0.0
renewables["st"] = 0.0
return renewables
return renewables.astype(float)


def energies_per_municipality() -> pd.DataFrame:
Expand Down Expand Up @@ -195,7 +195,7 @@ def energies_per_municipality_2045(simulation_id: int) -> pd.DataFrame:
renewables = renewables * calculate_potential_shares(parameters)
renewables["bioenergy"] = 0.0
renewables["st"] = 0.0
return renewables
return renewables.astype(float)


def energy_shares_per_municipality() -> pd.DataFrame:
Expand Down Expand Up @@ -250,7 +250,7 @@ def electricity_demand_per_municipality(year: int = 2022) -> pd.DataFrame:
_("Electricity CTS Demand"),
_("Electricity Industry Demand"),
]
return demands_per_sector * 1e-3
return demands_per_sector.astype(float) * 1e-3


def energy_shares_2045_per_municipality(simulation_id: int) -> pd.DataFrame:
Expand Down Expand Up @@ -320,7 +320,7 @@ def electricity_demand_per_municipality_2045(simulation_id: int) -> pd.DataFrame
demand = sector_shares * demand.values
demand.columns = demand.columns.map(lambda column: config.SIMULATION_DEMANDS[mappings[column]])
demand = demand * 1e-3
return demand
return demand.astype(float)


def heat_demand_per_municipality() -> pd.DataFrame:
Expand All @@ -342,7 +342,7 @@ def heat_demand_per_municipality() -> pd.DataFrame:
_("Electricity CTS Demand"),
_("Electricity Industry Demand"),
]
return demands_per_sector * 1e-3
return demands_per_sector.astype(float) * 1e-3


def heat_demand_per_municipality_2045(simulation_id: int) -> pd.DataFrame:
Expand Down Expand Up @@ -376,7 +376,7 @@ def heat_demand_per_municipality_2045(simulation_id: int) -> pd.DataFrame:
demand = sector_shares * demand.values
demand.columns = demand.columns.map(lambda column: config.SIMULATION_DEMANDS[mappings[column]])
demand = demand * 1e-3
return demand
return demand.astype(float)


def ghg_reduction(simulation_id: int) -> pd.Series:
Expand Down
62 changes: 31 additions & 31 deletions digiplan/map/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
return chart_options


Expand All @@ -316,7 +316,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("EW/km²")
return chart_options

Expand All @@ -333,7 +333,7 @@ def get_chart_data(self) -> list:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = "Beschäftigte"
del chart_options["series"][0]["name"]
return chart_options
Expand All @@ -351,7 +351,7 @@ def get_chart_data(self) -> list:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = "Betriebe"
del chart_options["series"][0]["name"]
return chart_options
Expand All @@ -369,7 +369,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
return chart_options


Expand All @@ -388,7 +388,7 @@ def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
return chart_options


Expand All @@ -410,7 +410,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("MW")
return chart_options

Expand Down Expand Up @@ -444,7 +444,7 @@ def get_chart_options(self) -> dict:
chart_options = super().get_chart_options()
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
chart_options["yAxis"]["name"] = _("MW")
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
return chart_options


Expand All @@ -460,7 +460,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("GWh")
return chart_options

Expand All @@ -480,7 +480,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("GWh")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -498,7 +498,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("%")
return chart_options

Expand All @@ -517,7 +517,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("%")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -540,7 +540,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("MWh")
return chart_options

Expand Down Expand Up @@ -573,7 +573,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("MWh")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -596,7 +596,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("MWh")
return chart_options

Expand Down Expand Up @@ -629,7 +629,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("MWh")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -647,7 +647,7 @@ def get_chart_data(self) -> list[int]:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
return chart_options


Expand All @@ -666,7 +666,7 @@ def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
chart_options["xAxis"]["data"] = ["2022", "Dein Szenario"]
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
return chart_options


Expand All @@ -690,7 +690,7 @@ def get_chart_data(self) -> list[float]:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = "Anzahl Windenergieanlagen"
return chart_options

Expand Down Expand Up @@ -724,7 +724,7 @@ def get_chart_data(self) -> list[float]:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = ""
chart_options["xAxis"]["data"] = ["2022", "Dein Szenario"]
return chart_options
Expand All @@ -742,7 +742,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("GWh")
return chart_options

Expand All @@ -763,7 +763,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("GWh")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -786,7 +786,7 @@ def get_chart_data(self) -> pd.DataFrame:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("kWh")
return chart_options

Expand Down Expand Up @@ -821,7 +821,7 @@ def get_chart_data(self) -> pd.DataFrame:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("kWh")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -839,7 +839,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("GWh")
return chart_options

Expand All @@ -858,7 +858,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("GWh")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -881,7 +881,7 @@ def get_chart_data(self) -> None:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("kWh")
return chart_options

Expand Down Expand Up @@ -916,7 +916,7 @@ def get_chart_data(self) -> pd.DataFrame:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("kWh")
chart_options["xAxis"]["data"] = ["2022", "Dein\nSzenario"]
return chart_options
Expand All @@ -934,7 +934,7 @@ def get_chart_data(self) -> list:
def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("Anzahl")
del chart_options["series"][0]["name"]
return chart_options
Expand All @@ -947,12 +947,12 @@ class BatteriesCapacityRegionChart(Chart):

def get_chart_data(self) -> list:
"""Calculate population for whole region."""
return [int(calculations.battery_capacities_per_municipality().sum())]
return [calculations.battery_capacities_per_municipality().sum().round(1)]

def get_chart_options(self) -> dict:
"""Overwrite title and unit."""
chart_options = super().get_chart_options()
del chart_options["title"]["text"]
chart_options["title"]["text"] = "Region ABW"
chart_options["yAxis"]["name"] = _("MWh")
del chart_options["series"][0]["name"]
return chart_options
Expand Down
7 changes: 6 additions & 1 deletion digiplan/map/charts/capacity.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@
"name": "Bioenergie"
}
],
"title": {"text": "Installierte Leistung nach Typ"}
"title": {
"text": "Installierte Leistung nach Typ",
"textStyle": {
"fontSize": 14
}
}
}
7 changes: 6 additions & 1 deletion digiplan/map/charts/electricity_demand.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@
"name": "Industrie"
}
],
"title": { "text": "Electricity Demand" }
"title": {
"text": "Electricity Demand",
"textStyle": {
"fontSize": 14
}
}
}
7 changes: 6 additions & 1 deletion digiplan/map/charts/heat_demand.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@
"name": "Industrie"
}
],
"title": { "text": "Heat Demand" }
"title": {
"text": "Heat Demand",
"textStyle": {
"fontSize": 14
}
}
}
7 changes: 6 additions & 1 deletion digiplan/map/charts/population.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@
"name": "EW"
}
],
"title": {"text": "Bevölkerung pro Jahr"}
"title": {
"text": "Bevölkerung pro Jahr",
"textStyle": {
"fontSize": 14
}
}
}
7 changes: 6 additions & 1 deletion digiplan/map/charts/wind_turbines.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@
"name": "Windenergieanlagen"
}
],
"title": { "text": "Anzahl Windenergieanlagen" }
"title": {
"text": "Anzahl Windenergieanlagen",
"textStyle": {
"fontSize": 14
}
}
}
Loading