From 4e053b5301279e3fc09be19c3efb8f93ff3615bb Mon Sep 17 00:00:00 2001 From: Tomas Torsvik Date: Thu, 12 Dec 2024 18:37:32 +0100 Subject: [PATCH] Add error message if user_nl_blom includes hash comments --- cime_config/ocn_in_paramgen.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cime_config/ocn_in_paramgen.py b/cime_config/ocn_in_paramgen.py index b26f3b80..db23c03e 100644 --- a/cime_config/ocn_in_paramgen.py +++ b/cime_config/ocn_in_paramgen.py @@ -1338,6 +1338,22 @@ def append_user_nl_file(self, user_nl_file): line = remove_user_nl_comment(line) #End if + #Check if the first character on the line is a hash sign (#): + #This is no longer allowed as a first character, and may indicate + #the use of an old user_nl_blom file + if line.strip()[0] == "#": + emsg = f"Line number {line_num+1} in 'user_nl_blom'" + emsg += " starts with a hash sign (#). This may" + emsg += " indicate an outdated format of your" + emsg += "\nuser_nl_blom file. Current versions of" + emsg += " user_nl_blom file conform to the standard" + emsg += " Fortran namelist syntax, indicating comments" + emsg += "\nwith exclamation mark (!). Please check that" + emsg += " your user_nl_blom file conforms with the" + emsg += " current accepted file format." + raise OcnInParamGenError(emsg) + #End if + #Check if the first character on the line is a comma (,): if line.strip()[0] == ",": #Is this an array variable: