VisionEval / VisionEval-Dev

Development version of VisionEval framework
https://visioneval.github.io/
Apache License 2.0
6 stars 32 forks source link

Need better UZA Name Checking #141

Closed jrawbits closed 2 years ago

jrawbits commented 3 years ago

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'."
          )
jrawbits commented 2 years ago

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.