JGCRI / gcamwrapper

An R / Python wrapper to interactively run a GCAM scenario
https://jgcri.github.io/gcamwrapper/
Other
9 stars 3 forks source link

7.0 query updates #30

Open whitenightZhang opened 1 month ago

whitenightZhang commented 1 month ago

Due to the 7.0 economic system update, the current query is not able to query economic system parameters such as gdp properly (haven't tried to see if this will also affect other queries).

pralitp commented 1 month ago

We should check all queries which may need updating.

GDP in particular is a bit more complicated due to the new Macro module introduced in GCAM 7.

The following is a good work around for the moment to get the GDP from the market query:

market_price_query = get_query("market", "price")
gdp_market = get_data(g, market_price_query, list("market" = c("=~", "GDP_Trial")))
gdp_region = gdp_market %>%
    mutate(region = gsub("GDP_Trial", "", market)) %>%
    select(region, year = `market-period`, gdp = price)
print(head(gdp_region))

Which produces:

# A tibble: 6 × 3
  region          year    gdp
  <chr>          <int>  <dbl>
1 Africa_Eastern  1975  28893
2 Africa_Eastern  1990  46850
3 Africa_Eastern  2005  85953
4 Africa_Eastern  2010 119402
5 Africa_Eastern  2015 151679
6 Africa_Eastern  2020 187112