File IPNWB_HDF5Helpers.ipf¶
H5 Wrapper functions for convenient use of the HDF5 operations
Unnamed Group
-
static const double kHDF5DataInfoVersion = 1000¶
Taken from HDF5 Browser.ipf
Included here for convenience.
-
static const double H5S_MAX_RANK = 32¶
-
static variable InitHDF5DataInfo(HDF5DataInfo *di)¶
Functions
-
variable H5_WriteTextDataset(variable locationID, string name, string str = defaultValue, WaveTextOrNull wvText = defaultValue, variable overwrite = defaultValue, variable compressionMode = defaultValue, variable skipIfExists = defaultValue, variable writeIgorAttr = defaultValue, variable appendData = defaultValue, variable refMode = defaultValue)¶
Write a string or text wave into a HDF5 dataset.
Only one of
str
orwvText
can be given.- Parameters:
locationID – HDF5 identifier, can be a file or group
name – Name of the HDF5 dataset
str – Contents to write into the dataset
wvText – Contents to write into the dataset
overwrite – [optional, defaults to false] Should existing datasets be overwritten
compressionMode – [optional, defaults to NO_COMPRESSION] Type of compression to use, one of CompressionMode
skipIfExists – [optional, defaults to false] Do nothing if the dataset already exists
writeIgorAttr – [optional, defaults to false] Add Igor specific attributes to the dataset, see the
/IGOR
flag ofHDF5SaveData
appendData – [optional, defaults to -1] Set the dimension to append to within the given dataset (requires compression)
refMode – [optional, defaults to NO_REFERENCE] Set refMode, one in ReferenceMode (DisplayHelpTopic “Saving Reference Data”)
-
variable H5_WriteDataset(variable locationID, string name, variable var = defaultValue, variable varType = defaultValue, WaveOrNull wv = defaultValue, variable overwrite = defaultValue, variable compressionMode = defaultValue, variable skipIfExists = defaultValue, variable writeIgorAttr = defaultValue, variable appendData = defaultValue)¶
Write a variable or text wave into a HDF5 dataset.
Only one of
var
orwv
can be given.- Parameters:
locationID – HDF5 identifier, can be a file or group
name – Name of the HDF5 dataset
var – Contents to write into the dataset
varType – Type of the data, must be given if
var
is supplied. See IgorTypeswv – Contents to write into the dataset
overwrite – [optional, defaults to false] Should existing datasets be overwritten
compressionMode – [optional, defaults to NO_COMPRESSION] Type of compression to use, one of CompressionMode
skipIfExists – [optional, defaults to false] Do nothing if the dataset already exists
writeIgorAttr – [optional, defaults to false] Add Igor specific attributes to the dataset, see the
/IGOR
flag ofHDF5SaveData
appendData – [optional, defaults to -1] Set the dimension to append to within the given dataset (requires compression)
-
static wave H5_GetChunkSizes(wave wv, variable compressionMode)¶
Return a wave for the valid chunk sizes of each dimension taking into account the compression mode.
-
static variable H5_WriteDatasetLowLevel(variable locationID, string name, wave wv, variable overwrite, variable compressionMode, variable skipIfExists, variable writeIgorAttr, variable appendData, variable refMode)¶
See also
-
variable H5_WriteTextAttribute(variable locationID, string attrName, string path, string list = defaultValue, string str = defaultValue, variable overwrite = defaultValue, variable refMode = defaultValue)¶
Attach a text attribute to the given location.
Only one of
str
orlist
can be given.- Parameters:
locationID – HDF5 identifier, can be a file, group or dataset
attrName – Name of the attribute
path – Additional path on top of
locationID
which identifies the object onto which the attribute should be attached.list – Contents to write into the attribute, list will be always written as 1D-array
str – Contents to write into the attribute
overwrite – [optional, defaults to false] Should existing attributes be overwritten
refMode – [optional, defaults to 0] Set refMode, one in ReferenceMode (DisplayHelpTopic “Saving Reference Data”)
-
variable H5_WriteAttribute(variable locationID, string attrName, string path, variable var, variable varType, variable overwrite = defaultValue)¶
Attach a numerical attribute to the given location.
- Parameters:
locationID – HDF5 identifier, can be a file, group or dataset
attrName – Name of the attribute
path – Additional path on top of
locationID
which identifies the object onto which the attribute should be attached.var – Contents to write into the attribute
varType – Type of the attribute, see IgorTypes
overwrite – [optional, defaults to false] Should existing attributes be overwritten
-
variable H5_CreateSoftLink(variable locationID, string path, string target)¶
Create a link to a group.
- Parameters:
locationID – HDF5 identifier, can be a file, group or dataset
path – Name of the link
target – The linked destination
-
variable H5_OpenFile(string discLocation, variable write = defaultValue)¶
Open HDF5 file and return ID.
- Parameters:
discLocation – full path to nwb file
write – open file for writing. default is readonly.
- Returns:
ID for referencing open hdf5 file
-
variable H5_CloseFile(variable fileID)¶
Close HDF5 file.
- Parameters:
fileID – ID of open hdf5 file
- Returns:
open state as true/false
-
variable H5_IsFileOpen(variable fileID)¶
Return 1 if the given HDF5 file is already open, 0 otherwise.
- Parameters:
fileID – HDF5 locationID from
HDF5OpenFile
.
-
variable H5_DatasetExists(variable locationID, string name)¶
Return 1 if the given HDF5 dataset exists, 0 otherwise.
- Parameters:
locationID – [in] HDF5 identifier, can be a file or group
name – [in] Additional path on top of
locationID
which identifies the dataset
-
wave H5_LoadDataset(variable locationID, string name)¶
Load a specified dataset as wave.
- Parameters:
locationID – [in] HDF5 identifier, can be a file or group
name – [in] path on top of
locationID
which identifies the dataset
- Returns:
reference to wave containing loaded data
-
wave H5_GetDatasetSize(variable locationID, string dataset)¶
Return the dimension sizes of the given dataset.
- Parameters:
locationID – HDF5 identifier, can be a file or group
dataset – name of the dataset
- Returns:
wave with the dimension sizes or an invalid wave reference
-
variable H5_AttributeExists(variable locationID, string path, string attribute, variable *objectType = defaultValue)¶
Check if a given attribute exists.
- Parameters:
locationID – [in] HDF5 identifier, can be a file or group
path – [in] Additional path on top of
locationID
which identifies the group or datasetattribute – [in] Name of the attribute
objectType – [out] [optional] Return the type of the element to which the attribute is attached to. Can be used for subsequent HDF5LoadData calls.
-
wave H5_LoadAttribute(variable locationID, string path, string attribute)¶
Load the given attribute and return its contents.
- Parameters:
locationID – [in] HDF5 identifier, can be a file or group
path – [in] Additional path on top of
locationID
which identifies the group or datasetattribute – [in] Name of the attribute to load
-
variable H5_GroupExists(variable locationID, string path)¶
Return 1 if the given HDF5 group exists, 0 otherwise.
- Parameters:
locationID – HDF5 identifier, can be a file or group
path – Additional path on top of
locationID
which identifies the group.
-
variable H5_CreateGroupsRecursively(variable locationID, string fullPath)¶
Create all groups along the given path.
- Parameters:
locationID – HDF5 identifier, can be a file or group
fullPath – Additional path on top of
locationID
which identifies the group
-
variable H5_IsValidIdentifier(string name)¶
Return true if
name
is a valid hdf5 identifier.This is more restrictive than the actual HDF5 library checks. See the BNF Grammar here.
-
string H5_ListGroupMembers(variable locationID, string path)¶
List all datasets at path (non-recursively)
- Parameters:
locationID – [in] HDF5 identifier, can be a file or group
path – [in] Additional path on top of
locationID
which identifies the group
-
string H5_ListGroups(variable fileID, string path)¶
List all groups inside a group (non-recursively)
- Parameters:
fileID – [in] HDF5 file identifier
path – [in] Full path to the group inside fileID
-
variable H5_OpenGroup(variable locationID, string path)¶
Open the group reachable via
locationID
andpath
and return its ID.- Parameters:
locationID – HDF5 identifier, can be a file or group
path – Additional path on top of
locationID
which identifies the group
- Returns:
the groupID of the opened group. Return NaN if the group did not exist.
-
variable H5_FlushFile(variable fileID)¶
Flush the file contents to disc.
- Parameters:
fileID – HDF5 file identifier
-
string H5_GetLinkTarget(string discLocation, string path)¶
- Todo:
Needs HDF5 XOP support for reading link targets use HDF5LinkInfo
-
string H5_GetLibraryVersion()¶
Return the HDF5 Library version.
Variables
-
static const double H5_ATTRIBUTE_SIZE_LIMIT = 60e3¶
-
static const double H5_CHUNK_SIZE = 8192¶
-
struct HDF5DataInfo¶