The routine ReadInput
reads the input options file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out) | :: | resOut(2) | |||
character(len=255), | intent(out) | :: | fNameIn | |||
character(len=255), | intent(out) | :: | fNameOut | |||
logical, | intent(out) | :: | reverseLev | |||
logical, | intent(out) | :: | isCSOut | |||
logical, | intent(out) | :: | isPCOut | |||
logical, | intent(out) | :: | isDEOut | |||
integer, | optional | :: | RC |
Subroutine ReadInput(resOut,fNameIn,fNameOut,reverseLev,& isCSOut,isPCOut,isDEOut,RC) ! ! !USES: ! ! Use Precision_Mod, Only: f4 ! ! !INPUT PARAMETERS: ! ! !OUTPUT PARAMETERS: ! Integer, Intent(Out) :: resOut(2) Logical, Intent(Out) :: isCSOut Logical, Intent(Out) :: isPCOut Logical, Intent(Out) :: isDEOut Character(Len=255), Intent(Out) :: fNameIn Character(Len=255), Intent(Out) :: fNameOut Logical, Intent(Out) :: reverseLev Integer, Optional :: RC ! !----------------------------------------------------------------------- ! ! !LOCAL VARIABLES: ! Integer :: fIDGCHP, RC_, I Integer :: resTemp(2) Character(Len=255) :: currLine, strRead Logical :: Found, logRead !================================================================= ! ReadInput starts here! !================================================================= ! Default outputs fNameIn='' fNameOut='' resOut(:) = 0 isCSOut = .True. isPCOut = .True. isDEOut = .True. reverseLev=.False. ! First, get LUN Call GetLUN(fIDGCHP,RC=RC_) If (Present(RC)) RC = RC_ If (RC_.ne.0) Return Open(File='input.regrid',Unit=fIDGCHP,IOStat=RC_,& STATUS='OLD',FORM='FORMATTED') If (RC_.ne.0) Return ! Read in the file; skip lines until we hit one that doesn't start ! with the # symbol RC_ = 0 Found = .False. Do While (.not.Found) Read(fIDGCHP,'(a)',IOStat=RC_) currLine If (RC_.ne.0) Exit currLine = Trim(AdjustL(currLine)) I = Scan(currLine,'#') Found = (I.ne.1) End Do ! Start processing If (Found) Then ! Output resolution I = SCAN(currLine,':') Read(currLine((I+1):),*,IOStat=RC_) strRead ! Parse the string Call parseGridName(strRead, resTemp(1), resTemp(2),& isCS=isCSOut, isDE=isDEOut, isPC=isPCOut) ! Invalid resolution string? If ((resTemp(1)*resTemp(2)) == 0) Then resTemp(:) = 0 RC_ = -10 End If resOut = resTemp ! Input file name Read(fIDGCHP,'(a)',IOStat=RC_) currLine I = SCAN(currLine,':') Read(currLine((I+1):),*,IOStat=RC_) strRead fNameIn = Trim(AdjustL(strRead)) ! Output file name Read(fIDGCHP,'(a)',IOStat=RC_) currLine I = SCAN(currLine,':') Read(currLine((I+1):),*,IOStat=RC_) strRead fNameOut = Trim(AdjustL(strRead)) ! Reverse vertical grid? Read(fIDGCHP,'(a)',IOStat=RC_) currLine I = SCAN(currLine,':') Read(currLine((I+1):),*,IOStat=RC_) logRead reverseLev = logRead Else ! Report failure RC_ = -1 End If Close(Unit=fIDGCHP) If (Present(RC)) RC = RC_ End Subroutine ReadInput