subroutine ANVarInquireIA(var, dimlen)
use an_types, only: an_variable, an_variable_entry
! use an_vartable, only: an_variable_entry
use an_vartable, only: vtable_lookup
use netcdf_f77, only: nf_noerr, nf_inq_vardimid, nf_inq_dimlen
type(AN_VARIABLE), intent(in):: var
integer, intent(out):: dimlen(:)
type(an_variable_entry):: ent
integer:: stat, i
dimlen(:) = -1
stat = vtable_lookup(var, ent)
if (stat /= nf_noerr) return
if (ent%varid > 0) then
if (.not. associated(ent%dimids)) return
do, i = 1, min(size(dimlen), size(ent%dimids))
stat = nf_inq_dimlen(ent%fileid, ent%dimids(i), dimlen(i))
if (stat /= nf_noerr) exit
enddo
else
stat = nf_inq_dimlen(ent%fileid, ent%dimid, dimlen(1))
if (stat /= nf_noerr) dimlen(1) = -1
endif
end subroutine