pik-piam / remind

Contains the REMIND-specific routines for data and model output manipulation.
3 stars 18 forks source link

63f2492 breaks reporting for industry subsectors #41

Closed 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q closed 4 years ago

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 4 years ago

Error in x@.Data[i, j, , drop = FALSE] : subscript out of bounds

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 4 years ago

Because of doubled tall dimension names from https://github.com/pik-piam/remind/blob/6510589b8f513a5381caf71ba8a321f792c67772/R/reportFE.R#L132 since adding magclasses with differing dimensions crosses those dimensions, and industry/subsectors gdxes have some ghost data in early periods.

> str(vm_cesIO)
Formal class 'magpie' [package "magclass"] with 1 slot
  ..@ .Data: num [1:12, 1:40, 1:77] 0 NA NA NA NA NA NA NA NA NA ...
  .. ..- attr(*, "dimnames")=List of 3
  .. .. ..$ all_regi: chr [1:12] "EUR" "CAZ" "CHA" "IND" ...
  .. .. ..$ tall    : chr [1:40] "y1900" "y1905" "y1910" "y1915" ...
  .. .. ..$ all_in  : chr [1:77] "fega_cement" "feh2_cement" "fega_chemicals" "feh2_chemicals" ...

> str(offset[,y,getNames(vm_cesIO)])
Formal class 'magpie' [package "magclass"] with 1 slot
  ..@ .Data: num [1:12, 1:19, 1:77] 0 0 0 0 0 0 0 0 0 0 ...
  .. ..- attr(*, "dimnames")=List of 3
  .. .. ..$ all_regi: chr [1:12] "CAZ" "CHA" "EUR" "IND" ...
  .. .. ..$ tall    : chr [1:19] "y2005" "y2010" "y2015" "y2020" ...
  .. .. ..$ all_in  : chr [1:77] "fega_cement" "feh2_cement" "fega_chemicals" "feh2_chemicals" ...

> str(vm_cesIO + offset[,y,getNames(vm_cesIO)])
Formal class 'magpie' [package "magclass"] with 1 slot
  ..@ .Data: num [1:12, 1:760, 1:77] 0 NA NA NA NA NA NA NA NA NA ...
  .. ..- attr(*, "dimnames")=List of 3
  .. .. ..$ all_regi  : chr [1:12] "EUR" "CAZ" "CHA" "IND" ...
  .. .. ..$ tall.tall1: chr [1:760] "y1900.y2005" "y1900.y2010" "y1900.y2015" "y1900.y2020" ...
  .. .. ..$ all_in    : chr [1:77] "fega_cement" "feh2_cement" "fega_chemicals" "feh2_chemicals" ...