Skip to content

Commit ddf764d

Browse files
authored
πŸ“¦ πŸš‘ Fixed a problem with multi-events + pandas version (#66)
Rebuilding production was incorrectly distributed in multiple events simulation, leading to more capital being rebuilt than what was possible. This is now fixed. Also, I loosened the restriction on pandas version.
1 parent 492b78b commit ddf764d

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

β€Žboario/model_base.pyβ€Ž

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,12 +1329,30 @@ def distribute_production(
13291329
)
13301330

13311331
elif h_reb:
1332-
house_shares = np.ones(house_reb_dem_tot_per_event.shape)
1332+
tot_reb_dem_divider = np.tile(
1333+
tot_rebuilding_demand_summed[:, np.newaxis],
1334+
(1, indus_reb_dem_tot_per_event.shape[1]),
1335+
)
1336+
house_shares = np.divide(
1337+
house_reb_dem_tot_per_event,
1338+
tot_reb_dem_divider,
1339+
out=np.zeros_like(house_reb_dem_tot_per_event),
1340+
where=tot_reb_dem_divider != 0,
1341+
)
13331342
indus_shares = np.zeros(indus_reb_dem_tot_per_event.shape)
13341343
elif ind_reb:
1344+
tot_reb_dem_divider = np.tile(
1345+
tot_rebuilding_demand_summed[:, np.newaxis],
1346+
(1, indus_reb_dem_tot_per_event.shape[1]),
1347+
)
1348+
indus_shares = np.divide(
1349+
indus_reb_dem_tot_per_event,
1350+
tot_reb_dem_divider,
1351+
out=np.zeros_like(indus_reb_dem_tot_per_event),
1352+
where=tot_reb_dem_divider != 0,
1353+
)
13351354
house_shares = np.zeros(house_reb_dem_tot_per_event.shape)
1336-
indus_shares = np.ones(indus_reb_dem_tot_per_event.shape)
1337-
# logger.debug("indus_shares: {}".format(indus_shares.shape))
1355+
13381356
else:
13391357
return []
13401358

β€Žpyproject.tomlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "boario"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
description = "BoARIO : The Adaptative Regional Input Output model in python."
55
authors = ["Samuel Juhel <pro@sjuhel.org>"]
66
license = "GNU General Public License v3 or later (GPLv3+)"
@@ -14,7 +14,7 @@ dask = ">=2023"
1414
numpy = "<1.24"
1515
numpyencoder = "^0.3.0"
1616
odfpy = "^1.4.1"
17-
pandas = ">=1.5,<2.0"
17+
pandas = ">=1.5"
1818
progressbar2 = "^4.2.0"
1919
pyarrow = ">=11"
2020
pymrio = ">=0.4"

0 commit comments

Comments
Β (0)