anvarinquire-ia.f90

Path: anvarinquire-ia.f90
Last Update: Wed Jul 20 18:22:22 JST 2005

Copyright (C) GFD Dennou Club, 2000. All rights reserved. 引数は ndims 個でなければならない。

Required files

Methods

Included Modules

an_types an_vartable netcdf_f77

Public Instance methods

Subroutine :
var :type(AN_VARIABLE), intent(in)
dimlen(:) :integer, intent(out)

[Source]

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

[Validate]