readTileFileNC Subroutine

public subroutine readTileFileNC(TFDir, gridIn, gridOut, RC)

The routine readTileFileNC reads a Tempest NetCDF tile file and stores the relevant data in module variables for later use.

History

  • 09 Jan 2016 - S. D. Eastham - Initial version

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: TFDir
character(len=*), intent(in) :: gridIn
character(len=*), intent(in) :: gridOut
integer, optional :: RC

Calls

proc~~readtilefilenc~~CallsGraph proc~readtilefilenc readTileFileNC proc~readtilefilenc_file readTileFileNC_file proc~readtilefilenc->proc~readtilefilenc_file nf90_close nf90_close proc~readtilefilenc_file->nf90_close nf90_get_var nf90_get_var proc~readtilefilenc_file->nf90_get_var nf90_inq_dimid nf90_inq_dimid proc~readtilefilenc_file->nf90_inq_dimid nf90_inq_varid nf90_inq_varid proc~readtilefilenc_file->nf90_inq_varid nf90_inquire_dimension nf90_inquire_dimension proc~readtilefilenc_file->nf90_inquire_dimension nf90_open nf90_open proc~readtilefilenc_file->nf90_open proc~assert Assert proc~readtilefilenc_file->proc~assert proc~assert->nf90_close proc~cleanup Cleanup proc~assert->proc~cleanup proc~cleanup->nf90_close

Source Code

      subroutine readTileFileNC(TFDir,gridIn,gridOut,RC)
!
! !USES:
!
!      Use Precision_Mod, Only: f4

!
! !INPUT PARAMETERS:
!
      Character(Len=*), Intent(In)         :: TFDir
      Character(Len=*), Intent(In)         :: gridIn
      Character(Len=*), Intent(In)         :: gridOut
      Integer, Optional                    :: RC
!
! !OUTPUT PARAMETERS:
!
      !Real(kind=sp), Intent(Out) :: TestOut
!
!-----------------------------------------------------------------------
!
! !LOCAL VARIABLES:
!
      Character(Len=255)        :: fName
      Logical                   :: Found
      Integer                   :: status

      !=================================================================
      ! readTileFileNC starts here!
      !=================================================================

      ! Assemble the full tile file name
      Write(fName,'(a,a,a,a)') Trim(gridIn),'_',Trim(gridOut),'.nc'
      fName = Trim(TFDir) // '/' // Trim(fName)

      Inquire(File=fName,Exist=Found)
      If (.not.Found) Then
         ! Try the reverse name
         Write(fName,'(a,a,a,a)') Trim(gridOut),'_',Trim(gridIn),'.nc'
         fName = Trim(TFDir) // '/' // Trim(fName)

         Inquire(File=fName,Exist=Found)
         If (.not.Found) Then
            Write(6,'(a,a)') ' --- Could not find NetCDF tile file ',Trim(fName)
            RC = -1
            Return
         End If
      End If


      call readTileFileNC_file(fName, rc=status)
      if (present(rc)) rc = status

      end subroutine readTileFileNC