Ncdump followed by ncgen generally works fine for me. Try using plain
ncgen, rather than ncgen3. Also try explicitly specifying the ncgen option
to select netcdf-3 file format. I recall that the default output format
changed occasionally with different versions of ncgen, so that might be
your problem.
Also remember to use -p9,17 with ncdump, if you want to preserve full
precision from the original numeric values. Also use the -s option with
ncdump, to get the correct special metadata for all advanced netcdf formats
(64-bit, netcdf-4, and netcdf4-classic).
--Dave
On Mon, Jan 23, 2017 at 6:56 AM, HAVENER, KEVIN F GS-12 USAF ACC 14 WS/WXED
<kevin.havener@xxxxxxxxx> wrote:
> If I understand correctly, I should be able to ncdump a netcdf to text
> (CDL) then ncgen it back to a valid netcdf file. I tried this on a
> seemingly valid netcdf3 file and ncgen3'd it, but the new file was not in
> any way like the old one. In fact, it didn't even seem to be a valid
> netcdf3 any longer--the file magic was incorrect. Did I completely
> misunderstand the capabilities of the two programs? Or did I just not
> understand how to do the process correctly?
>
> Kevin Havener, DAFC, 14WS/WXED
>