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’.

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.

h5_cmpd.py (5.2 KB)

···

From: Hdf-forum [mailto:hdf-forum-bounces@hdfgroup.org] 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'.

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 <gheber@hdfgroup.org> 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:hdf-forum-bounces@hdfgroup.org] *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.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

okay I got IronPython for VS2010. I am having a problem running HDF5DotNet
in debug mode.

I have tried everthing. It will run without debugging. I know there is a
setting but can't find it.

···

On Thu, Apr 18, 2013 at 9:31 AM, Charles Henderson < charlesshenderson@gmail.com> wrote:

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 <gheber@hdfgroup.org> 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:hdf-forum-bounces@hdfgroup.org] *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.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

HDF5DotNet won't run in debug mode without some tweaking. The debug builds of HDF add an extra 'd' into the name... hdf5ddll.dll, for example. The HDF5DotNet libraries explicitly link to the release version. So you need to manually change the code, the hdf dll names, or run HDF5DotNet in debug mode but linking to the release HDF libs. Some of these options may require some mods to the HDF5DotNet project as well.

Scott

···

From: Hdf-forum [mailto:hdf-forum-bounces@hdfgroup.org] On Behalf Of Charles Henderson
Sent: Thursday, April 18, 2013 4:50 PM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] HDF5 and C#

okay I got IronPython for VS2010. I am having a problem running HDF5DotNet in debug mode.

[X]

I have tried everthing. It will run without debugging. I know there is a setting but can't find it.

On Thu, Apr 18, 2013 at 9:31 AM, Charles Henderson <charlesshenderson@gmail.com<mailto:charlesshenderson@gmail.com>> wrote:
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 <gheber@hdfgroup.org<mailto:gheber@hdfgroup.org>> 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:hdf-forum-bounces@hdfgroup.org<mailto:hdf-forum-bounces@hdfgroup.org>] 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.
Hdf-forum@hdfgroup.org<mailto:Hdf-forum@hdfgroup.org>
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

________________________________

This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Exelis Inc. The recipient should check this e-mail and any attachments for the presence of viruses. Exelis Inc. accepts no liability for any damage caused by any virus transmitted by this e-mail.

I am trying to run the ironpython example you sent me and I get "Could not
add reference to assembly HDF5DotNet.dll".

···

On Thu, Apr 18, 2013 at 4:59 PM, Mitchell, Scott - IS < Scott.Mitchell@exelisinc.com> wrote:

HDF5DotNet won’t run in debug mode without some tweaking. The debug
builds of HDF add an extra ‘d’ into the name… hdf5ddll.dll, for example.
The HDF5DotNet libraries explicitly link to the release version. So you
need to manually change the code, the hdf dll names, or run HDF5DotNet in
debug mode but linking to the release HDF libs. Some of these options may
require some mods to the HDF5DotNet project as well.

Scott

*From:* Hdf-forum [mailto:hdf-forum-bounces@hdfgroup.org] *On Behalf Of *Charles
Henderson
*Sent:* Thursday, April 18, 2013 4:50 PM

*To:* HDF Users Discussion List
*Subject:* Re: [Hdf-forum] HDF5 and C#

okay I got IronPython for VS2010. I am having a problem running
HDF5DotNet in debug mode.

I have tried everthing. It will run without debugging. I know there is a
setting but can't find it.

On Thu, Apr 18, 2013 at 9:31 AM, Charles Henderson < > charlesshenderson@gmail.com> wrote:

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 <gheber@hdfgroup.org> 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:hdf-forum-bounces@hdfgroup.org] *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.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

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

This e-mail and any files transmitted with it may be proprietary and are
intended solely for the use of the individual or entity to whom they are
addressed. If you have received this e-mail in error please notify the
sender. Please note that any views or opinions presented in this e-mail are
solely those of the author and do not necessarily represent those of Exelis
Inc. The recipient should check this e-mail and any attachments for the
presence of viruses. Exelis Inc. accepts no liability for any damage caused
by any virus transmitted by this e-mail.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org