gdncvarinquireia.f90

Path: gtdata/gtdata_netcdf/gdncvarinquireia.f90
Last Update: Mon May 25 18:51:59 +0900 2009

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

Required files

Methods

Included Modules

gtdata_netcdf_types gtdata_netcdf_internal netcdf_f77

Public Instance methods

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

[Source]

subroutine GDNcVarInquireIA(var, dimlen)
    use gtdata_netcdf_types, only: GD_NC_VARIABLE, GD_NC_VARIABLE_ENTRY
!    use gtdata_netcdf_internal, only: GD_NC_VARIABLE_ENTRY
    use gtdata_netcdf_internal, only: vtable_lookup
    use netcdf_f77, only: nf_noerr, nf_inq_vardimid, nf_inq_dimlen
    type(GD_NC_VARIABLE), intent(in):: var
    integer, intent(out):: dimlen(:)
    type(GD_NC_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