Closed aliehlen1 closed 7 years ago
This (already in the code) should take care of that. Unless it can't assign db.day.ahead.loc for some reason...
db.day.ahead.loc = file.path(as.character(na.exclude(inputs$DayAhead.Database.Location))) if (length(db.day.ahead.loc)==0) { db.day.ahead.loc = db.loc }
So this is the error:
Error in eval(expr, envir, enclos) : unknown column 'scenario'
which happens from setup_plexosAnalysis.R on line 202, because line 202 is attempting to query a DA database using a filepath that isn't pointing to a real database. It would be nice to be able to run just on RT (for example, our DA run xml files wrote out weirdly, but we do have RT results).
Maybe this line in the same script (line 195) could also return "ERROR" if !file.exists(...) or something like that:
db.day.ahead = tryCatch(plexos_open(db.day.ahead.loc, basename(db.day.ahead.loc)), error = function(cond) { return(data.frame('ERROR'))})
Just saw your comment. Maybe the answer is just to not put in DA solutions. Although, I guess it would still be nice to have an error or warning or message message that says that "this file doesn't exist" rather than breaking mysteriously if you've mistyped something. Or, I guess, reset this db.day.ahead.loc = db.loc
also if the DA file doesn't exist.
Are you saying that you're giving it a DA database location but the database doesn't exist?
Yep. Not on purpose, really, but it's happened a couple times because we only care about the RT plots right now and are moving solutions around to archive them.
So, if there was something that looked at the DA database that was specified, and if that doesn't exist it subs in the RT database, would that be what you are looking for?
I think it would be best to just check that the DA databases actually exist and either error out there with a clear message or skip the DA stuff if they don't--but let the user know. The issue was that, if the DA databases don't exist, the code errors out later and it's hard to trace the error back to the DA filepointers being bad.
(although, as Matt pointed out, this hopefully won't happen that often)
Should be fixed with 8b9f8a881175d532b90fe79f49e06a4794bc0afc
You might have to check this on your version because we have a slightly different setup, but I get an error unrelated to DA-RT plots when I don't put in a path to DA solutions. Rerunning to reproduce the error; I'll add it here when it happens again.