[Thread Prev][Thread Next][Index]

[ferret_users] ** netCDF error: Not a netcdf file is this a CDF file ? (Mac Ferret, others?)



Mac Ferret users (possibly others) may have encountered the frustrating message:

 ** netCDF error: Not a netcdf file
 is this a CDF file ?

This can occur on a perfectly correct-looking netcdf file (i.e. ncdump shows all the axes and data to be correct). I have experienced this with several datasets from DODS servers.

One source of difficulty is that Mac Ferret was apparently compiled with libraries that do not read the new (2008) netcdf4 standards (see http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#changes_4.0). A file in netcdf4 format will be rejected by Ferret, giving the above error. 

The version of netcdf can be tested (on a local file) from the command line with "ncdump -k":

> ncdump -k ocean_an_20081109_u_ncosubset_dods.nc
64-bit-offset ! netcdf4

> ncdump -k ocean_an_200812_u_ncosubset_dodsF3.nc
classic     ! previous netcdf (readable by Mac Ferret)

If you have such a file, one solution is via a set of command line utilities called NCO ("netcdf operators"). These have many excellent tools that enhance the built-in netcdf utilities and also work on remote DODS files. NCO can reach out to a remote site, inspect (like ncdump) or grab a file from a URL, and write it on your system in classic netcdf. While doing so, NCO tools can also subset the file so the download can be small(er). NCO also can convert netcdf4 to classic netcdf.

NCO is a set of fortran/C code that is available from Fink (or directly from http://nco.sourceforge.net/). Fink will build it nicely. Of course, NCO is not just for Mac!

Once the files are on your system, NCO has operators to concatenate (like Ferret's save/append), and it is fast. Ferret likes the result (if you tell NCO to save as classic netcdf). Obviously these commands can be scripted for automatic downloading and processing.

I have just scratched the surface of what this powerful code can do, but it enhances Ferret and deals with this particular weakness, especially for Mac Ferret users.

Billy K


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement