The routine genGridName
returns the name of a grid based on
certain parameters. This mimics the MAPL behavior.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | nX | |||
integer, | intent(in) | :: | nY | |||
character(len=255), | intent(out) | :: | gridName | |||
real(kind=sp), | intent(in), | optional | :: | xVec(:) | ||
real(kind=sp), | intent(in), | optional | :: | yVec(:) | ||
logical, | intent(out), | optional | :: | isCS | ||
logical, | intent(out), | optional | :: | isPC | ||
logical, | intent(out), | optional | :: | isDE | ||
integer, | optional | :: | RC |
Subroutine genGridName(nX, nY, gridName, xVec, yVec, & isCS, isPC, isDE, rc) ! ! !USES: ! ! Use Precision_Mod, Only: f4 ! ! !INPUT PARAMETERS: ! Integer, Intent(In) :: nX, nY Real(Kind=sp), Optional, Intent(In) :: xVec(:) Real(Kind=sp), Optional, Intent(In) :: yVec(:) Integer, Optional :: RC ! ! !OUTPUT PARAMETERS: ! Character(Len=255), Intent(Out) :: gridName Logical, Optional, Intent(Out) :: isCS Logical, Optional, Intent(Out) :: isDE Logical, Optional, Intent(Out) :: isPC ! !----------------------------------------------------------------------- ! ! !LOCAL VARIABLES: ! Character(Len=2) :: dateLine, pole Integer :: I Real(Kind=sp) :: dY Real(Kind=sp), Parameter :: eps=1.0e-4 Logical :: isCS_ Logical :: isDE_ Logical :: isPC_ _UNUSED_DUMMY(rc) !================================================================= ! genGridName starts here! !================================================================= ! Defaults isCS_ = .False. isDE_ = .False. isPC_ = .False. If (nY .ne. (6*nX)) Then isCS_ = .False. ! Rectangular (lat-lon) grid dateLine = 'UU' ! Undefined pole = 'UU' ! Undefined If (present(xVec) .and. present(yVec)) then !============================================================== ! There are two ways that a half-polar grid could be specified ! Either the grid center is specified as being at the pole, or ! it is specified accurately. !============================================================== dY = yVec(4) - yVec(3) if ((abs(yVec(1) + 90.0) < eps).or.& (abs(yVec(1) + 90.0 - 0.25*dY) < eps)) then isPC_ = .True. pole='PC' else if (abs(yVec(1) + 90.0 - 0.5*dY) < eps) then pole='PE' end if !============================================================== do I=0,1 if(abs(xVec(1) + 180.0*I) < eps) then dateline='DC' exit else if (abs(xVec(1) + 180.0*I - & 0.5*(xVec(2)-xVec(1))) < eps) then isDE_ = .True. dateline='DE' exit end if end do end if write(gridname,'(a,i4.4,a,a,i4.4)') dateline,nX,'x',pole,nY else ! cubed-sphere isCS_ = .True. dateline='CF' pole='6C' write(gridname,'(a,i4.4,a,a)') dateline,nX,'x',pole end if ! Assign outputs If (present(isCS)) isCS = isCS_ If (present(isDE)) isDE = isDE_ If (present(isPC)) isPC = isPC_ End Subroutine genGridName