Well I have never seen IronPython so that will leave me in the same pickle that I am in with 'C'. Is there anyway I can get some C# examples? I need to know so I can tell boss whether we can do the project or not.
On Wed, Apr 17, 2013 at 11:05 AM, Gerd Heber <[email protected]> wrote: > Charles, how are you? Attached is a snippet of IronPython that does the > job.**** > > I leave you the conversion to C# as an exercise. Ok?**** > > ** ** > > G.**** > > ** ** > > *From:* Hdf-forum [mailto:[email protected]] *On Behalf Of > *Charles > Henderson > *Sent:* Wednesday, April 17, 2013 10:44 AM > *To:* HDF Users Discussion List > *Subject:* [Hdf-forum] HDF5 and C#**** > > ** ** > > I am trying to convert one of the “C” examples into “C#” and not having > much luck.**** > > **** > > “C” code:**** > > #define FILE "h5ex_t_cmpdatt.h5"**** > > #define DATASET "DS1"**** > > #define ATTRIBUTE "A1"**** > > #define DIM0 4**** > > **** > > typedef struct {**** > > int serial_no;**** > > char *location;**** > > double temperature;**** > > double pressure;**** > > } sensor_t; /* Compound type */**** > > **** > > int**** > > main (void)**** > > {**** > > hid_t file, filetype, memtype, strtype, space, dset, attr;**** > > /* Handles */**** > > herr_t status;**** > > hsize_t dims[1] = {DIM0};**** > > sensor_t wdata[DIM0], /* Write buffer */**** > > *rdata; /* Read buffer */**** > > int ndims,**** > > i;**** > > /* * Initialize data. */**** > > wdata[0].serial_no = 1153;**** > > wdata[0].location = "Exterior (static)";**** > > wdata[0].temperature = 53.23;**** > > wdata[0].pressure = 24.57;**** > > wdata[1].serial_no = 1184;**** > > wdata[1].location = "Intake";**** > > wdata[1].temperature = 55.12;**** > > wdata[1].pressure = 22.95;**** > > wdata[2].serial_no = 1027;**** > > wdata[2].location = "Intake manifold";**** > > wdata[2].temperature = 103.55;**** > > wdata[2].pressure = 31.23;**** > > wdata[3].serial_no = 1313;**** > > wdata[3].location = "Exhaust manifold";**** > > wdata[3].temperature = 1252.89;**** > > wdata[3].pressure = 84.11;**** > > /* * Create a new file using the default properties. */**** > > file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);**** > > /* * Create variable-length string datatype. */**** > > strtype = H5Tcopy (H5T_C_S1);**** > > status = H5Tset_size (strtype, H5T_VARIABLE);**** > > /* * Create the compound datatype for memory. */**** > > memtype = H5Tcreate (H5T_COMPOUND, sizeof (sensor_t));**** > > status = H5Tinsert (memtype, "Serial number", HOFFSET (sensor_t, > serial_no), H5T_NATIVE_INT);**** > > **** > > “C#” Code:**** > > **** > > string FILE = @"c:\h5ex_t_cmpdatt.h5";**** > > string DATASET = "DS1";**** > > string ATTRIBUTE = "A1";**** > > int DIM0 = 4;**** > > int filetype, space, dset, attr, status; /* Handles */**** > > sensor_t[] wdata = new sensor_t[DIM0];**** > > int ndims, i;**** > > /* Initialize data. */**** > > wdata[0].serial_no = 1153;**** > > wdata[0].location = "Exterior (static)";**** > > wdata[0].temperature = 53.23;**** > > wdata[0].pressure = 24.57;**** > > wdata[1].serial_no = 1184;**** > > wdata[1].location = "Intake";**** > > wdata[1].temperature = 55.12;**** > > wdata[1].pressure = 22.95;**** > > wdata[2].serial_no = 1027;**** > > wdata[2].location = "Intake manifold";**** > > wdata[2].temperature = 103.55;**** > > wdata[2].pressure = 31.23;**** > > wdata[3].serial_no = 1313;**** > > wdata[3].location = "Exhaust manifold";**** > > wdata[3].temperature = 1252.89;**** > > wdata[3].pressure = 84.11;**** > > /* Create a new file using the default properties. */**** > > H5FileId FileID = H5F.create(FILE, H5F.CreateMode.ACC_TRUNC);* > *** > > /* Create variable-length string datatype. */**** > > H5DataTypeId strtype = H5T.copy(H5T.H5Type.C_S1);**** > > status = H5T.setSize(strtype, sizeof(sensor_t));**** > > /* Create the compound datatype for memory. */**** > > H5DataTypeId memtype = H5T.create(H5T.CreateClass.COMPOUND, > sizeof(sensor_t)); **** > > H5T.insert(memtype, "Serial Number", offset, (sensor_t, > serial_no), H5T.H5Type.NATIVE_INT);**** > > **** > > I am having all kinds of problems with the HDF calls. Anyone want to jump > in and help?**** > > The example I am trying to convert is ‘h5ex_t_cmpdatt-1.c’.**** > > **** > > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org > >
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
