Skip to content

Commit

Permalink
Update date in var_update()
Browse files Browse the repository at this point in the history
  • Loading branch information
Hhh-hyc authored Jul 10, 2024
1 parent 3a882ff commit f1825d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/fates/R/model2netcdf.FATES.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ model2netcdf.FATES <- function(outdir, sitelat, sitelon, start_date, end_date, p
## transpose dimensions into (,t)
if (easyNCDF::NcReadDims(nc_month, oldname)[length(easyNCDF::NcReadDims(nc_month, oldname))]=='time'){
dat_0 <- ncdf4::ncvar_get(nc_month,oldname) # time at the tail of dims
# dat.new <- PEcAn.utils::misc.convert(dat,oldunits,newunits) # convert data units
dat.new <- PEcAn.utils::misc.convert(dat_0,oldunits,newunits) # convert data units
}
newvar <- ncdf4::ncvar_def(name = newname, units = newunits, longname=long_name, dim = dimension)
## Adding target variables into out
if(is.null(out)) {
out <- list(var <- list(),dat <- list(), dimm<-list())
out$var[[1]] <- newvar
out$dat[[1]] <- dat_0 # dat.new
out$dat[[1]] <- dat.new
out$dimm[[1]]<- length(dimension)
} else {
i <- length(out$var) + 1
out$var[[i]] <- newvar
out$dat[[i]] <- dat_0 # dat.new
out$dat[[i]] <- dat.new
out$dimm[[i]]<- length(dimension)
}
}
Expand Down

0 comments on commit f1825d2

Please sign in to comment.