Skip to content

Commit

Permalink
use of the new helper listDepth instead of finding "var" dimension fo…
Browse files Browse the repository at this point in the history
…r extracting dates
  • Loading branch information
miturbide committed Oct 16, 2017
1 parent 10a4bb9 commit 542cb9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/subsetGrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ subsetSeason <- function(grid, season = NULL) {
dimNames <- getDim(grid)
season0 <- getSeason(grid)
if (!all(season %in% season0)) stop("Month selection outside original season values")
mon <- if (any(grepl("var", dimNames))) {
mon <- if (listDepth(grid$Dates) > 1) {
as.integer(substr(grid$Dates[[1]]$start, 6, 7))
} else {
as.integer(substr(grid$Dates$start, 6, 7))
Expand All @@ -442,7 +442,7 @@ subsetSeason <- function(grid, season = NULL) {
grid$Data <- asub(grid$Data, time.ind, grep("time", dimNames), drop = FALSE)
attr(grid$Data, "dimensions") <- dimNames
# Verification Date adjustment
grid$Dates <- if (any(grepl("var", dimNames))) {
grid$Dates <- if (listDepth(grid$Dates) > 1) {
lapply(1:length(grid$Dates), function(i) {
lapply(grid$Dates[[i]], function(x) x[time.ind])
})
Expand Down

0 comments on commit 542cb9c

Please sign in to comment.