From 84e0303cb25e2487119987ccbf4345c2e6bcf4de Mon Sep 17 00:00:00 2001 From: Eric Stofferahn <7784797+GFDL-Eric@users.noreply.github.com> Date: Wed, 9 Mar 2022 16:50:53 -0500 Subject: [PATCH 1/6] Enabling the processing of an empty or non-existent data_table or data_table.yaml from within data_override, so that any routine can call data_override_init without worry. --- data_override/data_override.F90 | 71 ++++++++++++++++++++------------- parser/yaml_parser.F90 | 7 ++++ 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/data_override/data_override.F90 b/data_override/data_override.F90 index 8a00be7b62..1317ee4734 100644 --- a/data_override/data_override.F90 +++ b/data_override/data_override.F90 @@ -261,6 +261,10 @@ subroutine data_override_init(Atm_domain_in, Ocean_domain_in, Ice_domain_in, Lan module_is_initialized = .TRUE. if ( .NOT. (atm_on .or. ocn_on .or. lnd_on .or. ice_on .or. lndUG_on)) return + if (table_size .eq. 0) then + call mpp_error(NOTE, "data_table is empty, not doing any data_overrides") + return + endif call fms2_io_init ! Test if grid_file is already opened @@ -367,7 +371,14 @@ subroutine read_table(data_table) ! Read coupler_table open(newunit=iunit, file='data_table', action='READ', iostat=io_status) - if(io_status/=0) call mpp_error(FATAL, 'data_override_mod: Error in opening file data_table') + if(io_status/=0) then + if(io_status==29) then + call mpp_error(NOTE, 'data_override_mod: data_table file does not exist, if this is not the intent, please add a data_table.') + else + call mpp_error(FATAL, 'data_override_mod: Error in opening file data_table.') + endif + endif + ntable = 0 ntable_lima = 0 @@ -495,35 +506,39 @@ subroutine read_table_yaml(data_table) integer :: file_id file_id = open_and_parse_file("data_table.yaml") - nentries = get_num_blocks(file_id, "data_table") - allocate(data_table(nentries)) - allocate(entry_id(nentries)) - call get_block_ids(file_id, "data_table", entry_id) - - do i = 1, nentries - call get_value_from_key(file_id, entry_id(i), "gridname", data_table(i)%gridname) - call get_value_from_key(file_id, entry_id(i), "fieldname_code", data_table(i)%fieldname_code) - call get_value_from_key(file_id, entry_id(i), "fieldname_file", data_table(i)%fieldname_file) - call get_value_from_key(file_id, entry_id(i), "file_name", data_table(i)%file_name) - call get_value_from_key(file_id, entry_id(i), "interpol_method", data_table(i)%interpol_method) - call get_value_from_key(file_id, entry_id(i), "factor", data_table(i)%factor) - call get_value_from_key(file_id, entry_id(i), "region_type", buffer, is_optional=.true.) - - if(trim(buffer) == "inside_region" ) then - data_table(i)%region_type = INSIDE_REGION - else if( trim(buffer) == "outside_region" ) then - data_table(i)%region_type = OUTSIDE_REGION - else - data_table(i)%region_type = NO_REGION - endif - - call get_value_from_key(file_id, entry_id(i), "lon_start", data_table(i)%lon_start, is_optional=.true.) - call get_value_from_key(file_id, entry_id(i), "lon_end", data_table(i)%lon_end, is_optional=.true.) - call get_value_from_key(file_id, entry_id(i), "lat_start", data_table(i)%lat_start, is_optional=.true.) - call get_value_from_key(file_id, entry_id(i), "lat_end", data_table(i)%lat_end, is_optional=.true.) + if (file_id==999) then + nentries = 0 + else + nentries = get_num_blocks(file_id, "data_table") + allocate(data_table(nentries)) + allocate(entry_id(nentries)) + call get_block_ids(file_id, "data_table", entry_id) + + do i = 1, nentries + call get_value_from_key(file_id, entry_id(i), "gridname", data_table(i)%gridname) + call get_value_from_key(file_id, entry_id(i), "fieldname_code", data_table(i)%fieldname_code) + call get_value_from_key(file_id, entry_id(i), "fieldname_file", data_table(i)%fieldname_file) + call get_value_from_key(file_id, entry_id(i), "file_name", data_table(i)%file_name) + call get_value_from_key(file_id, entry_id(i), "interpol_method", data_table(i)%interpol_method) + call get_value_from_key(file_id, entry_id(i), "factor", data_table(i)%factor) + call get_value_from_key(file_id, entry_id(i), "region_type", buffer, is_optional=.true.) + + if(trim(buffer) == "inside_region" ) then + data_table(i)%region_type = INSIDE_REGION + else if( trim(buffer) == "outside_region" ) then + data_table(i)%region_type = OUTSIDE_REGION + else + data_table(i)%region_type = NO_REGION + endif + + call get_value_from_key(file_id, entry_id(i), "lon_start", data_table(i)%lon_start, is_optional=.true.) + call get_value_from_key(file_id, entry_id(i), "lon_end", data_table(i)%lon_end, is_optional=.true.) + call get_value_from_key(file_id, entry_id(i), "lat_start", data_table(i)%lat_start, is_optional=.true.) + call get_value_from_key(file_id, entry_id(i), "lat_end", data_table(i)%lat_end, is_optional=.true.) - end do + end do + end if table_size = nentries !< Because one variable is not enough end subroutine read_table_yaml #endif diff --git a/parser/yaml_parser.F90 b/parser/yaml_parser.F90 index 1fd19b21ee..0e989a8ae4 100644 --- a/parser/yaml_parser.F90 +++ b/parser/yaml_parser.F90 @@ -207,9 +207,16 @@ function open_and_parse_file(filename) & character(len=*), intent(in) :: filename !< Filename of the yaml file logical :: sucess !< Flag indicating if the read was sucessful + logical :: yaml_exists !< Flag indicating whether the yaml exists integer :: file_id + inquire(file=trim(filename), EXIST=yaml_exists) + if (.not. yaml_exists) then + file_id = 999 + call mpp_error(NOTE, "The yaml file:"//trim(filename)//" does not exist, hopefully this is your intent!") + return + end if sucess = open_and_parse_file_wrap(trim(filename)//c_null_char, file_id) if (.not. sucess) call mpp_error(FATAL, "Error opening the yaml file:"//trim(filename)//". Check the file!") From be5b6d443c6eb2617fc8bb10aaa9c9578adbf925 Mon Sep 17 00:00:00 2001 From: Eric Stofferahn <7784797+GFDL-Eric@users.noreply.github.com> Date: Wed, 9 Mar 2022 16:55:21 -0500 Subject: [PATCH 2/6] Fixed line that was over 120 characters. --- data_override/data_override.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_override/data_override.F90 b/data_override/data_override.F90 index 1317ee4734..b89418ec88 100644 --- a/data_override/data_override.F90 +++ b/data_override/data_override.F90 @@ -373,7 +373,7 @@ subroutine read_table(data_table) open(newunit=iunit, file='data_table', action='READ', iostat=io_status) if(io_status/=0) then if(io_status==29) then - call mpp_error(NOTE, 'data_override_mod: data_table file does not exist, if this is not the intent, please add a data_table.') + call mpp_error(NOTE, 'data_override_mod: File data_table does not exist.') else call mpp_error(FATAL, 'data_override_mod: Error in opening file data_table.') endif From f76ca56e12fe570072fa1480c547b0e70782e5e9 Mon Sep 17 00:00:00 2001 From: Eric Stofferahn <7784797+GFDL-Eric@users.noreply.github.com> Date: Wed, 9 Mar 2022 17:15:52 -0500 Subject: [PATCH 3/6] Enabling the processing of an empty or non-existent data_table or data_table.yaml from within data_override, so that any routine can call data_override_init without worry... with no lines over 120 and NOTE import in data_override. --- data_override/data_override.F90 | 2 +- tap-driver.sh | 104 ++++++++++++-------------------- 2 files changed, 40 insertions(+), 66 deletions(-) diff --git a/data_override/data_override.F90 b/data_override/data_override.F90 index b89418ec88..55b5121aea 100644 --- a/data_override/data_override.F90 +++ b/data_override/data_override.F90 @@ -42,7 +42,7 @@ module data_override_mod use yaml_parser_mod use constants_mod, only: PI -use mpp_mod, only : mpp_error, FATAL, WARNING, stdout, stdlog, mpp_max +use mpp_mod, only : mpp_error, FATAL, WARNING, NOTE, stdout, stdlog, mpp_max use mpp_mod, only : input_nml_file use horiz_interp_mod, only : horiz_interp_init, horiz_interp_new, horiz_interp_type, & assignment(=) diff --git a/tap-driver.sh b/tap-driver.sh index 7b76565002..19aa531dee 100755 --- a/tap-driver.sh +++ b/tap-driver.sh @@ -1,30 +1,29 @@ -#!/bin/sh - -#*********************************************************************** -# GNU Lesser General Public License -# -# This file is part of the GFDL Flexible Modeling System (FMS). +#! /bin/sh +# Copyright (C) 2011-2013 Free Software Foundation, Inc. # -# FMS is free software: you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. # -# FMS is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU Lesser General Public -# License along with FMS. If not, see . -#*********************************************************************** +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. -# Ryan Mulhall 2/2021 -# Modified from original to add verbose output -# Test script output enabled by setting SH_LOG_DRIVER_FLAGS='-v' or '--verbose' -# also can be enabled with TEST_VERBOSE=true +# This file is maintained in Automake, please report +# bugs to or send patches to +# . -scriptversion=2013-12-23.17; # UTC +scriptversion=2011-12-27.17; # UTC # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. @@ -53,9 +52,8 @@ Usage: [--expect-failure={yes|no}] [--color-tests={yes|no}] [--enable-hard-errors={yes|no}] [--ignore-exit] [--diagnostic-string=STRING] [--merge|--no-merge] - [--verbose | -v] [--comments|--no-comments] - [--] TEST-COMMAND -The '--test-name', '-log-file' and '--trs-file' options are mandatory. + [--comments|--no-comments] [--] TEST-COMMAND +The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory. END } @@ -70,13 +68,6 @@ merge=0 ignore_exit=0 comments=0 diag_string='#' -# Prints test output if TEST_VERBOSE is set -if test -z ${TEST_VERBOSE+x} ; then - verbose=false -else - verbose=true -fi - while test $# -gt 0; do case $1 in --help) print_usage; exit $?;; @@ -93,7 +84,6 @@ while test $# -gt 0; do --comments) comments=1;; --no-comments) comments=0;; --diagnostic-string) diag_string=$2; shift;; - --verbose | -v) verbose="true";; --) shift; break;; -*) usage_error "invalid option: '$1'";; esac @@ -125,11 +115,6 @@ else init_colors='' fi -# use fd 5 to output tests' run scripts -[[ "$verbose" = "true" ]] && exec 5>&1 || exec 5>/dev/null -# use fd 6 to output individual return statuses -exec 6>&1 - # :; is there to work around a bug in bash 3.2 (and earlier) which # does not always set '$?' properly on redirection failure. # See the Autoconf manual for more details. @@ -147,13 +132,13 @@ exec 6>&1 # last `echo $?' statement), and would thus die reporting an internal # error. # For more information, see the Autoconf manual and the threads: - # + # # trap : 1 3 2 13 15 if test $merge -gt 0; then - exec 2>&6 + exec 2>&1 else - exec 2>&5 + exec 2>&3 fi "$@" echo $? @@ -167,11 +152,9 @@ exec 6>&1 -v ignore_exit="$ignore_exit" \ -v comments="$comments" \ -v diag_string="$diag_string" \ - -v verbose="$verbose" \ - -v skippedTests="" \ ' -# TODO: the usages of "cat >&3" below could be optimized when using -# GNU awk, and/on on systems that supports /dev/fd/. +# FIXME: the usages of "cat >&3" below could be optimized when using +# FIXME: GNU awk, and/on on systems that supports /dev/fd/. # Implementation note: in what follows, `result_obj` will be an # associative array that (partly) simulates a TAP result object @@ -220,13 +203,13 @@ function must_recheck() # be copied into the "global" test-suite.log. function copy_in_global_log() { - #for (k in test_results_seen) - # if (k != "PASS") - # return 1 - #return verbose == "true" ? 1 : 0; - return 1 + for (k in test_results_seen) + if (k != "PASS") + return 1 + return 0 } +# FIXME: this can certainly be improved ... function get_global_test_result() { if ("ERROR" in test_results_seen) @@ -290,10 +273,10 @@ function report(result, details) if (length(details)) msg = msg " " details # Output on console might be colorized. - print decorate_result(result) msg | "cat >&6" + print decorate_result(result) msg # Log the result in the log file too, to help debugging (this is # especially true when said result is a TAP error or "Bail out!"). - print result msg | "cat"; + print result msg | "cat >&3"; } function testsuite_error(error_message) @@ -325,8 +308,6 @@ function handle_tap_result() details = details " # " result_obj["directive"]; if (length(result_obj["explanation"])) details = details " " result_obj["explanation"] - if (result_obj["directive"] == "SKIP") - skippedTests= (skippedTests=="") ? result_obj["number"] : skippedTests "," result_obj["number"] } report(stringify_result_obj(result_obj), details) @@ -562,7 +543,7 @@ while (1) $0 = curline } # Copy any input line verbatim into the log file. - print | "cat" + print | "cat >&3" # Parsing of TAP input should stop after a "Bail out!" directive. if (bailed_out) continue @@ -648,11 +629,6 @@ if (!bailed_out) } } -if (skippedTests != "") { - print color_map["blu"] "Skipped the following test numbers in " test_script_name ": " | "cat >&6" - print color_map["blu"] skippedTests | "cat >&6" - print color_map["std"] | "cat >&6"# reset text color -} write_test_results() exit 0 @@ -661,18 +637,16 @@ exit 0 ' # TODO: document that we consume the file descriptor 3 :-( -#} 3>"$log_file" -} | tee "$log_file" >&5 - +} 3>"$log_file" test $? -eq 0 || fatal "I/O or internal error" # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" +# time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: From 771d612d4e88d6e837762a7ec68c4bcc23a109e6 Mon Sep 17 00:00:00 2001 From: Eric Stofferahn <7784797+GFDL-Eric@users.noreply.github.com> Date: Wed, 9 Mar 2022 17:56:15 -0500 Subject: [PATCH 4/6] Edited parser test since parser no longer expects to fail upon missing file --- test_fms/parser/test_yaml_parser.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test_fms/parser/test_yaml_parser.sh b/test_fms/parser/test_yaml_parser.sh index c9e1a5abc1..5406b01474 100755 --- a/test_fms/parser/test_yaml_parser.sh +++ b/test_fms/parser/test_yaml_parser.sh @@ -26,7 +26,7 @@ . ../test-lib.sh if [ ! -z $parser_skip ]; then - SKIP_TESTS='test_yaml_parser.[1-22]' + SKIP_TESTS='test_yaml_parser.[1-21]' fi touch input.nml @@ -95,11 +95,6 @@ test_expect_success "parser_demo2" ' mpirun -n 1 ./parser_demo2 ' -printf "&check_crashes_nml \n missing_file = .true. \n/" | cat > input.nml -test_expect_failure "missing file" ' - mpirun -n 1 ./check_crashes -' - printf "&check_crashes_nml \n bad_conversion = .true. \n/" | cat > input.nml test_expect_failure "bad conversion" ' mpirun -n 1 ./check_crashes From 04d57de3e65c5b7ef71089be2846a0010f74799c Mon Sep 17 00:00:00 2001 From: Eric Stofferahn <7784797+GFDL-Eric@users.noreply.github.com> Date: Thu, 24 Mar 2022 10:11:26 -0400 Subject: [PATCH 5/6] Rolled back tap-driver.sh changes --- tap-driver.sh | 104 +++++++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/tap-driver.sh b/tap-driver.sh index 19aa531dee..7b76565002 100755 --- a/tap-driver.sh +++ b/tap-driver.sh @@ -1,29 +1,30 @@ -#! /bin/sh -# Copyright (C) 2011-2013 Free Software Foundation, Inc. +#!/bin/sh + +#*********************************************************************** +# GNU Lesser General Public License # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# This file is part of the GFDL Flexible Modeling System (FMS). # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# FMS is free software: you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# FMS is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with FMS. If not, see . +#*********************************************************************** -# This file is maintained in Automake, please report -# bugs to or send patches to -# . +# Ryan Mulhall 2/2021 +# Modified from original to add verbose output +# Test script output enabled by setting SH_LOG_DRIVER_FLAGS='-v' or '--verbose' +# also can be enabled with TEST_VERBOSE=true -scriptversion=2011-12-27.17; # UTC +scriptversion=2013-12-23.17; # UTC # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. @@ -52,8 +53,9 @@ Usage: [--expect-failure={yes|no}] [--color-tests={yes|no}] [--enable-hard-errors={yes|no}] [--ignore-exit] [--diagnostic-string=STRING] [--merge|--no-merge] - [--comments|--no-comments] [--] TEST-COMMAND -The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory. + [--verbose | -v] [--comments|--no-comments] + [--] TEST-COMMAND +The '--test-name', '-log-file' and '--trs-file' options are mandatory. END } @@ -68,6 +70,13 @@ merge=0 ignore_exit=0 comments=0 diag_string='#' +# Prints test output if TEST_VERBOSE is set +if test -z ${TEST_VERBOSE+x} ; then + verbose=false +else + verbose=true +fi + while test $# -gt 0; do case $1 in --help) print_usage; exit $?;; @@ -84,6 +93,7 @@ while test $# -gt 0; do --comments) comments=1;; --no-comments) comments=0;; --diagnostic-string) diag_string=$2; shift;; + --verbose | -v) verbose="true";; --) shift; break;; -*) usage_error "invalid option: '$1'";; esac @@ -115,6 +125,11 @@ else init_colors='' fi +# use fd 5 to output tests' run scripts +[[ "$verbose" = "true" ]] && exec 5>&1 || exec 5>/dev/null +# use fd 6 to output individual return statuses +exec 6>&1 + # :; is there to work around a bug in bash 3.2 (and earlier) which # does not always set '$?' properly on redirection failure. # See the Autoconf manual for more details. @@ -132,13 +147,13 @@ fi # last `echo $?' statement), and would thus die reporting an internal # error. # For more information, see the Autoconf manual and the threads: - # + # # trap : 1 3 2 13 15 if test $merge -gt 0; then - exec 2>&1 + exec 2>&6 else - exec 2>&3 + exec 2>&5 fi "$@" echo $? @@ -152,9 +167,11 @@ fi -v ignore_exit="$ignore_exit" \ -v comments="$comments" \ -v diag_string="$diag_string" \ + -v verbose="$verbose" \ + -v skippedTests="" \ ' -# FIXME: the usages of "cat >&3" below could be optimized when using -# FIXME: GNU awk, and/on on systems that supports /dev/fd/. +# TODO: the usages of "cat >&3" below could be optimized when using +# GNU awk, and/on on systems that supports /dev/fd/. # Implementation note: in what follows, `result_obj` will be an # associative array that (partly) simulates a TAP result object @@ -203,13 +220,13 @@ function must_recheck() # be copied into the "global" test-suite.log. function copy_in_global_log() { - for (k in test_results_seen) - if (k != "PASS") - return 1 - return 0 + #for (k in test_results_seen) + # if (k != "PASS") + # return 1 + #return verbose == "true" ? 1 : 0; + return 1 } -# FIXME: this can certainly be improved ... function get_global_test_result() { if ("ERROR" in test_results_seen) @@ -273,10 +290,10 @@ function report(result, details) if (length(details)) msg = msg " " details # Output on console might be colorized. - print decorate_result(result) msg + print decorate_result(result) msg | "cat >&6" # Log the result in the log file too, to help debugging (this is # especially true when said result is a TAP error or "Bail out!"). - print result msg | "cat >&3"; + print result msg | "cat"; } function testsuite_error(error_message) @@ -308,6 +325,8 @@ function handle_tap_result() details = details " # " result_obj["directive"]; if (length(result_obj["explanation"])) details = details " " result_obj["explanation"] + if (result_obj["directive"] == "SKIP") + skippedTests= (skippedTests=="") ? result_obj["number"] : skippedTests "," result_obj["number"] } report(stringify_result_obj(result_obj), details) @@ -543,7 +562,7 @@ while (1) $0 = curline } # Copy any input line verbatim into the log file. - print | "cat >&3" + print | "cat" # Parsing of TAP input should stop after a "Bail out!" directive. if (bailed_out) continue @@ -629,6 +648,11 @@ if (!bailed_out) } } +if (skippedTests != "") { + print color_map["blu"] "Skipped the following test numbers in " test_script_name ": " | "cat >&6" + print color_map["blu"] skippedTests | "cat >&6" + print color_map["std"] | "cat >&6"# reset text color +} write_test_results() exit 0 @@ -637,16 +661,18 @@ exit 0 ' # TODO: document that we consume the file descriptor 3 :-( -} 3>"$log_file" +#} 3>"$log_file" +} | tee "$log_file" >&5 + test $? -eq 0 || fatal "I/O or internal error" # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: From 275d73eb93781f1d9dc73445df6668cc4abe54e7 Mon Sep 17 00:00:00 2001 From: Eric Stofferahn <7784797+GFDL-Eric@users.noreply.github.com> Date: Tue, 29 Mar 2022 13:09:28 -0400 Subject: [PATCH 6/6] Eliminated compiler dependent check for data_table existence. --- data_override/data_override.F90 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/data_override/data_override.F90 b/data_override/data_override.F90 index 55b5121aea..dbbd0a6db8 100644 --- a/data_override/data_override.F90 +++ b/data_override/data_override.F90 @@ -365,20 +365,21 @@ subroutine read_table(data_table) type(data_type) :: data_entry logical :: ongrid + logical :: table_exists !< Flag indicating existence of data_table character(len=128) :: region, region_type integer :: sunit ! Read coupler_table - open(newunit=iunit, file='data_table', action='READ', iostat=io_status) - if(io_status/=0) then - if(io_status==29) then - call mpp_error(NOTE, 'data_override_mod: File data_table does not exist.') - else - call mpp_error(FATAL, 'data_override_mod: Error in opening file data_table.') - endif - endif + inquire(file='data_table', EXIST=table_exists) + if (.not. table_exists) then + call mpp_error(NOTE, 'data_override_mod: File data_table does not exist.') + table_size = 0 + return + end if + open(newunit=iunit, file='data_table', action='READ', iostat=io_status) + if(io_status/=0) call mpp_error(FATAL, 'data_override_mod: Error in opening file data_table.') ntable = 0 ntable_lima = 0