In functions like calc.sst (or calc.sst.par, calc.hycom) which open “nc” data, it is better to close them by RNetCDF::close.nc(nc) for example below the “dat <- RNetCDF::var.get.nc(nc, nameidx)”. Once the nc file was still open when the program stopped with an error, R crashed when I ran the program again.
From Dr. Itoh:
In functions like calc.sst (or calc.sst.par, calc.hycom) which open “nc” data, it is better to close them by RNetCDF::close.nc(nc) for example below the “dat <- RNetCDF::var.get.nc(nc, nameidx)”. Once the nc file was still open when the program stopped with an error, R crashed when I ran the program again.