SAGAR AUTE
SAGAR AUTE

Reputation: 1

Deleting hdf5 dataset using C#

I using HDF5 database and wanted to delete and update dataset , using below code I am creating group structure and created one dataset but now stuck on deleting dataset.

code below:

public void DeleteDataset()
{
  string filename = @"C:\Users\sagar_aute\Desktop\test2.h5";
  var dset = dsets.First();
  try
  {
    var fileId = Hdf5.CreateFile(filename);
    Hdf5.WriteDataset(fileId, "/test", dset);
    long groupId1 = Hdf5.CreateOrOpenGroup(fileId, "Location");
    long groupId2 = Hdf5.CreateOrOpenGroup(groupId1, "Cabinet");
    long groupId3 = Hdf5.CreateOrOpenGroup(groupId2, "Drawer");
    long groupId4 = Hdf5.CreateOrOpenGroup(groupId3, "Folder");
    Hdf5.WriteDataset(groupId4, "/File", new double[10, 1]);
    //wanted to delete above dataset "File"
    Hdf5.CloseFile(fileId);
  }
  catch (Exception ex)
  {
     
  }
}

Upvotes: 0

Views: 101

Answers (1)

SOG
SOG

Reputation: 912

You may want to have a look at HDFql to help you managing HDF5 files in a high-level fashion. To delete dataset File stored in HDF5 file C:\Users\sagar_aute\Desktop\test2.h5 using HDFql in C# could be implemented as follows:

HDFql.execute("DROP C:\Users\sagar_aute\Desktop\test2.h5 \"File\"");

Upvotes: 0

Related Questions