Writing netCDF Files That Ferret Can Read

Question

Why is Ferret sometimes unable to properly read a netCDF file written in Python?

Answer

One way this can happen has to do with how you write out a 3-D array to the netCDF file. Say your array has shape (longitude, latitude, time) and that you want to write it to a netCDF file and later read the file with the graphical visualization tool Ferret. If so, you have to be careful to write out the three dimensions in the correct order; Ferret requires that the time dimension be the first dimension of the netCDF file's data array (in this case time x latitude x longitude).

By the way, sometimes the ncdump -h command gives the correct dimensions of the field, but Ferret doesn't. To get around this make sure you write out the array dimensioned in the order Ferret likes.

Note: Thanks to Helene Brogniez for the tip!

Return to the Tips and Examples index page.

Valid HTML 4.01! Valid CSS! Updated: July 18, 2005 by Johnny Lin <email address>. License.