pik-piam / remind2

The remind2 package contains the REMIND-specific routines for data and model output manipulation.
0 stars 40 forks source link

Add structure for range checks #526

Closed 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q closed 3 months ago

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 7 months ago

Should be possible to test stuff like Emi|CO2|Energy|Demand|Industry|Chemicals|Solids|+|Fossil > 0.

FYI @fbenke-pik.

pweigmann commented 7 months ago

Not sure what the exact application would be, but sounds like something that could potentially be done within the validation tool scope?

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 7 months ago

If you want trivial checks like "fossil emissions cannot be negative" in there, be my guest. As long as it is fast.

pweigmann commented 7 months ago

Not necessarily. In which way should it be more than all(data[, , "var"] > 0) for a list of variables? What would be the desired input, output?

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 7 months ago

Basically the same as https://github.com/pik-piam/remind2/blob/af6b2f59cc143343dd9acd10cdfb8fac8782bc45/R/convGDX2MIF.R#L139-L148 but checking ranges instead of sums. Stuff not being negative, and shares not exceeding 100 % (especially globally if they are simply summed up) comes to mind.

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 7 months ago

Basically the same as …

but it should break the tests. If variables that should not turn negative do turn negative, whatever was changed on the reporting was wrong.

fbenke-pik commented 7 months ago

In principle, I can add basic functions to piamInterfaces for basic range checks (e.g. value > 0, sums up to 100). They would be then called as part of the convGDX2Mif test in remind2.

We would have to revisit this once Pascal has finished implementation of the validation tool to avoid redundancies. Also, piamInterfaces might not be the final location for validation functions like this (we just don't have a dedicated package yet).

To keep it simple for now, we could also just write a simple test function in remind2 for now to just have a safeguard and think about a good overall structure for validation functionality later. I am fine with that as well.

Will bring this up to discuss with Pascal during next RSE meeting.

@orichters Any thoughts on your end?

orichters commented 7 months ago

I wouldn't do that. Pascal is working on getting the validation tool ready which should do exactly these kind of tests. If you have time to spare, you could start populating the online file with the conditions you have in mind so it quickly becomes a useful tool.

fbenke-pik commented 7 months ago

ok, assigning pascal for now, so this won't be forgotten