JGCRI / gcamdata

The GCAM data system
https://jgcri.github.io/gcamdata/
Other
44 stars 26 forks source link

Take a more systematic approach to handling currency units #1224

Open pralitp opened 2 years ago

pralitp commented 2 years ago

There are a lot of unit conversions going on in gcamdata related to currency, mostly related dollar year deflator adjustments. Sometimes conversions happen before they enter gcamdata and in other cases they are input in their original dollar years (and hopefully documented in the comments what that dollar year is) then converted using the pipeline-helper function gdp_deflator.

In either case the conversion is applied ad hoc and prone to introducing subtle bugs. Having some formal approach would also allow us to change dollar years in GCAM which has long been a distant goal.

Some preliminary thoughts on a design:

russellhz commented 2 years ago

So if I'm understanding correctly: Whenever an input file contains a column with price units:

Sound right @pralitp?

pkyle commented 2 years ago

So to me the first step of this process is removing the 1990$ used in the C++ code, with its associated hard-wired unit conversions in the transportation and CO2 prices code (there's a constant called CVRT90 that does this; perhaps there are others). At that point there can be a single gcam dollar base year, and from that point, it shouldn't be too hard to automate the generation of the correct price units and the correct values to pass to gdp_deflator() whenever called in the gcamdata code.