I'm using C# and read compound data. I use my own wrapper for the H5PT instead of H5D, so it differs a bit.
But, make sure you allocate space including new-ing the H5Array. Also I know my data type going in, I'm not sure it will work by just putting out a byte array. So perhaps... compound_type[] cpd = new compound_type[size]; H5Array<compound_type> cpdData = new H5Array<compound_type>(cpd); H5D.read(DataSetId, dataType, cpdData); Scott ________________________________ From: Hdf-forum [[email protected]] on behalf of Charles Henderson [[email protected]] Sent: Tuesday, June 25, 2013 9:54 AM To: [email protected] Subject: [Hdf-forum] Reading HDf5 compund files using c# I have written a many HDF5 files that are compound data. They can be viewed by the HDF viewer and other applications. The issue I am having is I cannot seem to get the “H5D.read” command in C# coded correctly. ForecastRec[] data = new ForecastRec[100000]; int recount = 0; string FileName = Convert.ToString(myReaderInv["InventoryId"]); Int32 maxcount = Convert.ToInt32(myReaderInv["MaxCount"]); string File = @"" + HDF5Path + FileName + ".H5"; //--- HDF5 File Handling -----------------------------------//-- H5.Open(); H5FileId FileId = H5F.open(File, H5F.OpenMode.ACC_RDONLY); //-- open the file H5DataSetId DataSetId = H5D.open(FileId, FileName); //-- open the dataset H5DataSpaceId DataSpaceId = H5D.getSpace(DataSetId); //-- var DataSetSize = H5S.getSimpleExtentDims(DataSpaceId); //-- gets the actual # of rows var dataType = H5D.getType(DataSetId); (These are two different attempts but neither will compile.) H5D.read(DataSetId, dataType, H5Array<byte>(data)); H5D.read(DataSetId, H5T.CreateClass.COMPOUND, H5Array<compound>(data)); Anyone out there that can help? ________________________________ 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. [email protected] http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
