57 integer,
intent(in):: dimord
58 logical,
intent(in),
optional:: count_compact
59 logical,
intent(out),
optional:: err
60 integer:: sclass, scid, ld, sndims, stat, udimord, idimord, cause_i
65 character(STRING) :: endsub_msg
66 character(len = *),
parameter:: subname =
"GTVarOpen-By-Dimord" 67 character(len = *),
parameter:: version = &
69 &
'$Id: gtvaropenbydimord.f90,v 1.5 2009-07-04 04:58:06 morikawa Exp $' 71 call beginsub(subname,
'var.mapid=%d dimord=%d ', &
72 & i=(/source_var%mapid, dimord/), version=version)
79 call map_dup(var, source_var)
80 if (
present(err)) err = .false.
87 call map_lookup(source_var, ndims=sndims)
88 if (sndims <= 0 .or. dimord > sndims)
then 92 allocate(map_src(sndims))
93 call map_lookup(source_var, map=map_src)
95 if (present_and_true(count_compact))
then 100 call dbgmessage(
'count_compact=%y', l=(/cnt_compact/))
102 if (cnt_compact)
then 105 udimord = dimord_skip_compact(dimord, map=map_src)
107 if (udimord <= 0 .or. udimord >
size(map_src))
then 108 stat = gt_enomoredims
112 idimord = map_src(udimord)%dimno
113 if (idimord < 1)
then 114 call gt_open(var, map_src(udimord)%url, err=err)
121 call var_class(source_var, sclass, scid)
122 if (sclass == vtb_class_netcdf)
then 123 call open(gdnc, gd_nc_variable(scid), idimord, err)
124 call inquire(gdnc, dimlen=ld)
125 call map_create(var, vtb_class_netcdf, gdnc%id, 1, (/ld/), stat)
126 if (stat /= dc_noerr)
then 130 call map_lookup(var, map=map_result)
131 map_result(1)%offset = map_src(udimord)%offset
132 map_result(1)%step = map_src(udimord)%step
133 map_result(1)%allcount = map_src(udimord)%allcount
134 map_result(1)%start = map_src(udimord)%start
135 map_result(1)%count = map_src(udimord)%count
136 map_result(1)%stride = map_src(udimord)%stride
137 call map_set(var, map=map_result, stat=stat)
138 else if (sclass == vtb_class_memory)
then 146 endsub_msg = CPrintf(
'result_var=%d', i=(/var%mapid/))
148 call storeerror(stat, subname, cause_i=cause_i, err=err)
149 call endsub(subname,
'%c', c1=trim(endsub_msg))
subroutine map_dup(var, source_var)
logical function, public present_and_true(arg)
integer, parameter, public gt_efake
integer function dimord_skip_compact(dimord, map)
subroutine, public map_create(var, class, cid, ndims, allcount, stat)
subroutine map_set(var, map, stat)
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
subroutine, public dbgmessage(fmt, i, r, d, L, n, c1, c2, c3, ca)
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
subroutine gtvaropenbydimord(var, source_var, dimord, count_compact, err)
subroutine, public map_lookup(var, vid, map, ndims)
integer, parameter, public gt_enomoredims
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)
subroutine, public var_class(var, class, cid)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ