From a3fc9317e41bedc391e66d79902749dbb80f9d5c Mon Sep 17 00:00:00 2001 From: Dongchen Zhang Date: Tue, 14 Nov 2023 16:02:02 -0500 Subject: [PATCH] Fixes on nc_close and on.exit usage. --- modules/data.land/R/pool_ic_netcdf2list.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/data.land/R/pool_ic_netcdf2list.R b/modules/data.land/R/pool_ic_netcdf2list.R index 995bc28d1bd..871d3132e78 100644 --- a/modules/data.land/R/pool_ic_netcdf2list.R +++ b/modules/data.land/R/pool_ic_netcdf2list.R @@ -20,8 +20,7 @@ pool_ic_netcdf2list <- function(nc.path){ for(varname in names(vals)){ vals[[varname]] <- ncdf4::ncvar_get(IC.nc,varname) } - ncdf4::nc_close(IC.nc) - on.exit() + on.exit(ncdf4::nc_close(IC.nc), add = FALSE) return(list(dims = dims, vals = vals)) } else{