Can anyone help me on how to generate it with hdfql under windows. h5 file I run the code below generated below the specified directory. h5 file failed?
private void BtnCreateHDF5_Click(object sender, RoutedEventArgs e)
{
Stopwatch sw = Stopwatch.StartNew();
sw.Start();
string pathname = "";
string dbname = "F:\\test1\\hdf5_data.h5";
ushort[,,] values = new ushort[1, 200, 800];
//HDFql.Execute("USE DIRECTORY " + pathname);
HDFql.Execute("CREATE FILE " + dbname);
HDFql.Execute("USE FILE " + dbname);
HDFql.Execute("CREATE GROUP /Data/GR-1 ORDER TRACKED");
HDFql.Execute("CREATE CHUNKED(1,200, 800) DATASET /Data/GR-1/MyData " +
"AS UNSIGNED SMALLINT(UNLIMITED, 200,800) ENABLE FLETCHER32");
Random random = new Random();
for (int i = 0; i < 200; i++)
{
for (int j = 0; j < 800; j++)
{
values[0, i, j] = (ushort)(random.Next(60000));
}
}
HDFql.Execute("INSERT INTO /Data/GR-1/MyData VALUES FROM MEMORY "
+ HDFql.VariableTransientRegister(values));
HDFql.Execute("CLOSE FILE");
sw.Stop();
TimeSpan ts = sw.Elapsed;
string ss = "HDF5 Insert Data 10000: " + ts.TotalSeconds.ToString("0.0000");
AddMemoInfo(ss);
}
The test program I wrote is available in D:\projects\hdftest1,
If I use this
string dbname = “hdf5_data.h5”;
He can generate a file under the directory of the program, but not if he changes the disk character
I also see this problem when using HDFql. I cannot use paths which include a drive letter (or UNC paths).
“\directory\filename.hdf5” is OK
“C:\directory\filename.hdf5” fails with error code -4
To work around this problem with your example F:\test1\hdf5_data.h5 :
check if file path starts with drive letter ( F:)
push current working directory
remove drive letter: from filename (leaving \test1\hdf5_data.h5 in your example)
change working directory to drive letter (F:)
perform desired HDFql operation using filename without drive letter
pop to original working directory
You’ll need to wrap this around any HDFql operations which specify a filename such as CREATE, USE, CLOSE, DROP
Would you mind surrounding the path/file name with " (as it contains the reserved character : from HDFql point of view) and escaping all its \ (as \ is a reserved character in C#)? In other words, please try the following and see if it works properly now:
Using quotes around the path / filename does not fix this issue. It allows a drive letter to be included in the path, but the file will only be successfully created / opened if my program is running from the same drive letter.
Program running from C: drive, quoted path with drive letter on C: drive
HDFql::execute(“CREATE TRUNCATE AND USE FILE \“C:\\test1\\filename.hdf5\””);
–Success
Program running from D: drive, quoted path with drive letter on D: drive
HDFql::execute(“CREATE TRUNCATE AND USE FILE \“D:\\test1\\filename.hdf5\””);
–Success
Program running from C: drive, quoted path with drive letter on D: drive
HDFql::execute(“CREATE TRUNCATE AND USE FILE \“D:\\test1\\filename.hdf5\””);
Error code -4
Program running from D: drive, quoted path with drive letter on C: drive
HDFql::execute(“CREATE TRUNCATE AND USE FILE \“C:\\test1\\filename.hdf5\””);
Error code -4
Unquoted path including drive letter
HDFql::execute(“CREATE TRUNCATE AND USE FILE C:\\test1\\filename.hdf5”);
–Error code -1
At our side, we tested HDFql using different drives (i.e. running a program on one drive and creating and accessing an HDF5 file on another drive) and it worked perfectly fine. Given that you are working in C/C++, would you mind running your test cases once more, this time using the HDF5 library function H5Fcreate to create and access an HDF5 file and see how it goes? Just to understand where the issue lies.