Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

unit format US$2005/(tCO2/yr) does not conform to magclass unit format #118

Open
0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q opened this issue Feb 12, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q
Copy link
Member

remind/R/reportTechnology.R

Lines 233 to 238 in 6dad76d

if(CDR_mod != "off"){
unit <- "US$2005/(tCO2/yr)"
factor <- 1000/3.6
tmp <- bind_category(tmp, v_investcost, category, unit, factor, cdrmap)
int2ext <- c(int2ext, get_global_mapping(category, unit, cdrmap))
}

The unit US$2005/(tCO2/yr) breaks the magclass unit convention, which does not support nested parentheses. Specifically

library(remind)
library(quitte)

a <- convGDX2MIF(gdx = './tests/testgdxs/fulldata.gdx')

as.quitte(a)
Error in magclass::`getNames<-`(`*tmp*`, value = sub(" \\(([^\\()]*)\\)($|\\.)",  : 
  Inconsistent names! Number of dots per name has always to be the same as it is separating different data dimensions
In addition: There were 21 warnings (use warnings() to see them)

as.quitte(a[,,'(US$2005/(tCO2/yr))', pmatch = TRUE, invert = TRUE])
# A tibble: 371,241 x 7
   model  scenario region variable    unit               period value
   <fct>  <fct>    <fct>  <fct>       <fct>               <int> <dbl>
 1 REMIND default  CAZ    Consumption billion US$2005/yr   2005 1123.
 2 REMIND default  CHA    Consumption billion US$2005/yr   2005 1625.
 3 REMIND default  EUR    Consumption billion US$2005/yr   2005 8759.
 4 REMIND default  IND    Consumption billion US$2005/yr   2005  520.
 5 REMIND default  JPN    Consumption billion US$2005/yr   2005 3031.
 6 REMIND default  LAM    Consumption billion US$2005/yr   2005 1867.
 7 REMIND default  MEA    Consumption billion US$2005/yr   2005  985.
 8 REMIND default  NEU    Consumption billion US$2005/yr   2005  942.
 9 REMIND default  OAS    Consumption billion US$2005/yr   2005 1324.
10 REMIND default  REF    Consumption billion US$2005/yr   2005  597.
# … with 371,231 more rows
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants