Hi.
Googling
netcdf produced a number of hits. One of which at NCAR/UCAR contained this:
Quote:
How do I convert ASCII or text data to netCDF?
One way to convert data in text form to netCDF is to use the ncgen tool that is part of the netCDF software distribution. Using ncgen for this purpose is a two-step process:
Convert text data to a file in CDL form using a text editor or text manipulation tools
Convert the CDL representation to netCDF using the ncgen tool with the "-o" or "-b" option
For more information, see the ncgen documentation.
If you have installed the NCAR Command Language (NCL) software, there are functions available and described here and here for reading ASCII and tables into NCL and writing the data out to netCDF files.
With access to MATLAB, you can create a schema for the desired netCDF file using ncwriteschema, read the data using textscan, and write the data to a netCDF file using ncwrite.
-- excerpt from:
NetCDF FAQ, q.v.
I have not used netCDF, but this looks straight-forward if you have the appropriate codes installed.
To do this in C (more likely C++) would probably require that you mimic the codes cited. Probably better to use the suggestions of NCAR/UCAR if you can.
Observation: this appears to be a problem that is in the realm of specialists. I would guess that few people here are in that category, but I've been wrong before and will be again.
Best wishes ... cheers, drl