Skip to content

Commit

Permalink
bug fix related to variables with levels
Browse files Browse the repository at this point in the history
  • Loading branch information
miturbide committed Jul 30, 2019
1 parent 7da1d75 commit bdd9ec5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/loadGridData.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,13 @@ loadGridData <- function(dataset,
# Dictionary lookup -------------
# For datasets where level variables exist but are not handled as an extra dimension (e.g. ERA_Interim):
aux.var <- if (!is.null(aux.level$level)) paste0(aux.level$var, "@", aux.level$level, collapse = "")
cd <- tryCatch({check.dictionary(dataset, aux.var, dictionary, time)}, error = function(err) {NULL})
cd <- tryCatch({check.dictionary(dataset, aux.var, dictionary, time)}, error = function(err) {list(shortName = NULL, dic = NULL)})
if (is.null(cd[["shortName"]])) cd <- check.dictionary(dataset, var, dictionary, time)
if (is.null(cd[["dic"]]) & !is.null(cd[["shortName"]])) {
if (grepl("@", cd[["shortName"]])) {
cd <- check.dictionary(dataset, var, dictionary, time)
}
}
# ----------
shortName <- cd$shortName
dic <- cd$dic
Expand Down

0 comments on commit bdd9ec5

Please sign in to comment.