gtvarcopyattr.f90

Path: src/gtvarcopyattr.f90
Last Update: Sun Aug 14 21:44:26 JST 2005

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

Methods

Included Modules

gtdata_types dc_string gtdata_generic gt_map an_generic dc_trace dc_error

Public Instance methods

to :type(GT_VARIABLE), intent(inout)
attrname :character(len = *), intent(in)
from :type(GT_VARIABLE), intent(in)
err :logical, intent(out), optional

[Source]

subroutine GTVarCopyAttr(to, attrname, from, err)

    implicit none
    type(GT_VARIABLE), intent(inout):: to
    character(len = *), intent(in):: attrname
    type(GT_VARIABLE), intent(in):: from
    logical, intent(out), optional:: err
    type(VSTRING):: svalue
    integer:: from_class, from_cid, to_class, to_cid, stat
continue
    if (present(err)) err = .false.
    call beginsub('gtvarcopyattr', 'mapid to=%d from=%d name=%c',  i=(/to%mapid, from%mapid/), c1=attrname)
    call var_class(from, from_class, from_cid)
    call var_class(to, to_class, to_cid)
    if (from_class == vtb_class_netcdf .and. to_class == vtb_class_netcdf) then
        call Copy_Attr(an_variable(to_cid), attrname,  an_variable(from_cid), stat)
    else
        ! とりあえず文字列で入出力しておく
        call Get_Attr(from, attrname, svalue, default="")
        call Put_Attr(to, attrname, svalue, err)
        stat = DC_NOERR
    endif
    call StoreError(stat, "GTVarCopyAttr", err)
    call endsub('gtvarcopyattr', 'stat = %d', i=(/stat/))
end subroutine

[Validate]