35 character(len=STRING):: url
89 integer,
intent(in):: dimno
90 integer,
intent(out):: dimlo, dimhi
93 call open(dimvar, var, dimno, count_compact=.true.)
99 subroutine map_dup(var, source_var)
106 integer:: vid, mid1, mid2, vid2, nd,
class, cid
119 mid1 = source_var%mapid
122 if (
associated(
maptab(mid1)%map))
then 123 nd =
size(
maptab(mid1)%map)
124 allocate(
maptab(mid2)%map(nd))
129 call dbgmessage(
'map_dup mapid(%d from %d) vid(%d from %d)', &
133 subroutine map_create(var, class, cid, ndims, allcount, stat)
141 integer,
intent(in)::
class, cid, ndims, allcount(:)
142 integer,
intent(out):: stat
148 if ( ndims < 0 )
then 156 maptab(var%mapid)%ndims = ndims
157 maptab(var%mapid)%map => map
161 map(i)%allcount = allcount(i)
162 map(i)%count = allcount(i)
167 map(i)%scalar = .false.
172 maptab(var%mapid)%ndims = 0
173 maptab(var%mapid)%map => map
181 map(1)%scalar = .true.
191 integer,
intent(out):: mapid
192 integer,
intent(in):: vid
196 if (.not.
allocated(
maptab))
then 213 allocate(tmp_maptab(n))
218 maptab(1:n) = tmp_maptab(1:n)
219 do, i = n + 1, (2 *
size(tmp_maptab))
223 deallocate(tmp_maptab)
236 logical,
intent(out),
optional:: err
239 if (.not.
allocated(
maptab))
goto 999
240 if (mapid <= 0 .or. mapid >
size(
maptab))
goto 999
243 if (
associated(
maptab(mapid)%map))
deallocate(
maptab(mapid)%map)
245 call dbgmessage(
'gtdata_internal_map table %d deleted', i=(/mapid/))
248 call storeerror(nf90_enotvar,
'maptabdelete', err)
255 integer,
intent(out),
optional:: vid
256 type(
gt_dimmap),
intent(out),
optional:: map(:)
257 integer,
intent(out),
optional:: ndims
258 if (.not.
allocated(
maptab))
goto 999
259 if (var%mapid <= 0 .or. var%mapid >
size(
maptab))
goto 999
261 if (
present(vid)) vid =
maptab(var%mapid)%vid
262 if (
present(map)) map(:) =
maptab(var%mapid)%map(1:
size(map))
263 if (
present(ndims)) ndims =
maptab(var%mapid)%ndims
267 if (
present(map))
then 271 if (
present(ndims)) ndims = 0
274 subroutine map_set(var, map, stat)
280 integer,
intent(out):: stat
281 if (.not.
allocated(
maptab))
goto 999
282 if (var%mapid <= 0 .or. var%mapid >
size(
maptab))
goto 999
284 if (
size(map) >
size(
maptab(var%mapid)%map))
then 288 maptab(var%mapid)%map(1:
size(map)) = map(:)
301 integer,
intent(out),
optional::
class, cid
313 integer,
intent(in):: ndims
314 integer,
intent(out):: stat
317 if (vid == vid_invalid)
then 321 if (.not.
associated(
maptab(var%mapid)%map))
then 324 maptab(var%mapid)%ndims = 0
329 if (ndims >
size(
maptab(var%mapid)%map))
then 333 maptab(var%mapid)%ndims = ndims
345 integer,
intent(in):: rank
346 integer,
intent(out):: stat
351 if (vid == vid_invalid)
then 355 if (ndims < rank)
then 359 tmpmap =>
maptab(var%mapid)%map
360 do, nd = ndims, 1, -1
361 if (count(tmpmap(1:ndims)%count > 1) <= rank)
exit 374 integer,
pointer:: specs(:, :)
375 integer,
intent(out),
optional:: ndims
377 integer:: vid, i, j, imap, internal_ndims
378 integer:: external_ndims
380 call map_lookup(var, vid, ndims=external_ndims)
381 internal_ndims = num_dimensions(vid)
382 if (
present(ndims)) ndims = internal_ndims
383 allocate(specs(max(1, internal_ndims), 4))
389 do, i = 1,
size(
maptab(var%mapid)%map)
390 it =>
maptab(var%mapid)%map(i)
392 if (j > 0 .and. j <= internal_ndims)
then 393 specs(j, 1) = it%start + it%offset
394 specs(j, 2) = it%count
395 if (i > external_ndims) specs(j, 2) = 1
396 specs(j, 3) = it%stride * it%step
399 imap = imap * it%count
406 integer,
intent(in):: ndims
411 allocate(map(1:ndims))
412 map(1:ndims)%dimno = -1
413 map(1:ndims)%url =
' ' 414 map(1:ndims)%allcount = 0
415 map(1:ndims)%offset = 0
416 map(1:ndims)%step = 1
417 map(1:ndims)%start = 1
418 map(1:ndims)%count = 0
419 map(1:ndims)%stride = 1
420 map(1:ndims)%scalar = .false.
428 type(
gt_dimmap),
pointer:: tmpmap(:), varmap
433 tmpmap(i)%allcount = map(i)%allcount
434 tmpmap(i)%count = map(i)%count
435 if (map(i)%dimno > 0)
then 436 varmap =>
maptab(var%mapid)%map(map(i)%dimno)
437 tmpmap(i)%url = varmap%url
438 tmpmap(i)%dimno = varmap%dimno
439 tmpmap(i)%offset = varmap%offset + map(i)%offset
440 tmpmap(i)%step = varmap%step * map(i)%step
442 tmpmap(i)%url = map(i)%url
444 tmpmap(i)%offset = map(i)%offset
445 tmpmap(i)%step = map(i)%step
456 integer,
intent(in):: ndims
460 if (
associated(
maptab(var%mapid)%map))
then 461 tmpmap =>
maptab(var%mapid)%map
463 n = min(
size(tmpmap), ndims)
464 newmap(1:n) = tmpmap(1:n)
466 maptab(var%mapid)%map => newmap
467 newmap(n+1:ndims)%dimno = -1
468 newmap(n+1:ndims)%url =
' ' 469 newmap(n+1:ndims)%allcount = 0
470 newmap(n+1:ndims)%offset = 0
471 newmap(n+1:ndims)%step = 1
472 newmap(n+1:ndims)%start = 1
473 newmap(n+1:ndims)%count = 0
474 newmap(n+1:ndims)%stride = 1
490 call debug( dbg_mode )
491 if (.not. dbg_mode)
return 493 if (imap < 1 .or. imap >
size(
maptab))
then 494 call dbgmessage(
'[gt_variable %d: invalid id]', i=(/imap/))
497 if (
associated(
maptab(imap)%map))
then 498 call dbgmessage(
'[gt_variable %d: ndims=%d, map.size=%d]', &
499 & i=(/imap,
maptab(imap)%ndims,
size(
maptab(imap)%map)/))
500 do, idim = 1,
size(
maptab(imap)%map)
501 call dbgmessage(
'[dim%d dimno=%d ofs=%d step=%d' &
502 &//
' all=%d start=%d count=%d stride=%d url=%c]', &
503 & c1=trim(
maptab(imap)%map(idim)%url), &
504 & i=(/idim,
maptab(imap)%map(idim)%dimno, &
505 &
maptab(imap)%map(idim)%offset, &
506 &
maptab(imap)%map(idim)%step, &
507 &
maptab(imap)%map(idim)%allcount, &
508 &
maptab(imap)%map(idim)%start, &
509 &
maptab(imap)%map(idim)%count, &
510 &
maptab(imap)%map(idim)%stride/))
513 call dbgmessage(
'[gt_variable %d: ndims=%d, map=null]', &
514 & i=(/imap,
maptab(imap)%ndims/))
523 integer,
intent(in):: dimord
528 do, id = 1,
size(map)
529 if (map(id)%count < 2) cycle
531 if (nd < dimord) cycle
533 call dbgmessage(
'compact dim skip: %d <= %d', i=(/result, dimord/))
subroutine map_apply(var, map)
subroutine, public map_to_internal_specs(var, specs, ndims)
subroutine gtvar_dump(var)
subroutine dimrange_by_dimno(var, dimno, dimlo, dimhi)
subroutine, public vartable_dump(vid)
integer, parameter, public vtb_class_netcdf
integer, parameter, public vid_invalid
integer, parameter, private maptab_init_size
subroutine map_dup(var, source_var)
type(map_table_entry), dimension(:), allocatable, target, save, private maptab
subroutine, public maptabdelete(var, err)
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)
subroutine map_set_ndims(var, ndims, stat)
integer, parameter, public dc_noerr
integer function, public ndims(vid)
subroutine map_set_rank(var, rank, stat)
subroutine, public dbgmessage(fmt, i, r, d, L, n, c1, c2, c3, ca)
integer, parameter, public vtb_class_unused
subroutine, public vartablelookup(vid, class, cid)
subroutine, public maptabadd(mapid, vid)
subroutine, public map_lookup(var, vid, map, ndims)
subroutine, public vartableadd(vid, class, cid)
integer, parameter, public gt_enomoredims
integer, parameter, public vtb_class_memory
subroutine map_allocate(map, ndims)
subroutine, public var_class(var, class, cid)
subroutine map_resize(var, ndims)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ