46 character(len = *),
intent(in) :: url
48 logical,
intent(in),
optional :: copyvalue
49 logical,
intent(in),
optional :: overwrite
50 logical,
intent(out),
optional :: err
53 integer :: i, nd, stat
55 character(STRING) :: vpart, upart, desturl
56 character(TOKEN) :: xtype
57 character(len = *),
parameter:: version = &
59 &
'$Id: gtvarcreatecopy.f90,v 1.1 2009-03-20 09:09:51 morikawa Exp $' 61 call beginsub(
'gtvarcreatecopy',
'url=%c copyfrom=%d', &
62 & c1=trim(url), i=(/copyfrom%mapid/), version=version)
69 call inquire(copyfrom, alldims=nd)
70 allocate(vdimsource(nd), vdimdest(nd), stat=stat)
71 if (stat /= 0)
goto 999
77 call open(vdimsource(i), copyfrom, dimord=i, &
78 & count_compact=.true., err=myerr)
88 call inquire(copyfrom, url=upart)
90 desturl = trim(desturl) //
gt_atmark // trim(vpart)
93 call inquire(copyfrom, xtype=xtype)
94 call create(var, trim(desturl), dims=vdimdest, xtype=xtype, &
95 & overwrite=overwrite, err=myerr)
97 call copy_attr(to=var, from=copyfrom, err=myerr)
99 if (
present(copyvalue))
then 105 call close(vdimsource(i))
106 call close(vdimdest(i))
109 deallocate(vdimsource, vdimdest, stat=stat)
113 else if (
present(err))
then 118 call endsub(
'gtvarcreatecopy',
'result=%d', i=(/var%mapid/))
133 character(len = *),
intent(in):: target
134 character(len = string):: url, file, dimname
135 character(len = token):: xtype
136 logical:: growable, myerr
139 call beginsub(
'gtvarcopydim',
'from=%d target=<%c>', &
140 & i=(/from%mapid/), c1=trim(
target))
142 call inquire(var=from, url=url)
143 if (trim(url) .onthesamefile. trim(
target))
then 144 call open(to, from, dimord=0)
145 call endsub(
'gtvarcopydim',
'dup-handle')
153 call endsub(
'gtvarcopydim',
'equivalent-exists')
158 call inquire(var=from, growable=growable, allcount=length)
159 if (growable) length = 0
160 call inquire(var=from, xtype=xtype, name=dimname)
163 call create(to, trim(url), length, xtype, err=myerr)
166 call create(to, trim(file), length, xtype)
170 call endsub(
'gtvarcopydim',
'created')
193 character(len = *),
intent(in):: file
194 character(len = string):: url, units1, units2, reason
195 logical:: end, growable1, growable2
197 character(len = *),
parameter:: subnam =
"lookupequivalent" 198 call beginsub(subnam,
'from=%d file=<%c>', &
199 & i=(/from%mapid/), c1=trim(file))
202 call inquire(from, allcount=len1, growable=growable1)
203 call get_attr(from,
'units', units1, default=
'')
210 call open(to, url, writable=.true., err=end)
215 call inquire(to, allcount=len2, growable=growable2)
218 if (.not. growable1 .or. .not. growable2)
then 221 if (len1 /= len2)
then 225 call get_attr(to,
'units', units2, default=
'')
227 if (units1 /= units2)
then 231 reason =
'length of from is ' // trim(
tochar(len1)) // &
232 &
'. units of from is ' //
"[" // &
233 & trim(units1) //
"]" // &
234 &
'. And file has same length and units.' 237 reason =
'from is UNLIMITED dimension, and file has it' 240 call endsub(subnam,
'found (%c)', c1=trim(reason))
243 call endsub(subnam,
'not found')
255 real,
allocatable:: rbuffer(:)
262 call slice(to, compatible=from)
264 allocate (rbuffer(siz))
275 call endsub(
'gtvarcopyvalue')
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
logical function lookupequivalent(to, from, file)
character, parameter, public gt_atmark
subroutine gtvarputreal(var, value, nvalue, err)
integer, parameter, public gt_enomem
subroutine, public storeerror(number, where, err, cause_c, cause_i)
subroutine gtvarcopydim(to, from, target)
subroutine gtvarcopyvalue(to, from)
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)
subroutine gtvargetreal(var, value, nvalue, err)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ