Anybody else have any ideas on this?
Thanks,
DB
On 9/15/2011 11:30 AM, Donald Brandon wrote:
Hey Scott:
Wouldn't that make my code look too simple? ;-)
Just kidding...
The ConvertToBytes method uses a StreamWriter and a MemoryStream to
convert the array. I pulled this out and used your simpler method and
it doesn't change the outcome of the code.
I have been putting in some long hours on this project and working
when I am probably too tired to do so. Sometimes things just don't
come to you and when you find a method that works, you don't question
it much...
Thanks for your help.
DB
On 9/15/2011 11:00 AM, Mitchell, Scott - IS wrote:
DB,
Why the 'round-about way of creating a byte array? Won't this work?
byte[] buffer = newbyte[bufferSize];
What's going on inside your HdfHelper.ConvertToBytes function?
Scott
*From:*[email protected]
[mailto:[email protected]] *On Behalf Of *Donald Brandon
*Sent:* Thursday, September 15, 2011 11:45 AM
*To:* HDF Users Discussion List
*Subject:* [Hdf-forum] Getting an Array of values from a data set.
Hey all:
Trying to take a dataset of float values and build an array that can
be used to generate a raster. If i have code something like this:
*// Open up the dataset.
H5DataSetId curDepthDataset = H5D.open(curHDF, curName1 + "/" +
curName2 + "/" + curName3 + "/depth");
H5ObjectWithAttributes curDepthAttObj =
(H5ObjectWithAttributes)curDepthDataset;
// Create a Byte[] to hold the depth data.
H5DataTypeId datasetType = H5D.getType(curDepthDataset);
H5T.H5TClass datasetClass = H5T.getClass(datasetType);
H5DataTypeId datasetNativeType = H5T.getNativeType(datasetType,
H5T.Direction.ASCEND);
int bufferSize = H5T.getSize(datasetNativeType);
System.Array buffer =
System.Array.CreateInstance(Type.GetType("System.Byte"), bufferSize);
Byte[] bArray = HdfHelper.ConvertToBytes(buffer);
H5D.read(curDepthDataset, datasetNativeType, new H5Array<byte>(bArray));*
Why would this give me an error like this:
*FatalExecutionEngineError was detected*
*The runtime has encountered a fatal error. The address of the error
was at 0x6b344243, on thread 0x334. The error code is 0xc0000005.
This error may be a bug in the CLR or in the unsafe or non-verifiable
portions of user code. Common sources of this bug include user
marshaling errors for COM-interop or PInvoke, which may corrupt the
stack.**
*I am having no trouble using this method to read the attributes out
of the individual groups.
Thanks,
DB
------------------------------------------------------------------------
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
ITT Corporation. The recipient should check this e-mail and any
attachments for the presence of viruses. ITT 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://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
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org