Skip to content

Commit

Permalink
fix mo
Browse files Browse the repository at this point in the history
  • Loading branch information
Hhh-hyc committed Jul 12, 2024
1 parent e5b89e3 commit ff80d88
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions models/fates/R/model2netcdf.FATES.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ model2netcdf.FATES <- function(outdir, sitelat, sitelon, start_date, end_date, v
}

## Put time and vars
ncdf4::ncvar_put(ncout, time_var, mean(var_bound), start=c(month), count=c(1))
ncdf4::ncvar_put(ncout, time_var, mean(var_bound), start=c(mo), count=c(1))
for (i in seq_along(out$var)) {
if(out$dimm[[i]]==4){ # xypt
ncdf4::ncvar_put(ncout, out$var[[i]], out$dat[[i]], start=c(1,1,1,month), count=c(1,1,12,1))
ncdf4::ncvar_put(ncout, out$var[[i]], out$dat[[i]], start=c(1,1,1,mo), count=c(1,1,12,1))
}else if (out$dimm[[i]]==3) { # xyt
ncdf4::ncvar_put(ncout, out$var[[i]], out$dat[[i]], start=c(1,1,month))
ncdf4::ncvar_put(ncout, out$var[[i]], out$dat[[i]], start=c(1,1,mo))
}else{ # time_bounds
ncdf4::ncvar_put(ncout, out$var[[i]], out$dat[[i]], start=c(1,month))
ncdf4::ncvar_put(ncout, out$var[[i]], out$dat[[i]], start=c(1,mo))
}
}
}
Expand Down

0 comments on commit ff80d88

Please sign in to comment.