subroutine GTVarInquire2(var, allcount)
    use gtdata_types, only: GT_VARIABLE
    use gtdata_generic, only: inquire, open, close
    use dc_trace, only: beginsub, endsub
    type(GT_VARIABLE), intent(in):: var
    ! alldims ŒÂ•K—v
    integer, intent(out):: allcount(:)
    integer:: i, n
    type(GT_VARIABLE):: v
    call beginsub('gtvarinquire2')
    call inquire(var, alldims=n)
    do, i = 1, n
        call Open(v, var, i, count_compact=.true.)
        call inquire(var, allcount=allcount(i))
        call Close(v)
    enddo
    call endsub('gtvarinquire2')
end subroutine
