Cross platform compatibility, able to be opened, read, edited in most popular programs including python, MATLAB and R
Data sections contains multiple variables, each variable has an individual set of attributes that apply only to the specific data contained within it such as sensor serial number or max/min range
HOW IT WORKS
using R….
library(ncdf4)
ncfname <- 'sample.nc' #name file with .nc extension
ncpath <- './' #set file path
#create dimensions
timedim <- ncdim_def("time", "seconds since 1970-01-01T00:00:00Z", as.double(obj[['time']]))
stationdim <- ncdim_def("station", "counts", as.numeric(obj[['station']]))
#set fill value
FillValue <- 1e35
#define variables
dlname <- 'TEMP_01'
temp_def <- ncvar_def(longname= "temperature", units = 'degrees_celsius', dim = list(stationdim, londim, latdim) , name = dlname, prec = 'double')
#create netCDF shell
ncout <- nc_create(ncfname, vars = temp_def, force_v4 = TRUE)
#insert data into variable slots
ncvar_put(ncout, temp_def, obj[['temperature']])
#metadata
#variable attributes
ncatt_put(ncout, varid = 'TEMP_01', attname = 'sensorID', attval = '010101')
#global attributes
ncatt_put(ncout, varid = 0, attname = 'ship', attval = 'hudson')
#export finished netCDF
nc_close(ncout)