I have to create a netCDF file with different subsets. For example subset1 must be a 2d matrix, subset2 a vector, etc.

I am using functions of netcdf library in C/C++ code:

nc_create for the file creation,

nc_def_dim for dimensions definition,

nc_def_var for variable (subsets) definition.

Can you indicate me an example code which creates more variables with several dimensions?

I didn't find it.


For multiple variables, you need multiple nc_def_var() calls.

One way to get example code is to create a CDL-based text file the matches your needs, and then run 'ncgen -c' (http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/ncgen.html) on it to get sample c code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.