The H5F_CREATE function is the primary function for creating HDF5 files.
Note: As an alternative, see H5_CREATE.
Syntax
Result = H5F_CREATE(Filename)
Return Value
Result is a file identifier for the newly-created file; this file identifier should be closed by calling H5F_CLOSE when it is no longer needed.
Arguments
Filename
A string giving the name of the file to create.
Keywords
None
Example
file = 'hdf5_out.h5'
fid = H5F_CREATE(file)
data = hanning(100,200)
datatype_id = H5T_IDL_CREATE(data)
dataspace_id = $
H5S_CREATE_SIMPLE([100,100],max_dimensions=[200,200])
dataset_id = H5D_CREATE(fid,'Hanning',datatype_id,dataspace_id, $
chunk_dimensions=[20,20])
H5D_EXTEND,dataset_id,size(data,/dimensions)
H5D_WRITE,dataset_id,data
H5S_CLOSE,dataspace_id
H5T_CLOSE,datatype_id
dataspace_id = H5S_CREATE_SIMPLE(size(data,/dimensions))
H5S_SELECT_HYPERSLAB,dataspace_id,[40,40],[1,1], $
block=[30,30],/reset
ref = H5R_CREATE(fid,'Hanning',dataspace=dataspace_id)
datatype_id = H5T_REFERENCE_CREATE(/region)
dataspace_id = H5S_CREATE_SIMPLE(1)
attr_id = H5A_CREATE(dataset_id,'Ref',datatype_id,dataspace_id)
H5A_WRITE,attr_id,ref
H5A_CLOSE,attr_id
attr_id2 = $
H5A_CREATE(dataset_id,'Dummy',datatype_id,dataspace_id)
H5A_CLOSE,attr_id2
H5A_DELETE,dataset_id,'Dummy'
group_id = H5G_CREATE(fid,'Datatypes and links')
H5G_SET_COMMENT,fid,'Datatypes and links', $
'This is a sample comment'
datatype_id2 = H5T_IDL_CREATE(1)
H5T_COMMIT,group_id,'Integer',datatype_id2
datatype_id3 = H5T_ARRAY_CREATE(datatype_id2,[3,4])
H5T_COMMIT,group_id,'Integer 2',datatype_id3
H5G_MOVE,group_id,'Integer 2','Integer Array'
H5T_CLOSE,datatype_id3
H5T_CLOSE,datatype_id2
struct = {float:1.0, double:1.0d}
datatype_id4 = $
H5T_IDL_CREATE(struct,member_names=['Float','Double'])
datatype_id5 = H5T_IDL_CREATE(1)
H5T_INSERT,datatype_id4,'Integer',datatype_id5
H5T_COMMIT,group_id,'Compound',datatype_id4
H5T_CLOSE,datatype_id5
H5T_CLOSE,datatype_id4
H5G_LINK,fid,'Hanning','Link to Hanning',new_loc_id=group_id
H5G_LINK,group_id,'Integer','Link to Integer'
H5G_UNLINK,group_id,'Link to Integer'
H5G_CLOSE,group_id
H5D_CLOSE,dataset_id
H5T_CLOSE,datatype_id
H5S_CLOSE,dataspace_id
H5F_CLOSE,fid
Version History
See Also
H5F_CLOSE