Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi committed Dec 3, 2023
2 parents 0b1baa8 + ec882e4 commit acb9b3c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions premise/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,7 @@ def check_biomass_markets(self):
[
x["amount"]
for x in ds["exchanges"]
if x["type"] == "technosphere"
and x["unit"] == "kilogram"
if x["type"] == "technosphere" and x["unit"] == "kilogram"
]
)
if total < 0.99 or total > 1.1:
Expand All @@ -1011,9 +1010,10 @@ def check_residual_biomass_share(self):
and ds["location"] in self.regions
and ds["location"] != "World"
):

expected_share = self.iam_data.biomass_markets.sel(
variables="biomass - residual", year=self.year, region=ds["location"]
variables="biomass - residual",
year=self.year,
region=ds["location"],
).values.item(0)

residual_biomass = sum(
Expand All @@ -1029,12 +1029,14 @@ def check_residual_biomass_share(self):
[
x["amount"]
for x in ds["exchanges"]
if x["type"] == "technosphere"
and x["unit"] == "kilogram"
if x["type"] == "technosphere" and x["unit"] == "kilogram"
]
)
# check that the total is roughly equal to the IAM projection
if math.isclose(residual_biomass / total, expected_share, rel_tol=0.01) is False:
if (
math.isclose(residual_biomass / total, expected_share, rel_tol=0.01)
is False
):
message = f"Residual biomass share incorrect: {residual_biomass / total} instead of {expected_share}."
self.write_log(
ds,
Expand Down

0 comments on commit acb9b3c

Please sign in to comment.