anvardelattr.f90

Path: anvardelattr.f90
Last Update: Wed Jul 20 18:22:22 JST 2005

Copyright (C) GFD Dennou Club, 2000. All rights reserved

Methods

Included Modules

an_types an_file an_vartable netcdf_f77 dc_url dc_error

Public Instance methods

Subroutine :
var :type(AN_VARIABLE), intent(in)
name :character(len = *), intent(in)
err :logical, intent(out), optional

[Source]

subroutine ANVarDelAttr(var, name, err)
    use an_types, only: AN_VARIABLE, an_variable_entry
    use an_file, only: ANFileDefineMode
    use an_vartable, only: vtable_lookup
    use netcdf_f77, only: NF_NOERR, NF_DEL_ATT, NF_ENOTINDEFINE, NF_GLOBAL
    use dc_url, only: GT_PLUS
    use dc_error
    implicit none
    type(AN_VARIABLE), intent(in):: var
    character(len = *), intent(in):: name
    logical, intent(out), optional:: err
    type(an_variable_entry):: ent
    integer:: stat
continue
    stat = vtable_lookup(var, ent)
    if (stat /= NF_NOERR) goto 999
    stat = nf_del_att(ent%fileid, ent%varid, name=name)
    if (stat == 0) goto 999
    if (stat /= NF_ENOTINDEFINE) goto 999
    stat = ANFileDefineMode(ent%fileid)
    if (stat /= NF_NOERR) goto 999
    if (name(1:1) == GT_PLUS) then
        stat = nf_del_att(ent%fileid, NF_GLOBAL, name=name(2:))
    else
        stat = nf_del_att(ent%fileid, ent%varid, name=name)
    endif

999 continue
    call StoreError(stat, 'ANVarPutAttrChar', err)
end subroutine

[Validate]