[Thread Prev][Thread Next][Index]

Re: [ferret_users] Ferret can't read netcdf file on Mac OS X (...without ncdump then ncgen)

Thanks to Russ below, who provided a much quicker solution than I had, by pointing me to the netcdf file version of the model output. 

$ ncdump -k cam_output.nc                                                           # which netcdf version? (Could also use 'od' as per Russ' example)
64-bit offset
$ ncks -fl_fmt=classic cam_output.nc cam_output_ferret.nc    #convert to ferret-readable format (much quicker than ncdump/ncgen!) 
$ ncdump -k cam_output_ferret.nc

The NCO operators on my system were built with netcdf3, so I do not have access to "netcdf4_classic" format. Still, the "classic" format works fine in ferret. For reference, see the NCO web pages: http://nco.sourceforge.net/nco.html#Selecting-Output-File-Format

So, is my earlier problem (ferret not reading 64-bit offset netcdf files) due to my having an older version of ferret? Are there any plans to make Mac OS X a fully supported operating system for future ferret releases? :-)


On Jan 8, 2009, at 10:17 PM, Russell Fiedler wrote:

Hi Paul,

Netcdf has changed a bit over the years. Some applications read info at the
start of file to see if it is a Netcdf file and what type. Try an octal dump
on the binary files to see what is different in the header info.

od -c myfile.nc  | more

The first line should look something like this

0000000   C   D   F 001  \0  \0  \0  \0  \0  \0  \0  \n  \0  \0  \0 003
               ^^^^^^^^^^^^^  <- Netcdf file & version.

Later/earlier versions will vary. I think there are some switches in the
netcdf operator package to generate different versions for compatability.

Russ Fiedler

On Friday 09 January 2009 10:43, you wrote:
Hi all,

The "I have a netcdf file that Ferret refuses to read" on the FAQ page does
not currently have an answer and I am having this problem. I am using
ferret v5.70 for Mac OS X, and it seems that I do not get the same problem
with ferret v6.1 on linux, logging into computers from my previous job
(i.e. this is not a solution for me!).

When reading netcdf output from my model (NCAR CAM ), ferret gives the

yes? use cam_output.nc
** netCDF error: Not a netcdf file
 is this a CDF file ?

However, it *is* a netcdf file and can be read as such by netcdf operators,
IDL and others. An "ncdump" of the output file followed by syntax checking
with "ncgen" reveals a small error in one of global attributes (an empty
title field). Even after correcting the file with "ncatted", ferret refuses
to read the file. But, an "ncdump" of the corrected file, followed by
"ncgen" does produce a file that can be read by ferret. In summary, here's
my current recipe:

ncatted -a title,global,a,c,"Some title string" cam_output.nc
ncdump cam_output.nc > cam_ouput.cdl

# File that can be read by ferret
ncgen -o cam_output_ferret.nc cam_output.cdl

#for checking
ncdump cam_output_ferret.nc > cam_output_ferret.cdl

A "diff" of cam_output.cdl and cam_output_ferret.cdl reveals no differences
(except the file name), so I am stumped. My "recipe" is ok for small files,
but it takes a long time when dealing with larger files.

So, the question is, am I stuck with using NCO to get something that can be
read by ferret, or is there a quicker solution?

Thanks for any help!


p.s. Apologies if this email comes through twice

Paul Young

Chemistry and Climate Processes
Chemical Sciences Division
NOAA Earth System Research Laboratory
325 Broadway R/CSD8
Boulder CO 80305-3328

Tel:   +1 303-497-4943
Fax:   +1 303-497-5686
Email: paul.j.young@xxxxxxxx<mailto:paul.j.young@xxxxxxxx>
Web:   http://www.esrl.noaa.gov/csd/

Paul Young

Chemistry and Climate Processes
Chemical Sciences Division
NOAA Earth System Research Laboratory
325 Broadway R/CSD8
Boulder CO 80305-3328

Tel:   +1 303-497-4943
Fax:   +1 303-497-5686

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement