IdentifyDim Function

public function IdentifyDim(dimName, dimUnits)

IdentifyDim - Identify a cooridate variable

This function attempts to identify a coordiante variable from the name or units of the variable. It does so by attempting to match the units specified in the COARDS conventions or by checking the name against commonly used names.

RETURN VALUES: * 0 = X dimension (longitude) * 1 = Y dimension (latitude) * 2 = Z dimension (level) * 3 = Time * -1 = Unable to determine dimension

History

  • 1998.12.22 Lucchesi Initial coding.
  • 1999.11.02 da Silva Made LATS4D compatible,
  • 2001.01.02 da Silva Cimcurventing PGI bugs.

Arguments

Type IntentOptional Attributes Name
character(len=*) :: dimName

Name of the coordinate variable

character(len=*) :: dimUnits

Units of the coordinate variable

Return Value integer


Called by

proc~~identifydim~~CalledByGraph proc~identifydim IdentifyDim proc~cfio_diminquire CFIO_DimInquire proc~cfio_diminquire->proc~identifydim proc~cfio_sgetvar CFIO_SGetVar proc~cfio_sgetvar->proc~identifydim proc~getdatetimevec GetDateTimeVec proc~cfio_sgetvar->proc~getdatetimevec proc~esmf_cfioeosfilecreate ESMF_CFIOEosFileCreate proc~esmf_cfioeosfilecreate->proc~identifydim proc~esmf_cfiosdffileopen ESMF_CFIOSdfFileOpen proc~esmf_cfiosdffileopen->proc~identifydim proc~esmf_cfiosdffileopen->proc~cfio_diminquire proc~getbegdatetime GetBegDateTime proc~esmf_cfiosdffileopen->proc~getbegdatetime proc~getbegdatetime->proc~identifydim proc~getdatetimevec->proc~identifydim proc~cfio_getvar CFIO_GetVar proc~cfio_getvar->proc~getdatetimevec proc~esmf_cfiofileopen ESMF_CFIOFileOpen proc~esmf_cfiofileopen->proc~esmf_cfiosdffileopen none~find~31 CFIOCollection%find none~find~31->proc~esmf_cfiofileopen proc~mapl_cfioopenwrite MAPL_CFIOOpenWrite proc~mapl_cfioopenwrite->proc~esmf_cfiofileopen program~test test program~test->proc~esmf_cfiofileopen program~test~10 test program~test~10->proc~esmf_cfiofileopen program~test~12 test program~test~12->proc~esmf_cfiofileopen program~test~5 test program~test~5->proc~esmf_cfiofileopen proc~mapl_cfiocreatefromfile MAPL_CFIOCreateFromFile proc~mapl_cfiocreatefromfile->none~find~31 proc~mapl_cfioreadbundleread MAPL_CFIOReadBundleRead proc~mapl_cfioreadbundleread->none~find~31

Source Code

      integer function IdentifyDim (dimName, dimUnits)
!
! !USES:
!
      Implicit NONE
!
! !INPUT PARAMETERS:
!
      character(len=*) dimName  !! Name of the coordinate variable
      character(len=*) dimUnits !! Units of the coordinate variable
!
!-------------------------------------------------------------------------

        if (TRIM(dimUnits) .EQ. "degrees_north" ) then
            IdentifyDim = 1
            return
         end if

        if (TRIM(dimUnits) .EQ. "hPa" ) then
            IdentifyDim = 2
            return
        end if

        if ( trim(dimName) .eq. "time" ) then
            IdentifyDim = 3
            return
        end if


        if (TRIM(dimUnits) .EQ. "degrees_east" .OR.            &
            trim(dimName)  .eq. "longitude"    .OR.           &
            trim(dimName)  .eq. "lon"  ) then
            IdentifyDim = 0
        else if (TRIM(dimUnits) .EQ. "degrees_north" ) then
            IdentifyDim = 1
        else if (  trim(dimName)  .eq. "latitude"    .OR.      &
                  trim(dimName)  .eq. "lat"  ) then
            IdentifyDim = 1
        else if (INDEX(dimName,"lev") .NE. 0 .OR.              &
                INDEX(dimName,"Height") .NE. 0) then
          IdentifyDim = 2
        else if (TRIM(dimUnits) .EQ. "mb" .OR.                 &
                TRIM(dimUnits) .EQ. "millibar" .OR.           &
                TRIM(dimUnits) .EQ. "sigma_level" .OR.        &
                TRIM(dimUnits) .EQ. "hPa") then
          IdentifyDim = 2
        else if (trim(dimName) .eq. "TIME" .OR.            &
                trim(dimName) .eq. "TIME:EOSGRID" .OR.     &
                trim(dimName) .eq. "time" .OR.             &
                trim(dimName) .eq. "Time") then
          IdentifyDim = 3
        else
          IdentifyDim = -1
        endif

      if (TRIM(dimUnits) .EQ. "degrees_east" .OR. &
     INDEX(dimName,"XDim") .NE. 0 .OR. &
     INDEX(dimName,"lon") .NE. 0) then
        IdentifyDim = 0
      else if (TRIM(dimUnits) .EQ. "degrees_north" .OR. &
     INDEX(dimName,"YDim") .NE. 0 .OR. &
     INDEX(dimName,"lat") .NE. 0) then
          IdentifyDim = 1
      else if (INDEX(dimName,"lev") .NE. 0 .OR. &
     INDEX(dimName,"Height") .NE. 0) then
         IdentifyDim = 2
      else if (TRIM(dimUnits) .EQ. "mb" .OR. &
     TRIM(dimUnits) .EQ. "millibar" .OR. &
     TRIM(dimUnits) .EQ. "sigma_level" .OR. &
     TRIM(dimUnits) .EQ. "hPa") then
          IdentifyDim = 2
      else if (INDEX(dimName,"TIME") .NE. 0 .OR. &
     INDEX(dimName,"time") .NE. 0 .OR. &
     INDEX(dimName,"Time") .NE. 0) then
          IdentifyDim = 3
      else
          IdentifyDim = -1
      endif

        end function IdentifyDim