Path: anvarattrcopy.f90
Last Update: Wed Jul 20 18:22:22 +0900 2005

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


Included Modules

an_types an_file an_vartable netcdf_f77 dc_url dc_error

Public Instance methods

Subroutine :
to :type(AN_VARIABLE), intent(in)
attrname :character(len = *), intent(in)
from :type(AN_VARIABLE), intent(in)
stat :integer, intent(out)


subroutine ANVarAttrCopy(to, attrname, from, stat)
    use an_types, only: AN_VARIABLE, an_variable_entry
    use an_file, only: ANFileDefineMode, inquire
    use an_vartable, only: vtable_lookup
    use netcdf_f77
    use dc_url, only: GT_PLUS
    use dc_error
    implicit none
    type(AN_VARIABLE), intent(in):: to
    character(len = *), intent(in):: attrname
    type(AN_VARIABLE), intent(in):: from
    integer, intent(out):: stat
    character(NF_MAX_NAME):: nc_aname
    integer:: id_var_from, id_var_to
    logical:: myerr
    type(an_variable_entry):: to_ent, from_ent
    stat = vtable_lookup(to, to_ent)
    if (stat /= NF_NOERR) goto 999
    stat = vtable_lookup(from, from_ent)
    if (stat /= NF_NOERR) goto 999
    stat = ANFileDefineMode(to_ent%fileid)
    if (stat /= NF_NOERR) goto 999
    call inquire(from, attrname, id_var_from, nc_aname)
    call inquire(to, attrname, id_var_to, nc_aname)
    stat = nf_copy_att(from_ent%fileid, id_var_from, nc_aname, to_ent%fileid, id_var_to)
999 continue
    call StoreError(stat, "ANVarAttrCopy", myerr)
end subroutine