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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | dimName |
Name of the coordinate variable |
|||
character(len=*) | :: | dimUnits |
Units of the coordinate variable |
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