Possible 5.1.1 bug when writing NetCDF-4 classic files on big endian machines

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun Feb 28 2010 - 15:59:27 MST

Hi folks,

This is to alert you of a potentially serious bug with writing classic
NetCDF-4 files on big endian machines using NCL V5.1.1.

Below, I will give you information on how to test if you have this bug
on your system.

This is related to the HDF5 bulletin I sent two days ago:

             [ncl-talk] Fwd: HDF Bulletin: HDF5 1.8 Corruption Problem 2/26/10

This is an issue when linking against HDF5 versions 1.8.0 through
1.8.4, which we did with NCL V5.1.1,
and some beta versions of 5.2.0.

For those of you that are linking your own applications against one of
these HDF5 versions, you can get
more information and a patch here:

http://www.hdfgroup.org/HDF5/release/obtain5.html

--------------------

For NCL V5.1.1/5.2.0-beta users, the bug seems to manifest itself if
both of the following conditions are met:

   - You are writing a NetCDF-4 classic file on a big endian machine.

      Big endian machines include IBM/AIX/Power, Mac PowerPC, and Sun/
Solaris systems.

     To write a NetCDF-4 classic file, you must have put the following
line in your NCL script,
      before any addfile(s) call:

     setfileoption("nc", "Format", "NetCDF4Classic")

    Otherwise, by default, you will be writing a NetCDF 3 file, and
you shouldn't have any problems.

   - You are writing more than 10 global attributes and/or more than
10 variable attributes to a file.
      (In my testing, this number seems to vary depending on
conditions I'm not sure of.)

If you then transfer this NetCDF file to a little endian system (Linux
Intel or Mac Intel systems), you may not
be able to read it back in using an NCL script, ncl_filedump, or any
other program that reads
NetCDF-4 classic files.

--------------------

If you have NCL V5.1.1 or 5.2.0-beta, and you've been writing NetCDF-4
classic files on a big endian
machine, then you can test if you have this bug by doing the following:

    - Run the attached test_hdf5_bug.ncl script.

   - Transfer the two test_hdf5_bug_xxx_nc4_classic_yyyy.nc files it
creates to a little endian machine.

   - Run "ncl_filedump" on these two files (note, the filenames may be
slightly different):

     ncl_filedump test_hdf5_bug_ineff_nc4_classic_5.1.1.nc
     ncl_filedump test_hdf5_bug_eff_nc4_classic_5.1.1.nc

If you get an error like this:

   fatal:HDF error
   fatal:Could not open (test_hdf5_bug_ineff_nc4_classic_5.1.1.nc)
   Variable: f (file variable)
   (0) File Missing Value : -1

then you've reproduced the bug.

Note: I tested this script on our IBM/AIX system with "natts=7" and
the problem went away. If I set "natts=8", then I saw the problem.
This may vary from system to system.

You can send me an email offline if you need a fix. Otherwise, you can
wait until 5.2.0 is released. I will also be happy to
give you a 5.2.0 test version.

I'm sorry for the inconvenience!

--Mary

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Feb 28 15:59:43 2010

This archive was generated by hypermail 2.1.8 : Mon Mar 01 2010 - 08:49:37 MST