pik-piam / magpie4

R package | MAgPIE outputs R package for MAgPIE version 4.x
GNU Lesser General Public License v3.0
1 stars 23 forks source link

.filtermagpie #3

Closed bodirsky closed 4 years ago

bodirsky commented 4 years ago

beim ausführen der Funktion getReportMAgPIE2LPJmL in magpie4 bekomme ich folgenden Fehler in der subroutine .filtermagpie

Error in Ops.units(u1, u2) : operation | not allowed

die funktion ist folgende:

.tmp <- function(mstat,filter) { tmp <- FALSE for(f in filter) { tmp <- tmp | (mstat==f) } return(tmp) }

ich verstehen auch nciht was das hier tmp | (mstat==f) zurückliefern soll.

tmp [1] FALSE filter [1] 2 7 mstat An object of class "magpie" , , = main

 t
  y1995 y2000 y2005 y2010 y2015 y2020 y2025 y2030 y2035 y2040 y2045 y2050 y2055 y2060 y2070 y2080 y2090 y2100

GLO 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

ich glaube das geht nur mit einem modelstat, kann das sein?

tscheypidi commented 4 years ago

Did you run that part of code with metadata activated (withMetadata()=TRUE)? It looks to me that the metadata check for units failed in this case. If so, I would like to close the issue as metadata handling is still experimental and needs a major overhaul before it can be used productively.

tscheypidi commented 4 years ago

I forgot to mention: the line tmp | (mstat==f) is probably not very efficient but should work properly as it is executed in a for loop over all states filter. Hence, each filter state is tested separately, so that a vector of filter variables does not cause any problems with the == statement