15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
32 use gtdata_generic,
only: inquire, get_slice,
gtvarslice
33 type(GT_VARIABLE), intent(inout):: var
34 type(GT_VARIABLE), intent(in), optional:: compatible
35 integer:: nd, i
36 integer, allocatable:: start(:), count(:), stride(:)
37 call inquire(var, alldims=nd)
38 if (nd <= 0) return
39 allocate(start(nd), count(nd), stride(nd))
40 if (present(compatible)) then
41 call get_slice(compatible, start, count, stride)
42 do, i = 1, nd
43 call gtvarslice(var, i, start(i), count(i), stride(i))
44 enddo
45 else
46 call get_slice(var, start, count, stride)
47 do, i = 1, nd
48 if (count(i) < 1) count(i) = 1
49 call gtvarslice(var, i, start(i), count(i), stride(i))
50 enddo
51 endif
52 deallocate(start, count, stride)
subroutine gtvarslice(var, dimord, start, count, stride)