ncdf4 (version 1.22)

nc_close: Close a netCDF File

Description

Closes an open netCDF file, which flushes any unwritten data to disk. Always close a netCDF file when you are done with it! You are risking data loss otherwise.

Usage

nc_close( nc )

Arguments

nc

An object of class ncdf4 (as returned by either function nc_open or function nc_create.

Author

David W. Pierce dpierce@ucsd.edu

Details

Data written to a netCDF file is cached in memory, for better performance. This data is only written out to disk when the file is closed. Therefore, always remember to close a netCDF file when done with it.

References

http://dwpierce.com/software

See Also

nc_sync.

Examples

Run this code
if (FALSE) nc <- nc_open("salinity.nc")
if (FALSE) data <- ncvar_get( nc )	# Read the "only" var in the file
if (FALSE) nc_close(nc)

Run the code above in your browser using DataLab