Page tree

The license could not be verified: License Certificate has expired!

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »









Opens an object using its address within an HDF5 file.


H5O_OPEN_BY_ADDR(loc_id, addr)


hid_t H5Oopen_by_addr( hid_t loc_id, haddr_t addr )

SUBROUTINE h5oopen_by_addr_f(loc_id, addr, obj_id, hdferr)
    INTEGER(HID_T)  , INTENT(IN)  :: loc_id
    INTEGER(HID_T)  , INTENT(OUT) :: obj_id
    INTEGER         , INTENT(OUT) :: hdferr

hid_t loc_idIN: File or group identifier
haddr_t addr    IN: Object’s address in the file


H5Oopen_by_addr opens a group, dataset, or committed (named) datatype using its address within an HDF5 file, addr. The resulting opened object is identical to an object opened with H5Oopen and should be closed with H5Oclose or an object-type-specific closing function (such as H5Gclose) when no longer needed.

loc_id can be either the file identifier or a group identifier in the file. In either case, the HDF5 Library uses the identifier only to identify the file.

The object’s address within the file, addr, is the byte offset of the first byte of the object header from the beginning of the HDF5 file space, i.e., from the beginning of the super block (see the “HDF5 Storage Model” section of the “The HDF5 Data Model and File Structure” chapter of the HDF5 User’ Guide).

addr can be obtained via either of two function calls. H5Gget_objinfo returns the object’s address in the objno field of the H5G_stat_t struct; H5Lget_info returns the address in the address field of the H5L_linkinfo_t struct.

Warning: This function must be used with care! 
Improper use can lead to inaccessible data, wasted space in the file, or file corruption. 

This function is dangerous if called on an invalid address. The risk can be safely overcome by retrieving the object address with H5Gget_objinfo or H5Lget_linkinfo immediately before calling H5Oopen_by_addr. The immediacy of the operation can be important; if time has elapsed and the object has been deleted from the file, the address will be invalid and file corruption can result.

The address of the HDF5 file on a physical device has no effect on H5Oopen_by_addr, nor does the use of any file driver. As stated above, the object address is its offset within the HDF5 file; HDF5’s file drivers will transparently map this to an address on a storage device.


Returns an object identifier for the opened object if successful; otherwise returns a negative value.


examples / h5_subset.c [32:42]  1.10/master  HDFFV/hdf5
main (void)
    hsize_t     dims[2], dimsm[2];   
    int         data[DIM0][DIM1];           /* data to write */
    int         sdata[DIM0_SUB][DIM1_SUB];  /* subset to write */
    int         rdata[DIM0][DIM1];          /* buffer for read */
    hid_t       file_id, dataset_id;        /* handles */
    hid_t       dataspace_id, memspace_id; 


     USE HDF5 ! This module contains all necessary modules


     CHARACTER(LEN=11), PARAMETER :: filename = "compound.h5" ! File name
     CHARACTER(LEN=8), PARAMETER :: dsetname = "Compound"     ! Dataset name
     INTEGER, PARAMETER :: dimsize = 6 ! Size of the dataset

     INTEGER(HID_T) :: file_id       ! File identifier

c++ / examples / create.cpp [33:43]  1.10/master  HDFFV/hdf5
int main (void)
    * Data initialization.
   int i, j;
   int data[NX][NY];          // buffer for data to write
   for (j = 0; j < NX; j++)
      for (i = 0; i < NY; i++)

public class H5Ex_D_Chunk {
    private static String FILENAME = "H5Ex_D_Chunk.h5";
    private static String DATASETNAME = "DS1";
    private static final int DIM_X = 6;
    private static final int DIM_Y = 8;
    private static final int CHUNK_X = 4;
    private static final int CHUNK_Y = 4;
    private static final int RANK = 2;
    private static final int NDIMS = 2;

Release    Change
1.8.0Function introduced in this release.
1.8.4Fortran subroutine added in this release.

--- Last Modified: November 14, 2017 | 03:13 PM