Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+Add the optional argument old_name to get_param() #796

Open
wants to merge 1 commit into
base: dev/gfdl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 13 additions & 24 deletions src/diagnostics/MOM_obsolete_params.F90
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,15 @@ subroutine obsolete_logical(param_file, varname, warning_val, hint)
character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
! Local variables
logical :: test_logic, fatal_err
logical :: var_is_set ! True if this value was read by read_param.
character(len=128) :: hint_msg

test_logic = .false. ; call read_param(param_file, varname, test_logic)
test_logic = .false. ; call read_param(param_file, varname, test_logic, set=var_is_set)
fatal_err = .true.
if (present(warning_val)) fatal_err = (warning_val .neqv. .true.)
if (var_is_set .and. present(warning_val)) fatal_err = (warning_val .neqv. test_logic)
hint_msg = " " ; if (present(hint)) hint_msg = hint

if (test_logic) then
if (fatal_err) then
call MOM_ERROR(FATAL, "MOM_obsolete_params: "//trim(varname)// &
" is an obsolete run-time flag, and should not be used. "// &
trim(hint_msg))
else
call MOM_ERROR(WARNING, "MOM_obsolete_params: "//trim(varname)// &
" is an obsolete run-time flag. "//trim(hint_msg))
endif
endif

test_logic = .true. ; call read_param(param_file, varname, test_logic)
fatal_err = .true.
if (present(warning_val)) fatal_err = (warning_val .neqv. .false.)

if (.not.test_logic) then
if (var_is_set) then
if (fatal_err) then
call MOM_ERROR(FATAL, "MOM_obsolete_params: "//trim(varname)// &
" is an obsolete run-time flag, and should not be used. "// &
Expand All @@ -211,12 +197,13 @@ subroutine obsolete_char(param_file, varname, warning_val, hint)
character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
! Local variables
character(len=200) :: test_string, hint_msg
logical :: var_is_set ! True if this value was read by read_param.
logical :: only_warn

test_string = ''; call read_param(param_file, varname, test_string)
test_string = ''; call read_param(param_file, varname, test_string, set=var_is_set)
hint_msg = " " ; if (present(hint)) hint_msg = hint

if (len_trim(test_string) > 0) then
if (var_is_set) then
only_warn = .false.
if (present(warning_val)) then ! Check if test_string and warning_val are the same.
if (len_trim(warning_val) == len_trim(test_string)) then
Expand Down Expand Up @@ -246,15 +233,16 @@ subroutine obsolete_real(param_file, varname, warning_val, hint, only_warn)

! Local variables
real :: test_val, warn_val
logical :: var_is_set ! True if this value was read by read_param.
logical :: issue_warning
character(len=128) :: hint_msg

test_val = -9e35; call read_param(param_file, varname, test_val)
test_val = -9e35; call read_param(param_file, varname, test_val, set=var_is_set)
warn_val = -9e35; if (present(warning_val)) warn_val = warning_val
hint_msg = " " ; if (present(hint)) hint_msg = hint
issue_warning = .false. ; if (present(only_warn)) issue_warning = only_warn

if (test_val /= -9e35) then
if (var_is_set) then
if ((test_val == warn_val) .or. issue_warning) then
call MOM_ERROR(WARNING, "MOM_obsolete_params: "//trim(varname)// &
" is an obsolete run-time flag. "//trim(hint_msg))
Expand All @@ -273,14 +261,15 @@ subroutine obsolete_int(param_file, varname, warning_val, hint)
integer, optional, intent(in) :: warning_val !< An allowed value that causes a warning instead of an error.
character(len=*), optional, intent(in) :: hint !< A hint to the user about what to do.
! Local variables
logical :: var_is_set ! True if this value was read by read_param.
integer :: test_val, warn_val
character(len=128) :: hint_msg

test_val = -123456788; call read_param(param_file, varname, test_val)
test_val = -123456788; call read_param(param_file, varname, test_val, set=var_is_set)
warn_val = -123456788; if (present(warning_val)) warn_val = warning_val
hint_msg = " " ; if (present(hint)) hint_msg = hint

if (test_val /= -123456788) then
if (var_is_set) then
if (test_val == warn_val) then
call MOM_ERROR(WARNING, "MOM_obsolete_params: "//trim(varname)// &
" is an obsolete run-time flag. "//trim(hint_msg))
Expand Down
Loading
Loading