gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gdncvarattrcopy.f90
Go to the documentation of this file.
1!> @file gdncvarattrcopy.f90
2!>
3!> @author GFD Dennou Club
4!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Copy an attribute between netCDF variables
9!> @enden
10!>
11!> @ja
12!> @brief netCDF 変数間で属性をコピー
13!> @endja
14!>
15
16!>
17!> @en
18!> @brief Copy a named attribute from one variable to another
19!>
20!> Copies an attribute from the source variable to the destination variable.
21!> @enden
22!>
23!> @ja
24!> @brief 指定された属性を変数間でコピー
25!>
26!> ソース変数からデスティネーション変数へ属性をコピーします。
27!> @endja
28!>
29!> @param[in] to @en Destination variable handle @enden @ja コピー先変数ハンドル @endja
30!> @param[in] attrname @en Attribute name @enden @ja 属性名 @endja
31!> @param[in] from @en Source variable handle @enden @ja コピー元変数ハンドル @endja
32!> @param[out] stat @en Status code @enden @ja ステータスコード @endja
33!>
34subroutine gdncvarattrcopy(to, attrname, from, stat)
39 use netcdf, only: nf90_noerr, nf90_max_name, nf90_copy_att
40 use dc_error
41 implicit none
42 type(gd_nc_variable), intent(in):: to
43 character(len = *), intent(in):: attrname
44 type(gd_nc_variable), intent(in):: from
45 integer, intent(out):: stat
46 character(NF90_MAX_NAME):: nc_aname
47 integer:: id_var_from, id_var_to
48 logical:: myerr
49 type(gd_nc_variable_entry):: to_ent, from_ent
50 stat = vtable_lookup(to, to_ent)
51 if (stat /= nf90_noerr) goto 999
52 stat = vtable_lookup(from, from_ent)
53 if (stat /= nf90_noerr) goto 999
54 stat = gdncfiledefinemode(to_ent%fileid)
55 if (stat /= nf90_noerr) goto 999
56 call inquireplus(from, attrname, id_var_from, nc_aname)
57 call inquireplus(to, attrname, id_var_to, nc_aname)
58 stat = nf90_copy_att(from_ent%fileid, id_var_from, nc_aname, to_ent%fileid, id_var_to)
59999 continue
60 call storeerror(stat, "GDNcVarAttrCopy", myerr)
61 return
62end subroutine gdncvarattrcopy
subroutine gdncvarattrcopy(to, attrname, from, stat)
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer function, public vtable_lookup(var, entry)