Skip to content

Disaggregate LitPop values to custom shapes/regions #723

Answered by peanutfun
peanutfun asked this question in Q&A
Discussion options

You must be logged in to vote

I found a workaround with the current set of methods. Its only issue is that it has to execute the LitPop creation algorithm twice, which means double the runtime although both calls query the same information. Here's how it works:

from climada.entity.exposures import LitPop

shapes = [...]  # Any list of shapes for which you want the population to remain constant

# Calculate the total population for each shape
total_values = [
    LitPop.from_shape(shape, exponents=(0, 1), total_value=None).gdf["value"].sum() for shape in shapes
]

# Plug that into the actual exposure calculation
exp = LitPop.concat([
    LitPop.from_shape(shape, exponents=(1, 1), total_value=val) for val, shape in zip(t…

Replies: 1 comment

Comment options

peanutfun
May 11, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by peanutfun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
1 participant
Converted from issue

This discussion was converted from issue #715 on May 16, 2023 12:43.