subroutine test_smm_from_file(srcFile, dstFile, weightFile, checkMethod, rc)
character(len=*), intent(in) :: srcFile, dstFile, weightFile
integer, intent(out) :: rc
type(ESMF_RWGCheckMethod_Flag), intent(in) :: checkMethod
integer :: localrc
rc = ESMF_FAILURE
! Generate the netCDF weights file.
call ESMF_RegridWeightGen(srcFile, dstFile, weightFile=weightFile, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=FILENAME, rcToReturn=rc)) return
! Validate generated weights produce acceptable errors. This subroutine
! calls ESMF_ArraySMMStoreFromFile or ESMF_FieldSMMStoreFromFile.
call ESMF_RegridWeightGenCheck(weightFile, checkMethod=checkMethod, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=FILENAME, rcToReturn=rc)) return
rc = ESMF_SUCCESS
end subroutine test_smm_from_file