Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
NOTE: The netcdf-hdf
mailing list is no longer active. The list archives are made available for historical reasons.
Guys, What am I doing wrong here? The program below creates a dataset the way I expect, but the numbers that it writes are not what I expect to get. Here's the h5dump of the output: HDF5 "tst_h_compounds.h5" { GROUP "/" { GROUP "group1" { DATATYPE "compound_type_1" H5T_COMPOUND { H5T_STD_I32LE "f1"; H5T_STD_I32LE "f2"; } DATASET "v1" { DATATYPE "/group1/compound_type_1" DATASPACE SIMPLE { ( 3 ) / ( 3 ) } DATA { (0): { 0, 0 }, (1): { 24641422, -1073743792 }, (2): { 1455352, 0 } } } } } } #include "tests.h" #define FILE_NAME "tst_h_compounds.h5" #define DIM1_LEN 3 #define GRP_NAME "group1" #define VAR1_NAME "v1" #define FIELD1_NAME "f1" #define FIELD2_NAME "f2" #define COMPOUND_NAME "compound_type_1" int main() { hid_t fileid, grpid, spaceid, typeid, datasetid; int bool_out[DIM1_LEN] = {0, 1, 0}, bool_in[DIM1_LEN]; hsize_t dims[1]; struct s1 { int i1, i2; } data[DIM1_LEN]; int i; printf("*** Checking HDF5 compound types..."); for (i; i<DIM1_LEN; i++) { data[i].i1 = 99; data[i].i2 = -99; } /* Open file and create group. */ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) ERR; if ((grpid = H5Gcreate(fileid, GRP_NAME, 0)) < 0) ERR; /* Create a simple compound type. */ if ((typeid = H5Tcreate(H5T_COMPOUND, 8))) ERR; if (H5Tinsert(typeid, FIELD1_NAME, 0, H5T_NATIVE_INT) < 0) ERR; if (H5Tinsert(typeid, FIELD2_NAME, 4, H5T_NATIVE_INT) < 0) ERR; if (H5Tcommit(grpid, COMPOUND_NAME, typeid)) ERR; /* Create a space. */ dims[0] = DIM1_LEN; if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR; /* Create a dataset of this compound type. */ if ((datasetid = H5Dcreate(grpid, VAR1_NAME, typeid, spaceid, H5P_DEFAULT)) < 0) ERR; if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) ERR; if (H5Dclose(datasetid) < 0 || H5Tclose(typeid) < 0 || H5Sclose(spaceid) < 0 || H5Gclose(grpid) < 0 || H5Fclose(fileid) < 0) ERR; SUMMARIZE_ERR; return 0; } -- Ed Hartnett -- ed@xxxxxxxxxxxxxxxx
netcdf-hdf
archives: