it works with new HDF5 APIs: Re: beta1 bug

--============_-1034515655==_===========
Content-Type: text/plain; charset="us-ascii" ; format="flowed"

Ed,

Since you are using new feature of HDF5, you cannot use the old APIs. 
We rewrote your program and it works. It is attached. (That doesn't 
mean that HDF5 is bugs free :-) )

We still have to do a lot of work to make it easy to convert the old 
applications (like first implementation of NetCDF-4) to use new HDF5 
features. So for now  you need to make some changes to the NetCDF-4 
code.

I propose that we work together to speed up NetCDF-4 conversion to 
the new APIs since our docs are still under development. Will you 
have time tomorrow to have a quick telecon?

Thank you!

Elena


At 1:57 PM -0600 4/25/07, Ed Hartnett wrote:
>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
>==============================================================================


-- 

------------------------------------------------------------
Elena Pourmal
The HDF Group
1901 So First ST.
Suite C-2
Champaign, IL 61820

epourmal@xxxxxxxxxxxx
(217)333-0238 (office)
(217)333-9049 (fax)
------------------------------------------------------------
--============_-1034515655==_===========
Content-Id: <a06240848c2568894e8db@[192.168.1.101].0.0>
Content-Type: application/octet-stream; name="netcdf_bug.c"
Content-Disposition: attachment; filename="netcdf_bug.c"
Content-Transfer-Encoding: base64

LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKgogKiAgICBUaGlzIGV4YW1wbGUgc2hv
d3MgaG93IHRvIHVzZSB0aGUgbmV3IEFQSSBmb3IgdGhlIGZlYXR1cmUgb2YgCiAqICAg
IGNyZWF0aW9uIG9yZGVyLgogKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCgojaW5j
bHVkZSAiaDV0ZXN0LmgiCgojZGVmaW5lIEZJTEVfTkFNRSAibmV0Y2RmX2J1Zy5oNSIK
I2RlZmluZSBOQzNfU1RSSUNUX0FUVF9OQU1FICJhdHRyaWJ1dGUiCgppbnQgbWFpbih2
b2lkKQp7CiAgICAgIGhpZF90IGZjcGxfaWQsIGZhcGxfaWQsIGhkZmlkLCBncnBpZDsK
ICAgICAgaGlkX3Qgc3BhY2VpZCwgYXR0aWQsIGF0dGlkMTsKICAgICAgaW50IG9uZSA9
IDE7CiAgICAgIGhzaXplX3QgZGltc1sxXTsKCiAgICAgIC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