Skip to content

Commit

Permalink
Fixes on nc_close and on.exit usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongchen Zhang committed Nov 14, 2023
1 parent 50b61ec commit a3fc931
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/data.land/R/pool_ic_netcdf2list.R
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit a3fc931

Please sign in to comment.