HDF5 documents and links 
Introduction to HDF5 
HDF5 User’s Guide 
In the HDF5 Reference Manual 
H5DS   H5IM   H5LT   H5PT   H5TB  Optimized 
H5   H5A   H5D   H5E   H5F   H5G   H5I   H5L 
H5O   H5P   H5PL   H5R   H5S   H5T   H5Z 
Tools   Datatypes   Fortran   Compatibility Macros 
Collective Calls in Parallel 

H5S: Dataspace Interface

Dataspace Object API Functions

These functions create and manipulate the dataspace in which to store the elements of a dataset.

The C Interfaces:
  • H5Screate
  • H5Scopy
  • H5Sclose
  • H5Sdecode
  • H5Sencode
  • H5Screate_simple
  • H5Sis_simple
  • H5Soffset_simple
  • H5Sget_simple_extent_dims
  • H5Sget_simple_extent_ndims
  •       
  • H5Sget_simple_extent_npoints
  • H5Sget_simple_extent_type
  • H5Sextent_copy
  • H5Sextent_equal
  • H5Sset_extent_simple
  • H5Sset_extent_none
  • H5Sget_select_type
  • H5Sget_select_npoints
  • H5Sget_select_hyper_nblocks
  • H5Sget_select_hyper_blocklist
  •       
  • H5Sget_select_elem_npoints
  • H5Sget_select_elem_pointlist
  • H5Sget_select_bounds
  • H5Sselect_elements
  • H5Sselect_all
  • H5Sselect_none
  • H5Sselect_valid
  • H5Sselect_hyperslab

  • Alphabetical Listing
  • H5Sclose
  • H5Scopy
  • H5Screate
  • H5Screate_simple
  • H5Sdecode
  • H5Sencode
  • H5Sextent_copy
  • H5Sextent_equal
  • H5Sget_select_bounds
  • H5Sget_select_elem_npoints
  •       
  • H5Sget_select_elem_pointlist
  • H5Sget_select_hyper_blocklist
  • H5Sget_select_hyper_nblocks
  • H5Sget_select_npoints
  • H5Sget_select_type
  • H5Sget_simple_extent_dims
  • H5Sget_simple_extent_ndims
  • H5Sget_simple_extent_npoints
  • H5Sget_simple_extent_type
  • H5Sis_simple
  •       
  • H5Soffset_simple
  • H5Sselect_all
  • H5Sselect_elements
  • H5Sselect_hyperslab
  • H5Sselect_none
  • H5Sselect_valid
  • H5Sset_extent_none
  • H5Sset_extent_simple

  • The Fortran Interface:
    In general, each Fortran subroutine performs exactly the same task as the corresponding C function.
  • h5screate_f
  • h5scopy_f
  • h5sclose_f
  • h5sdecode_f
  • h5sencode_f
  • h5screate_simple_f
  • h5sis_simple_f
  • h5soffset_simple_f
  • h5sget_simple_extent_dims_f
  • h5sget_simple_extent_ndims_f
  •       
  • h5sget_simple_extent_npoints_f
  • h5sget_simple_extent_type_f
  • h5sextent_copy_f
  • h5sextent_equal_f
  • h5sset_extent_simple_f
  • h5sset_extent_none_f
  • h5sget_select_type_f
  • h5sget_select_npoints_f
  • h5sget_select_hyper_nblocks_f
  • h5sget_select_hyper_blocklist_f
  •       
  • h5sget_select_elem_npoints_f
  • h5sget_select_elem_pointlist_f
  • h5sselect_elements_f
  • h5sselect_all_f
  • h5sselect_none_f
  • h5sselect_valid_f
  • h5sselect_hyperslab_f

  • Last modified: 17 August 2010
    Name: H5Sclose
    Signature:
    herr_t H5Sclose( hid_t space_id )

    Purpose:
    Releases and terminates access to a dataspace.

    Description:
    H5Sclose releases a dataspace. Further access through the dataspace identifier is illegal. Failure to release a dataspace with this call will result in resource leaks.

    Parameters:
    hid_t space_id     IN: Identifier of dataspace to release.

    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.

    Fortran90 Interface: h5sclose_f
    SUBROUTINE h5sclose_f(space_id, hdferr)     
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id  ! Dataspace identifier
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
    END SUBROUTINE h5sclose_f
        

    Last modified: 17 August 2010
    Name: H5Scopy
    Signature:
    hid_t H5Scopy( hid_t space_id )

    Purpose:
    Creates an exact copy of a dataspace.

    Description:
    H5Scopy creates a new dataspace which is an exact copy of the dataspace identified by space_id. The dataspace identifier returned from this function should be released with H5Sclose or resource leaks will occur.

    Parameters:
    hid_t space_id     IN: Identifier of dataspace to copy.

    Returns:
    Returns a dataspace identifier if successful; otherwise returns a negative value.

    Fortran90 Interface: h5scopy_f
    SUBROUTINE h5scopy_f(space_id, new_space_id, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id      ! Dataspace identifier 
      INTEGER(HID_T), INTENT(OUT) :: new_space_id ! Identifier of dataspace copy 
      INTEGER, INTENT(OUT) :: hdferr              ! Error code
                                                  ! 0 on success and -1 on failure
    END SUBROUTINE h5scopy_f
        

    Last modified: 14 October 2014
    Name: H5Screate

    Signature:
    hid_t H5Screate( H5S_class_t type )

    Purpose:
    Creates a new dataspace of a specified type.

    Description:
    H5Screate creates a new dataspace of a particular type. Currently supported types are as follows:
         H5S_SCALAR
         H5S_SIMPLE
         H5S_NULL
    Further dataspace types may be added later.

    A scalar dataspace, H5S_SCALAR, has a single element, though that element may be of a complex datatype, such as a compound or array datatype. By convention, the rank of a scalar dataspace is always 0 (zero); think of it geometrically as a single, dimensionless point, though that point can be complex.

    A simple dataspace, H5S_SIMPLE, consists of a regular array of elements.

    A null dataspace, H5S_NULL, has no data elements.

    The dataspace identifier returned by this function can be released with H5Sclose so that resource leaks will not occur.

    Parameters:
    H5S_class_t type     IN: Type of dataspace to be created.

    Returns:
    Returns a dataspace identifier if successful; otherwise returns a negative value.

    Fortran90 Interface: h5screate_f
    SUBROUTINE h5screate_f(classtype, space_id, hdferr) 
      IMPLICIT NONE
      INTEGER, INTENT(IN) :: classtype        ! The type of the dataspace
                                              ! to be created. Possible values
                                              ! are: 
                                              !    H5S_SCALAR_F 
                                              !    H5S_SIMPLE_F 
                                              !    H5S_NULL_F (Not yet implemented)
      INTEGER(HID_T), INTENT(OUT) :: space_id ! Dataspace identifier 
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
    END SUBROUTINE h5screate_f
        
    See Also:
    “Using Identifiers”

    Last modified: 14 October 2014
    Name: H5Screate_simple

    Signature:
    hid_t H5Screate_simple( int rank, const hsize_t * current_dims, const hsize_t * maximum_dims )

    Purpose:
    Creates a new simple dataspace and opens it for access.

    Description:
    H5Screate_simple creates a new simple dataspace and opens it for access, returning a dataspace identifier.

    rank is the number of dimensions used in the dataspace.

    current_dims is a one-dimensional array of size rank specifying the size of each dimension of the dataset. maximum_dims is an array of the same size specifying the upper limit on the size of each dimension.

    Any element of current_dims can be 0 (zero). Note that no data can be written to a dataset if the size of any dimension of its current dataspace is 0. This is sometimes a useful initial state for a dataset.

    maximum_dims may be the null pointer, in which case the upper limit is the same as current_dims. Otherwise, no element of maximum_dims should be smaller than the corresponding element of current_dims.

    If an element of maximum_dims is H5S_UNLIMITED, the maximum size of the corresponding dimension is unlimited.

    Any dataset with an unlimited dimension must also be chunked; see H5Pset_chunk. Similarly, a dataset must be chunked if current_dims does not equal maximum_dims.

    The dataspace identifier returned from this function must be released with H5Sclose or resource leaks will occur.

    Parameters:
    int rank IN: Number of dimensions of dataspace.
    const hsize_t * current_dims IN: Array specifying the size of each dimension.
    const hsize_t * maximum_dims     IN: Array specifying the maximum size of each dimension.

    Returns:
    Returns a dataspace identifier if successful; otherwise returns a negative value.

    See Also:
    H5Pset_chunk
    H5Dset_extent

    Fortran90 Interface: h5screate_simple_f
    SUBROUTINE h5screate_simple_f(rank, dims, space_id, hdferr, maxdims) 
      IMPLICIT NONE
      INTEGER, INTENT(IN) :: rank             ! Number of dataspace dimensions 
      INTEGER(HSIZE_T), INTENT(IN) :: dims(*) ! Array with current dimension sizes 
      INTEGER(HID_T), INTENT(OUT) :: space_id ! Dataspace identifier 
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
      INTEGER(HSIZE_T), OPTIONAL, INTENT(IN) :: maxdims(*) 
                                              ! Array with the maximum 
                                              ! dimension sizes 
    END SUBROUTINE h5screate_simple_f
            
    See Also:
    “Using Identifiers”

    Name: H5Sdecode
    Signature:
    hid_t H5Sdecode (unsigned char *buf)
    Purpose:
    Decode a binary object description of data space and return a new object handle.
    Description:
    Given an object description of data space in binary in a buffer, H5Sdecode reconstructs the HDF5 data type object and returns a new object handle for it. The binary description of the object is encoded by H5Sencode. User is responsible for passing in the right buffer. The types of data space we address in this function are null, scalar, and simple space. For simple data space, the information of selection, for example, hyperslab selection, is also encoded and decoded. Complex data space has not been implemented in the library.
    Parameters:
    Returns:
    Returns an object ID(non-negative) if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sdecode_f
    SUBROUTINE h5sdecode_f(buf, obj_id, hdferr)
      IMPLICIT NONE
      CHARACTER(LEN=*), INTENT(IN) :: buf   ! Buffer of data space object to 
                                            ! be decoded.
      INTEGER(HID_T), INTENT(OUT) :: obj_id ! Object ID
      INTEGER, INTENT(OUT) :: hdferr        ! Error code
                                            ! 0 on success and -1 on failure
    END SUBROUTINE h5sdecode_f
    	

    Name: H5Sencode
    Signature:
    herr_t H5Sencode(hid_t obj_id, unsigned char *buf, size_t *nalloc)
    Purpose:
    Encode a data space object description into a binary buffer.
    Description:
    Given the data space ID, H5Sencode converts a data space description into binary form in a buffer. Using this binary form in the buffer, a data space object can be reconstructed using H5Sdecode to return a new object handle(hid_t) for this data space.

    A preliminary H5Sencode call can be made to find out the size of the buffer needed. This value is returned as nalloc. That value can then be assigned to nalloc for a second H5Sencode call, which will retrieve the actual encoded object.

    If the library finds out nalloc is not big enough for the object, it simply returns the size of the buffer needed through nalloc without encoding the provided buffer.

    The types of data space we address in this function are null, scalar, and simple space. For simple data space, the information of selection, for example, hyperslab selection, is also encoded and decoded. Complex data space has not been implemented in the library.

    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sencode_f
    SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr)
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: obj_id ! Identifier of the object to be encoded
      CHARACTER(LEN=*), INTENT(OUT) :: buf ! Buffer of object to be encoded into
      INTEGER(SIZE_T), INTENT(INOUT) :: nalloc 
                                           ! Size of the allocated buffer
      INTEGER, INTENT(OUT) :: hdferr       ! Error code
                                           ! 0 on success and -1 on failure
    END SUBROUTINE h5sencode_f
    	

    Name: H5Sextent_copy
    Signature:
    herr_t H5Sextent_copy(hid_t dest_space_id, hid_t source_space_id )
    Purpose:
    Copies the extent of a dataspace.
    Description:
    H5Sextent_copy copies the extent from source_space_id to dest_space_id. This action may change the type of the dataspace.
    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sextent_copy_f
    SUBROUTINE h5sextent_copy_f(dest_space_id, source_space_id, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: dest_space_id   ! Identifier of destination
                                                    ! dataspace
      INTEGER(HID_T), INTENT(IN) :: source_space_id ! Identifier of source 
                                                    ! dataspace
      INTEGER, INTENT(OUT) :: hdferr                ! Error code
                                                    ! 0 on success and -1 on failure 
    END SUBROUTINE h5sextent_copy_f
    	

    Last modified: 17 August 2010
    Name: H5Sextent_equal
    Signature:
    htri_t H5Sextent_equal( hid_t space1_id, hid_t space2_id )

    Purpose:
    Determines whether two dataspace extents are equal.

    Description:
    H5Sextent_equal determines whether the dataspace extents of two dataspaces, space1_id and space2_id, are equal.

    Parameters:
    hid_t space1_id IN: First dataspace identifier.
    hid_t space2_id     IN: Second dataspace identifier.

    Returns:
    Returns TRUE if equal, FALSE if unequal, if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sextent_equal_f
    SUBROUTINE h5sextent_equal_f(space1_id, space2_id, equal, hdferr)
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space1_id ! First dataspace identifier
      INTEGER(HID_T), INTENT(IN) :: space2_id ! Second dataspace identifier
      LOGICAL, INTENT(OUT) :: Equal           ! .TRUE. if equal, .FALSE. if unequal
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure 
    END SUBROUTINE h5sextent_equal_f 
    	

    Name: H5Sget_select_bounds
    Signature:
    herr_t H5Sget_select_bounds(hid_t space_id, hsize_t *start, hsize_t *end )
    Purpose:
    Gets the bounding box containing the current selection.
    Description:
    H5Sget_select_bounds retrieves the coordinates of the bounding box containing the current selection and places them into user-supplied buffers.

    The start and end buffers must be large enough to hold the dataspace rank number of coordinates.

    The bounding box exactly contains the selection. I.e., if a 2-dimensional element selection is currently defined as containing the points (4,5), (6,8), and (10,7), then the bounding box will be (4, 5), (10, 8).

    The bounding box calculation includes the current offset of the selection within the dataspace extent.

    Calling this function on a none selection will return FAIL.

    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface:
    SUBROUTINE  h5sget_select_bounds_f(space_id, start, end, hdferr)
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id 
                                       ! Dataspace identifier 
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start
                                       ! Starting coordinates of the bounding box 
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: end
                                       ! Ending coordinates of the bounding box,
                                       ! i.e., the coordinates of the diagonally 
                                       ! opposite corner 
      INTEGER, INTENT(OUT) :: hdferr   ! Error code
    END SUBROUTINE h5sget_select_bounds_f
    	
    History:

    Name: H5Sget_select_elem_npoints
    Signature:
    hssize_t H5Sget_select_elem_npoints(hid_t space_id )
    Purpose:
    Gets the number of element points in the current selection.
    Description:
    H5Sget_select_elem_npoints returns the number of element points in the current dataspace selection.
    Parameters:
    Returns:
    Returns the number of element points in the current dataspace selection if successful. Otherwise returns a negative value.
    Fortran90 Interface: h5sget_select_elem_npoints_f
    SUBROUTINE h5sget_select_elem_npoints_f(space_id, num_points, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier
      INTEGER, INTENT(OUT) :: num_points     ! Number of points in 
                                             ! the current elements selection
      INTEGER, INTENT(OUT) :: hdferr         ! Error code
    END SUBROUTINE h5sget_select_elem_npoints_f
    	

    Name: H5Sget_select_elem_pointlist
    Signature:
    herr_t H5Sget_select_elem_pointlist(hid_t space_id, hsize_t startpoint, hsize_t numpoints, hsize_t *buf )
    Purpose:
    Gets the list of element points currently selected.
    Description:
    H5Sget_select_elem_pointlist returns the list of element points in the current dataspace selection. Starting with the startpoint-th point in the list of points, numpoints points are put into the user's buffer. If the user's buffer fills up before numpoints points are inserted, the buffer will contain only as many points as fit.

    The element point coordinates have the same dimensionality (rank) as the dataspace they are located within. The list of element points is formatted as follows:
         <coordinate>, followed by
         the next coordinate,
         etc.
    until all of the selected element points have been listed.

    The points are returned in the order they will be iterated through when the selection is read/written from/to disk.

    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sget_select_elem_pointlist_f
    SUBROUTINE h5sget_select_elem_pointlist_f(space_id, startpoint, num_points,
                                              buf, hdferr)
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN)   :: space_id   ! Dataspace identifier
      INTEGER(HSIZE_T), INTENT(IN) :: startpoint ! Element point to start with
      INTEGER, INTENT(OUT) :: num_points         ! Number of points to get in 
                                                 ! the current element selection
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: buf
                                                 ! List of points selected 
      INTEGER, INTENT(OUT) :: hdferr             ! Error code
    END SUBROUTINE h5sget_select_elem_pointlist_f
    	

    Name: H5Sget_select_hyper_blocklist
    Signature:
    herr_t H5Sget_select_hyper_blocklist(hid_t space_id, hsize_t startblock, hsize_t numblocks, hsize_t *buf )
    Purpose:
    Gets the list of hyperslab blocks currently selected.
    Description:
    H5Sget_select_hyper_blocklist returns a list of the hyperslab blocks currently selected. Starting with the startblock-th block in the list of blocks, numblocks blocks are put into the user's buffer. If the user's buffer fills up before numblocks blocks are inserted, the buffer will contain only as many blocks as fit.

    The block coordinates have the same dimensionality (rank) as the dataspace they are located within. The list of blocks is formatted as follows:
         <"start" coordinate>, immediately followed by
         <"opposite" corner coordinate>, followed by
         the next "start" and "opposite" coordinates,
         etc.
    until all of the selected blocks have been listed.

    No guarantee is implied as the order in which blocks are listed.

    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sget_select_hyper_blocklist_f
    SUBROUTINE h5sget_select_hyper_blocklist_f(space_id, startblock, num_blocks,
                                               buf, hdferr)
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN)   :: space_id   ! Dataspace identifier
      INTEGER(HSIZE_T), INTENT(IN) :: startblock ! Hyperslab block to start with
                                                 ! NOTE: numbering starts at 0
      INTEGER, INTENT(OUT) :: num_blocks         ! Number of hyperslab blocks to 
                                                 ! get in the current hyperslab 
                                                 ! selection
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: buf
                                                 ! List of hyperslab blocks selected
      INTEGER, INTENT(OUT) :: hdferr             ! Error code
    END SUBROUTINE h5sget_select_hyper_blocklist_f
    	

    Last modified: 7 November 2011
    Name: H5Sget_select_hyper_nblocks
    Signature:
    hssize_t H5Sget_select_hyper_nblocks( hid_t space_id )

    Purpose:
    Get number of hyperslab blocks.

    Description:
    H5Sget_select_hyper_nblocks returns the number of hyperslab blocks in the current dataspace selection.

    Parameters:
    hid_t space_id     IN: Identifier of dataspace to query.

    Returns:
    Returns the number of hyperslab blocks in the current dataspace selection if successful. Otherwise returns a negative value.

    Fortran90 Interface: h5sget_select_hyper_nblocks_f
    SUBROUTINE h5sget_select_hyper_nblocks_f(space_id, num_blocks, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id         ! Dataspace identifier
      INTEGER(HSSIZE_T), INTENT(OUT) :: num_blocks   ! Number of hyperslab blocks in 
                                                     ! current hyperslab selection
      INTEGER, INTENT(OUT) :: hdferr                 ! Error code
    END SUBROUTINE h5sget_select_hyper_nblocks_f
        

    Last modified: 17 August 2010
    Name: H5Sget_select_npoints
    Signature:
    hssize_t H5Sget_select_npoints( hid_t space_id )

    Purpose:
    Determines the number of elements in a dataspace selection.

    Description:
    H5Sget_select_npoints determines the number of elements in the current selection of a dataspace.

    Parameters:
    hid_t space_id     IN: Dataspace identifier.

    Returns:
    Returns the number of elements in the selection if successful; otherwise returns a negative value.

    Fortran90 Interface: h5sget_select_npoints_f
    SUBROUTINE h5sget_select_npoints_f(space_id, npoints, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id     ! Dataspace identifier 
      INTEGER(HSSIZE_T), INTENT(OUT) :: npoints  ! Number of elements in the
                                                 ! selection 
      INTEGER, INTENT(OUT) :: hdferr             ! Error code
                                                 ! 0 on success and -1 on failure 
    END SUBROUTINE h5sget_select_npoints_f
        

    Last modified: 17 August 2010
    Name: H5Sget_select_type
    Signature:
    H5S_sel_type H5Sget_select_type(hid_t space_id)

    Purpose:
    Determines the type of the dataspace selection.

    Description:
    H5Sget_select_type retrieves the type of selection currently defined for the dataspace space_id.

    Parameters:
    hid_t space_id     IN: Dataspace identifier.

    Returns:
    Returns the dataspace selection type, a value of the enumerated datatype H5S_sel_type, if successful. Valid return values are as follows:
    H5S_SEL_NONE No selection is defined.
    H5S_SEL_POINTS A sequence of points is selected.
    H5S_SEL_HYPERSLABS A hyperslab or compound hyperslab is selected.
    H5S_SEL_ALL The entire dataset is selected.
    Otherwise returns a negative value.

    Fortran90 Interface: h5sget_select_type_f
    SUBROUTINE h5sget_select_type_f(space_id, type, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier
      INTEGER, INTENT(OUT) :: type           ! Selection type
                                             ! Valid values are:
                                             !    H5S_SEL_ERROR_F 
                                             !    H5S_SEL_NONE_F 
                                             !    H5S_SEL_POINTS_F 
                                             !    H5S_SEL_HYPERSLABS_F 
                                             !    H5S_SEL_ALL_F 
      INTEGER, INTENT(OUT) :: hdferr         ! Error code
    END SUBROUTINE h5sget_select_type_f
        

    History:
    Release     C
    1.6.0 Function introduced in this release.

    Name: H5Sget_simple_extent_dims
    Signature:
    int H5Sget_simple_extent_dims(hid_t space_id, hsize_t *dims, hsize_t *maxdims )
    Purpose:
    Retrieves dataspace dimension size and maximum size.
    Description:
    H5Sget_simple_extent_dims returns the size and maximum sizes of each dimension of a dataspace through the dims and maxdims parameters.

    Either or both of dims and maxdims may be NULL.

    If a value in the returned array maxdims is H5S_UNLIMITED (-1), the maximum size of that dimension is unlimited.

    Parameters:
    Returns:
    Returns the number of dimensions in the dataspace if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sget_simple_extent_dims_f
    SUBROUTINE h5sget_simple_extent_dims_f(space_id, dims, maxdims, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id   ! Dataspace identifier 
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: dims 
                                               ! Array to store dimension sizes 
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: maxdims 
                                               ! Array to store max dimension sizes
      INTEGER, INTENT(OUT) :: hdferr           ! Error code
                                               ! Dataspace rank on success 
                                               ! and -1 on failure
    END SUBROUTINE h5sget_simple_extent_dims_f
    	

    Last modified: 17 August 2010
    Name: H5Sget_simple_extent_ndims
    Signature:
    int H5Sget_simple_extent_ndims( hid_t space_id )

    Purpose:
    Determines the dimensionality of a dataspace.

    Description:
    H5Sget_simple_extent_ndims determines the dimensionality (or rank) of a dataspace.

    Parameters:
    hid_t space_id     IN: Identifier of the dataspace

    Returns:
    Returns the number of dimensions in the dataspace if successful; otherwise returns a negative value.

    Fortran90 Interface: h5sget_simple_extent_ndims_f
    SUBROUTINE h5sget_simple_extent_ndims_f(space_id, rank, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id   ! Dataspace identifier 
      INTEGER, INTENT(OUT) :: rank             ! Number of dimensions 
      INTEGER, INTENT(OUT) :: hdferr           ! Error code
                                               ! 0 on success and -1 on failure
    END SUBROUTINE h5sget_simple_extent_ndims_f
        

    Last modified: 3 January 2013
    Name: H5Sget_simple_extent_npoints
    Signature:
    hssize_t H5Sget_simple_extent_npoints( hid_t space_id )

    Purpose:
    Determines the number of elements in a dataspace.

    Description:
    H5Sget_simple_extent_npoints determines the number of elements in a dataspace. For example, a simple 3-dimensional dataspace with dimensions 2, 3, and 4 would have 24 elements.

    Parameters:
    hid_t space_id     IN: Identifier of the dataspace object to query

    Returns:
    Returns the number of elements in the dataspace if successful; otherwise returns a negative value.

    Fortran90 Interface: h5sget_simple_extent_npoints_f
    SUBROUTINE h5sget_simple_extent_npoints_f(space_id, npoints, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id    ! Dataspace identifier 
      INTEGER(HSIZE_T), INTENT(OUT) :: npoints  ! Number of elements in dataspace
      INTEGER, INTENT(OUT) :: hdferr            ! Error code
                                                ! 0 on success and -1 on failure
    END SUBROUTINE h5sget_simple_extent_npoints_f
        

    Last modified: 26 April 2011
    Name: H5Sget_simple_extent_type
    Signature:
    H5S_class_t H5Sget_simple_extent_type( hid_t space_id )

    Purpose:
    Determines the current class of a dataspace.

    Description:
    H5Sget_simple_extent_type queries a dataspace to determine the current class of a dataspace.

    The function returns a class name, one of the following:

            H5S_SCALAR
            H5S_SIMPLE
            H5S_NULL
            

    Parameters:
    hid_t space_id     IN: Dataspace identifier.

    Returns:
    Returns a dataspace class name if successful; otherwise H5S_NO_CLASS (-1).

    Fortran90 Interface: h5sget_simple_extent_type_f
    SUBROUTINE h5sget_simple_extent_type_f(space_id, classtype, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier 
      INTEGER, INTENT(OUT) :: classtype      ! Class type 
                                             ! Possible values are: 
                                             !    H5S_NO_CLASS_F 
                                             !    H5S_SCALAR_F 
                                             !    H5S_SIMPLE_F 
                                             !    H5S_NULL_F 
      INTEGER, INTENT(OUT) :: hdferr         ! Error code
                                             ! 0 on success and -1 on failure
    END SUBROUTINE h5sget_simple_extent_type_f
        

    Last modified: 17 August 2010
    Name: H5Sis_simple
    Signature:
    htri_t H5Sis_simple( hid_t space_id )

    Purpose:
    Determines whether a dataspace is a simple dataspace.

    Description:
    H5Sis_simple determines whether a dataspace is a simple dataspace. [Currently, all dataspace objects are simple dataspaces; complex dataspace support will be added in the future.]

    Parameters:
    hid_t space_id     IN: Identifier of the dataspace to query

    Returns:
    When successful, returns a positive value, for TRUE, or 0 (zero), for FALSE. Otherwise returns a negative value.

    Fortran90 Interface: h5sis_simple_f
    SUBROUTINE h5sis_simple_f(space_id, flag, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id    ! Dataspace identifier 
      LOGICAL, INTENT(OUT) :: flag              ! Flag, indicates if dataspace
                                                ! is simple or not: 
                                                ! TRUE or FALSE  
      INTEGER, INTENT(OUT) :: hdferr            ! Error code
                                                ! 0 on success and -1 on failure 
    END SUBROUTINE h5sis_simple_f
        

    Name: H5Soffset_simple
    Signature:
    herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset )
    Purpose:
    Sets the offset of a simple dataspace.
    Description:
    H5Soffset_simple sets the offset of a simple dataspace space_id. The offset array must be the same number of elements as the number of dimensions for the dataspace. If the offset array is set to NULL, the offset for the dataspace is reset to 0.

    This function allows the same shaped selection to be moved to different locations within a dataspace without requiring it to be redefined.

    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface: h5soffset_simple_f
    SUBROUTINE h5soffset_simple_f(space_id, offset, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id    ! Dataspace identifier 
      INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) ::  offset
                                                ! The offset at which to position
                                                ! the selection  
      INTEGER, INTENT(OUT) :: hdferr            ! Error code
                                                ! 0 on success and -1 on failure
    END SUBROUTINE h5soffset_simple_f
    	

    Last modified: 6 April 2009
    Name: H5Sselect_all
    Signature:
    herr_t H5Sselect_all( hid_t dspace_id )

    Purpose:
    Selects an entire dataspace.

    Description:
    H5Sselect_all selects the entire extent of the dataspace dspace_id.

    More specifically, H5Sselect_all sets the selection type to H5S_SEL_ALL, which specifies the entire dataspace anywhere it is applied.

    Parameters:

    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.

    See Also:
    H5Sget_select_type

    Fortran90 Interface: h5sselect_all_f
    SUBROUTINE h5sselect_all_f(dspace_id, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: dspace_id ! Dataspace identifier 
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
    END SUBROUTINE h5sselect_all_f
    	

    Last modified: 17 August 2010
    Name: H5Sselect_elements
    Signature:
    herr_t H5Sselect_elements( hid_t space_id, H5S_seloper_t op, size_t num_elements, const hsize_t *coord )

    Purpose:
    Selects array elements to be included in the selection for a dataspace.

    Description:
    H5Sselect_elements selects array elements to be included in the selection for the space_id dataspace. This is referred to as a point selection.

    The number of elements selected is set in the num_elements parameter.

    The coord parameter is a pointer to a buffer containing a serialized 2-dimensional array of size num_elements by the rank of the dataspace. The array lists dataset elements in the point selection; that is, it’s a list of of zero-based values specifying the coordinates in the dataset of the selected elements. The order of the element coordinates in the coord array specifies the order in which the array elements are iterated through when I/O is performed. Duplicate coordinate locations are not checked for. See below for examples of the mapping between the serialized contents of the buffer and the point selection array that it represents.

    The selection operator op determines how the new selection is to be combined with the previously existing selection for the dataspace. The following operators are supported:

    H5S_SELECT_SET Replaces the existing selection with the parameters from this call. Overlapping blocks are not supported with this operator. Adds the new selection to the existing selection.
    H5S_SELECT_APPEND Adds the new selection following the last element of the existing selection.
    H5S_SELECT_PREPEND   Adds the new selection preceding the first element of the existing selection.

    Mapping the serialized coord buffer to a 2-dimensional point selection array:   To illustrate the construction of the contents of the coord buffer, consider two simple examples: a selection of 5 points in a 1-dimensional array and a selection of 3 points in a 4-dimensional array.

    In the 1D case, we will be selecting five points and a 1D dataspace has rank 1, so the selection will be described in a 5-by-1 array. To select the 1st, 14th, 17th, 23rd, 8th elements of the dataset, the selection array would be as follows (remembering that point coordinates are zero-based):

             0
            13
            16
            22
             7 
    This point selection array will be serialized in the coord buffer as:
             0 13 16 22 7 

    In the 4D case, we will be selecting three points and a 4D dataspace has rank 4, so the selection will be described in a 3-by-4 array. To select the points (1,1,1,1), (14,6,12,18), and (8,22,30,22), the point selection array would be as follows:

             0  0  0  0
            13  5 11 17
             7 21 29 21
    This point selection array will be serialized in the coord buffer as:
             0 0 0 0 13 5 11 17 7 21 29 21

    Parameters:
    hid_t space_id IN: Identifier of the dataspace.
    H5S_seloper_t op IN: Operator specifying how the new selection is to be combined with the existing selection for the dataspace.
    size_t num_elements     IN: Number of elements to be selected.
    const hsize_t *coord IN: A pointer to a buffer containing a serialized copy of a 2-dimensional array of zero-based values specifying the coordinates of the elements in the point selection.
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.

    Fortran90 Interface: h5sselect_elements_f
    SUBROUTINE h5sselect_elements_f(space_id, operator, rank, num_elements,
                                    coord, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id  ! Dataspace identifier 
      INTEGER, INTENT(IN) :: operator         ! Flag, valid values are:
                                              !    H5S_SELECT_SET_F 
                                              !    H5S_SELECT_APPEND_F 
                                              !    H5S_SELECT_PREPEND_F 
      INTEGER, INTENT(IN) :: rank             ! Number of dataspace 
                                              ! dimensions
      INTEGER(SIZE_T), INTENT(IN) :: num_elements  
                                              ! Number of elements to be 
                                              ! selected
      INTEGER(HSIZE_T), DIMENSION(rank,num_elements), INTENT(IN) :: coord  
                                              ! A 1-based array containing the 
                                              ! coordinates of the selected 
                                              ! elements
                                              ! NOTE: Reversed dimension declaration
                                              ! compared to the C specification
                                              ! of coord(num_elements, rank)
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
    END SUBROUTINE h5sselect_elements_f
        

    History:
    Release     Change
    1.6.4 C coord parameter type changed to const hsize_t.
    Fortran coord parameter type changed to INTEGER(HSIZE_T).

    Name: H5Sselect_hyperslab
    Signature:
    herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t *start, const hsize_t *stride, const hsize_t *count, const hsize_t *block )
    Purpose:
    Selects a hyperslab region to add to the current selected region.
    Description:
    H5Sselect_hyperslab selects a hyperslab region to add to the current selected region for the dataspace specified by space_id.

    The start, stride, count, and block arrays must be the same size as the rank of the dataspace. For example, if the dataspace is 4-dimensional, each of these parameters must be a 1-dimensional array of size 4.

    The selection operator op determines how the new selection is to be combined with the already existing selection for the dataspace. The following operators are supported:

    H5S_SELECT_SET Replaces the existing selection with the parameters from this call. Overlapping blocks are not supported with this operator.
    H5S_SELECT_OR Adds the new selection to the existing selection.    (Binary OR)
    H5S_SELECT_AND Retains only the overlapping portions of the new selection and the existing selection.    (Binary AND)
    H5S_SELECT_XOR Retains only the elements that are members of the new selection or the existing selection, excluding elements that are members of both selections.    (Binary exclusive-OR, XOR)
    H5S_SELECT_NOTB   Retains only elements of the existing selection that are not in the new selection.
    H5S_SELECT_NOTA Retains only elements of the new selection that are not in the existing selection.

    The start array specifies the offset of the starting element of the specified hyperslab.

    The stride array chooses array locations from the dataspace with each value in the stride array determining how many elements to move in each dimension. Setting a value in the stride array to 1 moves to each element in that dimension of the dataspace; setting a value of 2 in allocation in the stride array moves to every other element in that dimension of the dataspace. In other words, the stride determines the number of elements to move from the start location in each dimension. Stride values of 0 are not allowed. If the stride parameter is NULL, a contiguous hyperslab is selected (as if each value in the stride array were set to 1).

    The count array determines how many blocks to select from the dataspace, in each dimension.

    The block array determines the size of the element block selected from the dataspace. If the block parameter is set to NULL, the block size defaults to a single element in each dimension (as if each value in the block array were set to 1).

    For example, consider a 2-dimensional dataspace with hyperslab selection settings as follows: the start offset is specified as [1,1], stride is [4,4], count is [3,7], and block is [2,2]. In C, these settings will specify a hyperslab consisting of 21 2x2 blocks of array elements starting with location (1,1) with the selected blocks at locations (1,1), (5,1), (9,1), (1,5), (5,5), etc.; in Fortran, they will specify a hyperslab consisting of 21 2x2 blocks of array elements starting with location (2,2) with the selected blocks at locations (2,2), (6,2), (10,2), (2,6), (6,6), etc.

    Regions selected with this function call default to C order iteration when I/O is performed.

    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sselect_hyperslab_f
    SUBROUTINE h5sselect_hyperslab_f(space_id, operator, start, count,
                                     hdferr, stride, block) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id  ! Dataspace identifier 
      INTEGER, INTENT(IN) :: op               ! Flag, valid values are:
                                              !    H5S_SELECT_SET_F
                                              !    H5S_SELECT_OR_F
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start
                                              ! Offset of start of hyperslab
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count 
                                              ! Number of blocks to select 
                                              ! from dataspace 
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
      INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: stride
                                              ! Array of how many elements to 
                                              ! move in each direction
      INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: block 
                                              ! Size of the element block 
    END SUBROUTINE h5sselect_hyperslab_f
    	
    History:

    Name: H5Sselect_none
    Signature:
    herr_t H5Sselect_none(hid_t space_id)
    Purpose:
    Resets the selection region to include no elements.
    Description:
    H5Sselect_none resets the selection region for the dataspace space_id to include no elements.
    Parameters:
    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.
    Fortran90 Interface: h5sselect_none_f
    SUBROUTINE h5sselect_none_f(space_id, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id  ! Dataspace identifier 
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
    END SUBROUTINE h5sselect_none_f
    	

    Last modified: 17 August 2010
    Name: H5Sselect_valid
    Signature:
    htri_t H5Sselect_valid( hid_t space_id )

    Purpose:
    Verifies that the selection is within the extent of the dataspace.

    Description:
    H5Sselect_valid verifies that the selection for the dataspace space_id is within the extent of the dataspace if the current offset for the dataspace is used.

    Parameters:

    Returns:
    Returns a positive value, for TRUE, if the selection is contained within the extent or 0 (zero), for FALSE, if it is not. Returns a negative value on error conditions such as the selection or extent not being defined.

    Fortran90 Interface: h5sselect_valid_f
    SUBROUTINE h5sselect_valid_f(space_id, flag, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id  ! Dataspace identifier 
      LOGICAL, INTENT(OUT) :: flag            ! TRUE if the selection is
                                              ! contained within the extent,
                                              ! FALSE otherwise. 
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
    END SUBROUTINE h5sselect_valid_f
        

    Last modified: 17 August 2010
    Name: H5Sset_extent_none
    Signature:
    herr_t H5Sset_extent_none( hid_t space_id )

    Purpose:
    Removes the extent from a dataspace.

    Description:
    H5Sset_extent_none removes the extent from a dataspace and sets the type to H5S_NO_CLASS.

    Parameters:
    hid_t space_id     IN: The identifier for the dataspace from which the extent is to be removed.

    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.

    Fortran90 Interface: h5sset_extent_none_f
    SUBROUTINE h5sset_extent_none_f(space_id, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id  ! Dataspace identifier 
      INTEGER, INTENT(OUT) :: hdferr          ! Error code
                                              ! 0 on success and -1 on failure
    END SUBROUTINE h5sset_extent_none_f
        

    Last modified: 16 November 2010
    Name: H5Sset_extent_simple
    Signature:
    herr_t H5Sset_extent_simple( hid_t space_id, int rank, const hsize_t *current_size, const hsize_t *maximum_size )

    Purpose:
    Sets or resets the size of an existing dataspace.

    Description:
    H5Sset_extent_simple sets or resets the size of an existing dataspace.

    rank is the dimensionality, or number of dimensions, of the dataspace.

    current_size is an array of size rank which contains the new size of each dimension in the dataspace. maximum_size is an array of size rank which contains the maximum size of each dimension in the dataspace.

    Any previous extent is removed from the dataspace, the dataspace type is set to H5S_SIMPLE, and the extent is set as specified.

    Note that a dataset must be chunked if current_size does not equal maximum_size.

    Parameters:
    hid_t space_id IN: Dataspace identifier.
    int rank IN: Rank, or dimensionality, of the dataspace.
    const hsize_t *current_size     IN: Array containing current size of dataspace.
    const hsize_t *maximum_size IN: Array containing maximum size of dataspace.

    Returns:
    Returns a non-negative value if successful; otherwise returns a negative value.

    Fortran90 Interface: h5sset_extent_simple_f
    SUBROUTINE h5sset_extent_simple_f(space_id, rank, current_size,
                                      maximum_size, hdferr) 
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: space_id     ! Dataspace identifier 
      INTEGER, INTENT(IN) :: rank                ! Dataspace rank 
      INTEGER(HSIZE_T), DIMENSION(rank), INTENT(IN) :: current_size 
                                                 ! Array with the new sizes
                                                 ! of dimensions 
      INTEGER(HSIZE_T), DIMENSION(rank), INTENT(IN) ::  
                                                 ! Array with the new maximum
                                                 ! sizes of dimensions 
      INTEGER, INTENT(OUT) :: hdferr             ! Error code
                                                 ! 0 on success and -1 on failure
    END SUBROUTINE h5sset_extent_simple_f
        

    HDF5 documents and links 
    Introduction to HDF5 
    HDF5 User’s Guide 
    In the HDF5 Reference Manual 
    H5DS   H5IM   H5LT   H5PT   H5TB  Optimized 
    H5   H5A   H5D   H5E   H5F   H5G   H5I   H5L 
    H5O   H5P   H5PL   H5R   H5S   H5T   H5Z 
    Tools   Datatypes   Fortran   Compatibility Macros 
    Collective Calls in Parallel 

    The HDF Group Help Desk:
    Describes HDF5 Release 1.8.18, November 2016.
      Copyright by The HDF Group
    and the Board of Trustees of the University of Illinois