real function CFIO_GetMissing ( fid, rc )
!
! !USES:
!
Implicit NONE
!
! !INPUT PARAMETERS:
integer fid ! file id
integer rc ! Error code
!
! !REVISION HISTORY:
!
! 1999.11.01 da Silva Initial code.
!
!EOP
!-------------------------------------------------------------------------
integer nDims, recdim, ngatts
integer varType, nvDims, vDims(MAXVDIMS), nvAtts
character(len=MAXCHR) vnameTemp
integer i
integer attType, attLen
integer allVars ! all variables - includes dimension vars
real(kind=REAL32) amiss_32
! Get basic information from the file
rc = NF90_INQUIRE (fid,nDims,allVars,ngatts,recdim)
if (err("Inqure: NF90_INQUIRE failed",rc,-48) .NE. 0) return
do i= 1, allVars
rc = NF90_INQUIRE_VARIABLE (fid,i,vnameTemp,varType,nvDims,vDims,nvAtts)
if (err("CFIO_GetMissing: variable inquire error",rc,-52) .NE. 0) return
if (nvDims .EQ. 1) then ! coord variable
cycle
else ! noon-coord variable
rc = NF90_GET_ATT(fid,i,'fmissing_value',amiss_32)
if (rc .NE. 0) then
rc = NF90_INQUIRE_ATTRIBUTE (fid, i, 'missing_value', attType, attLen)
if (rc.eq.0 .and. attType .EQ. NF90_FLOAT) then
rc = NF90_GET_ATT(fid,allVars,'missing_value',amiss_32)
if (err("CFIO_GetMissing: error getting missing value",rc,-53) &
.NE. 0) return
else
print *, &
'CFIO_GetMissing: Cannot find missing value, assuming 1E+15'
amiss_32 = 1.0E+15
end if
endif
exit ! just check first non-ccordinate variable
endif
end do
CFIO_GetMissing = amiss_32
rc = 0
end function CFIO_GetMissing