WriteHDF5_Metadata Subroutine

public subroutine WriteHDF5_Metadata(mtd, group, varid, fileId)

Writes the metadata to a HDF5 file using the fields : * /metadata/{group}/name/{varid} * /metadata/{group}/description/{varid} * /metadata/{group}/units/{varid}

This method assumes that an HDF5 file is already open for writing and is associated with the fileId input.

Arguments

TypeIntentOptionalAttributesName
class(Metadata), intent(in) :: mtd
character, intent(in) :: group
integer, intent(in) :: varid
integer(kind=HID_T), intent(in) :: fileId

Calls

proc~~writehdf5_metadata~~CallsGraph proc~writehdf5_metadata WriteHDF5_Metadata proc~creategroup_hdf5 CreateGroup_HDF5 proc~writehdf5_metadata->proc~creategroup_hdf5 interface~writecharacter_hdf5 WriteCharacter_HDF5 proc~writehdf5_metadata->interface~writecharacter_hdf5 h5lexists_f h5lexists_f proc~creategroup_hdf5->h5lexists_f h5gcreate_f h5gcreate_f proc~creategroup_hdf5->h5gcreate_f h5gclose_f h5gclose_f proc~creategroup_hdf5->h5gclose_f proc~writecharacter_hdf5_serial WriteCharacter_HDF5_serial interface~writecharacter_hdf5->proc~writecharacter_hdf5_serial h5tcopy_f h5tcopy_f proc~writecharacter_hdf5_serial->h5tcopy_f h5sclose_f h5sclose_f proc~writecharacter_hdf5_serial->h5sclose_f h5dwrite_vl_f h5dwrite_vl_f proc~writecharacter_hdf5_serial->h5dwrite_vl_f h5tset_strpad_f h5tset_strpad_f proc~writecharacter_hdf5_serial->h5tset_strpad_f h5screate_simple_f h5screate_simple_f proc~writecharacter_hdf5_serial->h5screate_simple_f h5dcreate_f h5dcreate_f proc~writecharacter_hdf5_serial->h5dcreate_f h5dclose_f h5dclose_f proc~writecharacter_hdf5_serial->h5dclose_f

Contents

Source Code


Source Code

  subroutine WriteHDF5_Metadata(mtd,group,varid,fileId)
  !! Writes the metadata to a HDF5 file using the
  !! fields :
  !!  * `/metadata/{group}/name/{varid}`
  !!  * `/metadata/{group}/description/{varid}`
  !!  * `/metadata/{group}/units/{varid}`
  !!
  !! This method assumes that an HDF5 file is already
  !! open for writing and is associated with the `fileId`
  !! input.
    class(Metadata),intent(in) :: mtd
    character(*),intent(in) :: group
    integer,intent(in) :: varid
    integer(HID_T),intent(in) :: fileId
    ! Local
    character(4) :: varNumber

    ! Add variable names to the file
    call CreateGroup_HDF5(fileId,trim(group)//"/metadata")
    call CreateGroup_HDF5(fileId,trim(group)//"/metadata/name")
    call CreateGroup_HDF5(fileId,trim(group)//"/metadata/description")
    call CreateGroup_HDF5(fileId,trim(group)//"/metadata/units")

    write(varNumber,"(I0)") varid
    call WriteCharacter_HDF5(fileId,trim(group)//"/metadata/name/"//trim(varnumber), &
                             trim(mtd%name))
    call WriteCharacter_HDF5(fileId,trim(group)//"/metadata/description/"//trim(varnumber), &
                             trim(mtd%description))
    call WriteCharacter_HDF5(fileId,trim(group)//"/metadata/units/"//trim(varnumber), &
                             trim(mtd%units))
  endsubroutine WriteHDF5_Metadata