diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b088f33..6ad5f755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/digiplan/map/calculations.py b/digiplan/map/calculations.py index d27a0fe7..9b26b20c 100644 --- a/digiplan/map/calculations.py +++ b/digiplan/map/calculations.py @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/digiplan/map/charts.py b/digiplan/map/charts.py index 1154b61b..cba0409d 100644 --- a/digiplan/map/charts.py +++ b/digiplan/map/charts.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/digiplan/map/charts/capacity.json b/digiplan/map/charts/capacity.json index 4ed6881f..3d23f9e3 100644 --- a/digiplan/map/charts/capacity.json +++ b/digiplan/map/charts/capacity.json @@ -62,5 +62,10 @@ "name": "Bioenergie" } ], - "title": {"text": "Installierte Leistung nach Typ"} + "title": { + "text": "Installierte Leistung nach Typ", + "textStyle": { + "fontSize": 14 + } + } } diff --git a/digiplan/map/charts/electricity_demand.json b/digiplan/map/charts/electricity_demand.json index cb66df8b..a9910078 100644 --- a/digiplan/map/charts/electricity_demand.json +++ b/digiplan/map/charts/electricity_demand.json @@ -48,5 +48,10 @@ "name": "Industrie" } ], - "title": { "text": "Electricity Demand" } + "title": { + "text": "Electricity Demand", + "textStyle": { + "fontSize": 14 + } + } } diff --git a/digiplan/map/charts/heat_demand.json b/digiplan/map/charts/heat_demand.json index 852a33a3..0c132ca5 100644 --- a/digiplan/map/charts/heat_demand.json +++ b/digiplan/map/charts/heat_demand.json @@ -48,5 +48,10 @@ "name": "Industrie" } ], - "title": { "text": "Heat Demand" } + "title": { + "text": "Heat Demand", + "textStyle": { + "fontSize": 14 + } + } } diff --git a/digiplan/map/charts/population.json b/digiplan/map/charts/population.json index 5e0f6648..70d130a6 100644 --- a/digiplan/map/charts/population.json +++ b/digiplan/map/charts/population.json @@ -24,5 +24,10 @@ "name": "EW" } ], - "title": {"text": "Bevölkerung pro Jahr"} + "title": { + "text": "Bevölkerung pro Jahr", + "textStyle": { + "fontSize": 14 + } + } } diff --git a/digiplan/map/charts/wind_turbines.json b/digiplan/map/charts/wind_turbines.json index d57e61c8..71104573 100644 --- a/digiplan/map/charts/wind_turbines.json +++ b/digiplan/map/charts/wind_turbines.json @@ -24,5 +24,10 @@ "name": "Windenergieanlagen" } ], - "title": { "text": "Anzahl Windenergieanlagen" } + "title": { + "text": "Anzahl Windenergieanlagen", + "textStyle": { + "fontSize": 14 + } + } } diff --git a/digiplan/map/popups.py b/digiplan/map/popups.py index e4c635e5..a5e54cb4 100644 --- a/digiplan/map/popups.py +++ b/digiplan/map/popups.py @@ -216,7 +216,7 @@ class CapacityPopup(RegionPopup): title = "Installierte Leistung EE" def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.capacities_per_municipality() + return calculations.capacities_per_municipality().round(1) class Capacity2045Popup(RegionPopup): @@ -236,8 +236,8 @@ def get_chart_options(self) -> dict: def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.capacities_per_municipality().loc[self.selected_id] - future_data = super().get_chart_data() + status_quo_data = calculations.capacities_per_municipality().loc[self.selected_id].round(1) + future_data = super().get_chart_data().round(1) return list(zip(status_quo_data, future_data)) @@ -250,7 +250,7 @@ class CapacitySquarePopup(RegionPopup): def get_detailed_data(self) -> pd.DataFrame: """Return capacities per square kilometer.""" capacities = calculations.capacities_per_municipality() - return calculations.calculate_square_for_value(capacities) + return calculations.calculate_square_for_value(capacities).round(2) def get_chart_options(self) -> dict: """Overwrite title and unit.""" @@ -281,10 +281,12 @@ def get_chart_options(self) -> dict: def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.calculate_square_for_value(calculations.capacities_per_municipality()).loc[ - self.selected_id - ] - future_data = super().get_chart_data() + status_quo_data = ( + calculations.calculate_square_for_value(calculations.capacities_per_municipality()) + .loc[self.selected_id] + .round(2) + ) + future_data = super().get_chart_data().round(2) return list(zip(status_quo_data, future_data)) @@ -295,7 +297,7 @@ class EnergyPopup(RegionPopup): title = _("Gewonnene Energie aus EE") def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.energies_per_municipality() + return calculations.energies_per_municipality().round(1) def get_chart_options(self) -> dict: """Overwrite title and unit.""" @@ -324,8 +326,8 @@ def get_chart_options(self) -> dict: def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.energies_per_municipality().loc[self.selected_id] - future_data = super().get_chart_data() * 1e-3 + status_quo_data = calculations.energies_per_municipality().loc[self.selected_id].round(1) + future_data = (super().get_chart_data() * 1e-3).round(1) return list(zip(status_quo_data, future_data)) @@ -377,7 +379,7 @@ class EnergyCapitaPopup(RegionPopup): title = _("Gewonnene Energie pro EW") def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.calculate_capita_for_value(calculations.energies_per_municipality()) * 1e3 + return (calculations.calculate_capita_for_value(calculations.energies_per_municipality()) * 1e3).round(1) def get_chart_options(self) -> dict: """Overwrite title and unit.""" @@ -408,10 +410,12 @@ def get_chart_options(self) -> dict: def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.calculate_capita_for_value(calculations.energies_per_municipality()).loc[ - self.selected_id - ] - future_data = super().get_chart_data() * 1e-3 + status_quo_data = ( + calculations.calculate_capita_for_value(calculations.energies_per_municipality()) + .loc[self.selected_id] + .round(1) + ) + future_data = (super().get_chart_data() * 1e-3).round(1) return list(zip(status_quo_data, future_data)) @@ -422,7 +426,7 @@ class EnergySquarePopup(RegionPopup): title = _("Gewonnene Energie pro km²") def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.calculate_square_for_value(calculations.energies_per_municipality()) * 1e3 + return (calculations.calculate_square_for_value(calculations.energies_per_municipality()) * 1e3).round(1) def get_chart_options(self) -> dict: """Overwrite title and unit.""" @@ -453,10 +457,12 @@ def get_chart_options(self) -> dict: def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.calculate_square_for_value(calculations.energies_per_municipality()).loc[ - self.selected_id - ] - future_data = super().get_chart_data() * 1e-3 + status_quo_data = ( + calculations.calculate_square_for_value(calculations.energies_per_municipality()) + .loc[self.selected_id] + .round(1) + ) + future_data = (super().get_chart_data() * 1e-3).round(1) return list(zip(status_quo_data, future_data)) @@ -488,7 +494,7 @@ class PopulationDensityPopup(RegionPopup): def get_detailed_data(self) -> pd.DataFrame: """Return population data squared.""" population = models.Population.quantity_per_municipality_per_year() - return calculations.calculate_square_for_value(population) + return calculations.calculate_square_for_value(population).round(1) def get_municipality_value(self) -> Optional[float]: """Return municipality value for status quo year.""" @@ -658,10 +664,12 @@ def get_chart_options(self) -> dict: def get_chart_data(self) -> Iterable: """Return single value for wind turbines in current municipality.""" - status_quo_data = calculations.calculate_square_for_value(models.WindTurbine.quantity_per_municipality()).loc[ - self.selected_id - ] - future_data = super().get_chart_data() + status_quo_data = ( + calculations.calculate_square_for_value(models.WindTurbine.quantity_per_municipality()) + .loc[self.selected_id] + .round(1) + ) + future_data = super().get_chart_data().round(1) return [float(status_quo_data), float(future_data)] @@ -672,7 +680,7 @@ class ElectricityDemandPopup(RegionPopup): title = _("Strombedarf") def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.electricity_demand_per_municipality() + return calculations.electricity_demand_per_municipality().round(1) def get_chart_options(self) -> dict: """Overwrite title and unit.""" @@ -693,8 +701,8 @@ def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.electricity_demand_per_municipality().loc[self.selected_id] - future_data = super().get_chart_data() + status_quo_data = calculations.electricity_demand_per_municipality().loc[self.selected_id].round(1) + future_data = super().get_chart_data().round(1) return list(zip(status_quo_data, future_data)) def get_chart_options(self) -> dict: @@ -713,7 +721,9 @@ class ElectricityDemandCapitaPopup(RegionPopup): title = _("Strombedarf je EinwohnerIn") def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.calculate_capita_for_value(calculations.electricity_demand_per_municipality()) * 1e6 + return ( + calculations.calculate_capita_for_value(calculations.electricity_demand_per_municipality()) * 1e6 + ).round(1) def get_region_value(self) -> float: # noqa: D102 return self.detailed_data.sum(axis=1).mean() @@ -742,10 +752,14 @@ def get_region_value(self) -> float: # noqa: D102 def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.calculate_capita_for_value( - calculations.electricity_demand_per_municipality(), - ).loc[self.selected_id] - future_data = super().get_chart_data() + status_quo_data = ( + calculations.calculate_capita_for_value( + calculations.electricity_demand_per_municipality(), + ) + .loc[self.selected_id] + .round(1) + ) + future_data = super().get_chart_data().round(1) return list(zip(status_quo_data, future_data)) def get_chart_options(self) -> dict: @@ -764,7 +778,7 @@ class HeatDemandPopup(RegionPopup): title = _("Wärmebedarf") def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.heat_demand_per_municipality() + return calculations.heat_demand_per_municipality().round(1) def get_chart_options(self) -> dict: """Overwrite title and unit.""" @@ -785,8 +799,8 @@ def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.heat_demand_per_municipality().loc[self.selected_id] - future_data = super().get_chart_data() + status_quo_data = calculations.heat_demand_per_municipality().loc[self.selected_id].round(1) + future_data = super().get_chart_data().round(1) return list(zip(status_quo_data, future_data)) def get_chart_options(self) -> dict: @@ -805,7 +819,7 @@ class HeatDemandCapitaPopup(RegionPopup): title = _("Wärmebedarf je EinwohnerIn") def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 - return calculations.calculate_capita_for_value(calculations.heat_demand_per_municipality()) * 1e6 + return (calculations.calculate_capita_for_value(calculations.heat_demand_per_municipality()) * 1e6).round(1) def get_region_value(self) -> float: # noqa: D102 return self.detailed_data.sum(axis=1).mean() @@ -827,17 +841,22 @@ class HeatDemandCapita2045Popup(RegionPopup): def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 return calculations.calculate_capita_for_value( calculations.heat_demand_per_municipality_2045(self.map_state["simulation_id"]), - ) + ).mul(1e6) def get_region_value(self) -> float: # noqa: D102 return self.detailed_data.sum(axis=1).mean() def get_chart_data(self) -> Iterable: """Create capacity chart data for SQ and future scenario.""" - status_quo_data = calculations.calculate_capita_for_value( - calculations.heat_demand_per_municipality(), - ).loc[self.selected_id] - future_data = super().get_chart_data() + status_quo_data = ( + calculations.calculate_capita_for_value( + calculations.heat_demand_per_municipality(), + ) + .loc[self.selected_id] + .mul(1e6) + .round(1) + ) + future_data = super().get_chart_data().round(1) return list(zip(status_quo_data, future_data)) def get_chart_options(self) -> dict: @@ -882,7 +901,7 @@ def get_detailed_data(self) -> pd.DataFrame: # noqa: D102 def get_chart_data(self) -> Iterable: """Return single value for employeess in current municipality.""" - return [int(self.detailed_data.loc[self.selected_id])] + return [self.detailed_data.loc[self.selected_id].round(1)] def get_chart_options(self) -> dict: """Overwrite title and unit."""