VisionEval/VisionEval-Dev

Need better UZA Name Checking

Closed this issue · 1 comments

In VEHouseholdTravel, Initialize.R module at line 439, if UzaNames_[i] is not in the Ua master list, then HasUzaName is an empty logical vector. When the if test at line 442 executes, the Complete variable is an empty vector and an uninformative error about a "missing value" is raised before we can get the "real" error message that would have told us what was truly wrong.
We need to insert a trap after line 439 to catch the incorrect or missing Uza name and report a more sensible error.

       HasUzaName <- UzaNames_[i] %in% Ua
       # NEED BETTER ERROR MESSAGE HERE if UzaNames[i] IS NOT IN THE UZA UNIVERSE
       HasAllVals <- all(!(unlist(Values_df[i,]) %in% c(NA, "")))
       Complete <- HasUzaName || HasAllVals
       if (!Complete) {
         Msg <- paste0(
           "The 'marea_dvmt_split_by_road_class.csv' file has errors for ",
           TypeName, " inputs for Marea ", Marea, ". The DVMT inputs need to ",
           "be complete or they need to be omitted and a valid 'UzaNameLookup' ",
           "must be provided in the 'marea_base_year_dvmt.csv file'."
         )

It looks like VEHouseholdTravel will currently work (it handles an NA value for UzaName). The problem is really in VETravelPerformance. I'm making the proposed fix in that location.