get_att_char_netcdf Subroutine

public subroutine get_att_char_netcdf(filename, varname, att_name, att_value, group_name, rc)

Uses

    • netcdf
  • proc~~get_att_char_netcdf~~UsesGraph proc~get_att_char_netcdf get_att_char_netcdf netcdf netcdf proc~get_att_char_netcdf->netcdf

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
character(len=*), intent(in) :: varname
character(len=*), intent(in) :: att_name
character(len=*), intent(out) :: att_value
character(len=*), intent(out), optional :: group_name
integer, intent(out), optional :: rc

Calls

proc~~get_att_char_netcdf~~CallsGraph proc~get_att_char_netcdf get_att_char_netcdf nf90_close nf90_close proc~get_att_char_netcdf->nf90_close nf90_get_att nf90_get_att proc~get_att_char_netcdf->nf90_get_att nf90_inq_ncid nf90_inq_ncid proc~get_att_char_netcdf->nf90_inq_ncid nf90_inq_varid nf90_inq_varid proc~get_att_char_netcdf->nf90_inq_varid nf90_open nf90_open proc~get_att_char_netcdf->nf90_open proc~check_nc_status check_nc_status proc~get_att_char_netcdf->proc~check_nc_status proc~mapl_return MAPL_Return proc~get_att_char_netcdf->proc~mapl_return proc~mapl_verify MAPL_Verify proc~get_att_char_netcdf->proc~mapl_verify proc~check_nc_status->proc~mapl_return interface~mapl_assert MAPL_Assert proc~check_nc_status->interface~mapl_assert nf90_strerror nf90_strerror proc~check_nc_status->nf90_strerror at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

  subroutine get_att_char_netcdf(filename, varname, att_name, att_value, group_name, rc)
    use netcdf
    implicit none
    character(len=*), intent(in) :: filename
    character(len=*), intent(in) :: varname
    character(len=*), intent(in) :: att_name
    character(len=*), intent(out) :: att_value
    character(len=*), optional, intent(out) :: group_name
    integer, optional, intent(out) :: rc
    integer :: status
    integer :: ncid, ncid_grp, ncid_sv
    integer :: varid

    call check_nc_status(nf90_open(trim(fileName), NF90_NOWRITE, ncid), _RC)
    ncid_sv = ncid
    if(present(group_name)) then
       call check_nc_status(nf90_inq_ncid(ncid, group_name, ncid_grp), _RC)
       ! overwrite
       ncid = ncid_grp
    end if
    call check_nc_status(nf90_inq_varid(ncid, varname, varid), _RC)
    call check_nc_status(nf90_get_att(ncid, varid, att_name, att_value), _RC)
    call check_nc_status(nf90_close(ncid_sv), _RC)

    _RETURN(_SUCCESS)

  end subroutine get_att_char_netcdf