diff --git a/R/PeriodPET.R b/R/PeriodPET.R index 27d6ecaeeed9d7a9e778426495348ebcd9f519ab..02ddb5f32c9e658a21d467b4b998fdefaa4dea11 100644 --- a/R/PeriodPET.R +++ b/R/PeriodPET.R @@ -91,8 +91,12 @@ CST_PeriodPET <- function(data, pet_method = 'hargreaves', source_files <- lapply(data, function(x) {x$attrs$source_files}) coords <- data[[1]]$coords Dates <- data[[1]]$attrs$Dates + metadata <- data[[1]]$attrs$Variable$metadata - metadata_names <- intersect(names(dim(res)), names(metadata)) + metadata[["PET"]]$longname <- "Potential evapotranspiration" + metadata[["PET"]]$units <- "mm" + + metadata_names <- c(intersect(names(dim(res)), names(metadata)), "PET") suppressWarnings( res <- s2dv_cube(data = res, coords = coords, varName = paste0('PET'), @@ -383,4 +387,4 @@ PeriodPET <- function(data, dates, lat, pet_method = 'hargreaves', pet <- array(pet[which(mask_dates == 1)], dim = dims) } return(pet) -} \ No newline at end of file +}