Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: beta1 bug



Jeff Whitaker <jswhit@xxxxxxxxxxx> writes:

> Ed:  The attached C program creates a netcdf4_classic file that is
> unreadable (ncdump'ing it gives an 'HDF Error').
>
> -Jeff
>

<snip>

Jeff,

This turns out to be a HDF5 error, I believe. 

I have reduced it to a HDF5-only program, which I sent to Quincey, the
HDF5 programmer. (But I happen to know he's on a well-deserved
vacation in Florida, so I don't know when he'll get back to look at
this!)

If anyone else at HDF5 HQ is interested, here's the HDF5 code that
demonstrates the problem. It fails on the H5Gopen call, at the bottom
of the code.

Thanks!

Ed

   printf("Testing some more simple atts...");
   {
      hid_t fcpl_id, fapl_id, hdfid, grpid;
      hid_t spaceid, attid, attid1;
      int one = 1;
      hsize_t dims[1];

      /* Create a HDF5 file. */
      if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
      if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR;
      if (H5Pset_latest_format(fapl_id, 1) < 0) ERR;
      if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
      if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
					       H5P_CRT_ORDER_INDEXED)) < 0) ERR;
      if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
					       H5P_CRT_ORDER_INDEXED)) < 0) ERR;
      if ((hdfid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR;
      if (H5Pclose(fapl_id) < 0) ERR;
      if (H5Pclose(fcpl_id) < 0) ERR;

      /* Open the root group. */
      if ((grpid = H5Gopen(hdfid, "/")) < 0) ERR;

      /* Write an attribute. */
      if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
      if ((attid = H5Acreate(grpid, NC3_STRICT_ATT_NAME, H5T_NATIVE_INT, 
			     spaceid, H5P_DEFAULT)) < 0) ERR;
      if (H5Awrite(attid, H5T_NATIVE_INT, &one) < 0) ERR;
      if (H5Sclose(spaceid) < 0) ERR;

      H5Fflush(hdfid, H5F_SCOPE_GLOBAL);
      dims[0] = 1;
      if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR;
      if ((attid1 = H5Acreate(grpid, "a", H5T_NATIVE_INT, spaceid, 
			     H5P_DEFAULT)) < 0) ERR;
      if (H5Awrite(attid1, H5T_NATIVE_INT, &one) < 0) ERR;
      if (H5Aclose(attid1) < 0) ERR;
      if ((attid1 = H5Acreate(grpid, "b", H5T_NATIVE_INT, spaceid, 
			     H5P_DEFAULT)) < 0) ERR;
      if (H5Awrite(attid1, H5T_NATIVE_INT, &one) < 0) ERR;
      if (H5Aclose(attid1) < 0) ERR;
      if ((attid1 = H5Acreate(grpid, "c", H5T_NATIVE_INT, spaceid, 
			     H5P_DEFAULT)) < 0) ERR;
      if (H5Awrite(attid1, H5T_NATIVE_INT, &one) < 0) ERR;
      if (H5Aclose(attid1) < 0) ERR;

      if (H5Sclose(spaceid) < 0) ERR;
      if (H5Aclose(attid) < 0) ERR;
      if (H5Gclose(grpid) < 0) ERR;
      if (H5Fclose(hdfid) < 0) ERR;

      if ((hdfid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) ERR;
      if ((grpid = H5Gopen(hdfid, "/")) < 0)
      if (H5Gclose(grpid) < 0) ERR;
      if (H5Fclose(hdfid) < 0) ERR;
   }

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

===============================================================================
To unsubscribe netcdf-hdf, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
===============================================================================


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690