-
I am using the LitPop module to create exposure data of population ( I would like to add an option to the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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(total_values, shapes)
]) |
Beta Was this translation helpful? Give feedback.
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: