ParseFileTypeArg Subroutine

subroutine ParseFileTypeArg(argName, fileTypeArg, fileType)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: argName
character(len=*), intent(in) :: fileTypeArg
type(ESMF_FileFormat_Flag), intent(out) :: fileType

Source Code

  subroutine ParseFileTypeArg(argName, fileTypeArg, fileType)
    ! Parse a given file type argument, returning the appropriate file type constant
    character(len=*), intent(in) :: argName             ! name of the argument, just used for error messages
    character(len=*), intent(in) :: fileTypeArg         ! value of the file type argument
    type(ESMF_FileFormat_Flag), intent(out) :: fileType ! determined file type constant

    select case (fileTypeArg)
    case ('SCRIP')
       fileType = ESMF_FILEFORMAT_SCRIP
    case ('ESMFMESH')
       fileType = ESMF_FILEFORMAT_ESMFMESH
    case ('UGRID')
       fileType = ESMF_FILEFORMAT_UGRID
    case ('CFGRID')
       fileType = ESMF_FILEFORMAT_CFGRID
    case ('GRIDSPEC')
       fileType = ESMF_FILEFORMAT_GRIDSPEC
    case ('MOSAIC')
       fileType = ESMF_FILEFORMAT_MOSAIC
    case ('TILE')
       fileType = ESMF_FILEFORMAT_TILE
    case default
       write(*,*)
       print *, "ERROR: Unknown ", trim(argName), ": must be one of:"
       print *, "SCRIP, ESMFMESH, UGRID, CFGRID, GRIDSPEC, MOSAIC or TILE."
       print *, "Use the --help argument to see an explanation of usage."
       call ESMF_Finalize(endflag=ESMF_END_ABORT)
    end select
  end subroutine ParseFileTypeArg