IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
222 stars 116 forks source link

support growth rate calculations for variables starting from 0 #667

Open gidden opened 2 years ago

gidden commented 2 years ago

The current compute.growth_rate assumes that all variables have a positive, non-zero value in the first year available in the dataframe. For variables that are initially 0, but begin to increase at some point within the analyzed period, the following error is raised:

ValueError: Cannot compute growth rate when timeseries crosses 0:

We should probably support growth rate calculations where growth starts mid-period. I'll try to tackle this, but also wanted to flag here.

danielhuppmann commented 2 years ago

Just keep in mind that the growth rate from 0 to any positive value is infinite. This is why I opted for the "safe" approach in the first implementation.