Skip to content

Building quintiles#612

Merged
frede-arp merged 15 commits into
developmentfrom
building_quintiles
May 26, 2026
Merged

Building quintiles#612
frede-arp merged 15 commits into
developmentfrom
building_quintiles

Conversation

@frede-arp

Copy link
Copy Markdown
Contributor
  1. added better historic population data (per IMAGE region from 1700): https://ourworldindata.org/grapher/population
  2. added income quintiles for building material calculations
  3. therefore basically the whole population calcaultion was redone
  4. some refactoring for floorspace, to also incorporate the income quintiles
  5. therefore new prism model needed as new dimension added
  6. changed the building examples accordingly

@frede-arp frede-arp requested a review from lujakockritz May 22, 2026 11:24

@lujakockritz lujakockritz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some small changes to documentation that should be done.

I also have some questions about the design, especially the addition of the two new prism models, mostly from a maintenance perspective. But I cannot follow the entire implementation sufficiently at the moment to judge if these classes are indeed needed.

otherwise nice that the data was updated!

Comment thread imagematerials/buildings/preprocessing/main.py
Comment thread imagematerials/buildings/preprocessing/main.py Outdated
Returns
-------
xr.DataArray
Combined population array with dimensions ``("Area", "Quintile", "Time", "Region")``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why we need the new Quintile dimension. However, I am wondering of that could lead to issues with harmonization across sectors later. But that is mostly just a thought not a critique on this code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

"""Compute the population throught time for all regions, and rural/urban.

def _equalize_quintiles(population_split: xr.DataArray, q_labels: list[str], target_area: str) -> xr.DataArray:
"""Set all quintiles in a group to equal shares of a target area.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this description is not fully understandable. Could you add another sentence as to why all quintiles get an equal share?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quintiles are per definition an equal share. SO every population quintile is the same amount of people. For historic years, where we do not have image population, these were first extrapolated according regions, rural, urban and then equalized alond the quintiles

}

area_labels = {
1: "Total",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically it looks like this could be done using a knowledge graph too using the quintiles and sub categories of urban-rural which sums up to total.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the labels are used in a context outside of knowledge graph, But yes, could be done later

Comment thread imagematerials/model.py
class StocksQuintiles(prism.Model):
"""Stock class that can be used for different products.
A model class for managing stocks and their inflows and outflows over time,
including the computation of initial and dynamic stock values based on input data.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe still add the quintiles part to this description?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread imagematerials/model.py
Type: prism.Coords[STOCK_TYPE]
Cohort: prism.Coords[COHORT]
Time: prism.Coords[TIME]
Quintile: prism.Coords[QUINTILE]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the main difference to the previous stock class that the quintile dimension was added? if so maybe we could simplify by making the previous class able to include that instead of creating a new class?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a prism problem.
All dimensions used need to be determined in the class. So this is just not possible.
In the vehicles model e.g. you also need to specifiy SuperType and Type as Dimensions.

Comment thread imagematerials/model.py
"""
A model class for managing materials used in stock cohorts, including
inflows and outflows of materials. This version uses material intensities
(material per unit of stock) instead of weights and material fractions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing a description as to why we need this additional class to allow for the quintile calculation. So same question as for the stock class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added, see comment above

@frede-arp frede-arp requested a review from lujakockritz May 26, 2026 08:43
@frede-arp frede-arp merged commit 68723ca into development May 26, 2026
1 check passed
@frede-arp frede-arp deleted the building_quintiles branch May 26, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants