Andy, very odd indeed.

Does SMS expect a scalar dataset of a fixed or variable-length string type?

Are we sure that it's not finding the dataset or it's finding it and not

happy with the content and still saying it's not finding it?

(You could verify that by creating a scalar integer dataset '/File Type' and
see if you

get the same problem.)

If that's the case, it might be down to a subtlety such as the following:

 

I'd have to refresh my mind if H5T.setSize(*, 5) creates 4 or 5 usable
characters.

In any event, you are not writing the terminating null character. You are
writing

only 4 bytes (88, 100, 109, 102). Try a 5 byte array with a 0 at the end.

What happens? (HDFView might append that for your automatically.)

 

G.

 

 

From: hdf-forum-boun...@hdfgroup.org [mailto:hdf-forum-boun...@hdfgroup.org]
On Behalf Of Andywizma
Sent: Saturday, August 11, 2012 11:34 PM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] HDF5DotNet vs HDFView (write string dataset)

 

Hi all, I am writing a utility program that generates a .h5 file for the
pre/post-processor SMS. The first thing SMS does is check for a scalar
dataset in the .h5 file called 'File Type' that contains the string "Xmdf".
If SMS fails to find this it will report a certain error. I am using the
HDF5DotNet 1.8.9 wrappers and generate the dataset with the following code:
Dim enc As New System.Text.ASCIIEncoding Dim myType1 As H5DataTypeId =
H5T.copy(H5T.H5Type.C_S1) H5T.setSize(myType1, 5) Dim mySpaceID As
H5DataSpaceId = H5S.create(H5S.H5SClass.SCALAR) Dim myDataSetId As
H5DataSetId = H5D.create(xid, "File Type", myType1, mySpaceID) Dim h5str1 As
New H5Array(Of System.Byte)(enc.GetBytes("Xmdf")) H5D.write(myDataSetId,
myType1, h5str1) If I open my generated .h5 file in HDFView everything
appears fine: the scalar dataset is there and contains the string "Xmdf".
However SMS will not load the file and gives the error indicating that it
cannot find the 'File Type' dataset. If I manually delete the 'File Type'
dataset from within HDFView and then manually add it back in, the file can
be read by SMS without a problem. Can anyone explain if there is a
difference between how I am writing the string dataset and how HDFView
writes the dataset, or what I can do to attempt to solve the problem? SMS
tech support have simply said "check the way in which the dataset is being
written". Any thoughts/tips/pointers much appreciated! Kind regards, Andy
Wiersma 

  _____  

View this message in context: HDF5DotNet vs HDFView (write string dataset)
<http://hdf-forum.184993.n3.nabble.com/HDF5DotNet-vs-HDFView-write-string-da
taset-tp4025303.html> 
Sent from the hdf-forum mailing list archive
<http://hdf-forum.184993.n3.nabble.com/>  at Nabble.com.

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

Reply via email to