= Namelist Integrity checks = Misplaced or mis-spelt variables in configuration namelist files can be a source of frustration when porting configurations used with older releases of NEMO to more modern versions. The code will report these occurrences and stop during start-up; but only one instance is reported each time. Finding them all this way can be a time-consuming business. Part 1 of this page details a simple Python script which can be used to find mis-matches between a configuration namelist and its reference counterpart before attempting to run the model. For most users, this should be sufficient but developers of new features have the added uncertainty of not knowing if the reference namelist correctly contains all the namlist options available in the code. Part 2 of this page suggests further tools which can can construct a 'pseudo reference namelist' by parsing the fortran code base. The actual reference namelist and the 'pseudo' version can then be used with the integrity checker from part 1. By using the integrity checker twice, with the roles of the two namelists swapped, it is possible to confirm that: * The actual reference namelist is compatible with the code base * The actual reference namelist contains examples of all the namelist variables defined in the code base. All the scripts mentioned are attached to this page. == Part 1 Integrity checker == If we assume the following conventions for NEMO namelists: * namelists are started with ''&name_of_namelist'' appearing as the first non-whitespace on a line (and not followed by anything other than an optional comment) * Only one variable is set on each line * namelists are closed with / appearing as the first non-whitespace on a line then the attached nemo_nml_check.py script will: * read supplied namelist files * construct lists of namelist blocks and their contents (the latter being a list of lists) * compare the contents lists for matching named blocks to confirm membership * report any mis-matches together with the line number in the configuration namelist By default, the script will compare ''namelist_cfg'' and ''namelist_ref'' from the current directory. Alternative pairs can be named using the ''-c'' and ''-r'' command-line options: {{{#!bash python nemo_nml_check.py --help usage: nemo_nml_check.py [-h] [--cfg [CFGFILE]] [--ref [REFFILE]] Check for consistency between cfg namelists and ref versions e.g. python nemo_nml_check.py --cfg --ref optional arguments: -h, --help show this help message and exit --cfg [CFGFILE], -c [CFGFILE] configuration namelist --ref [REFFILE], -r [REFFILE] reference namelist }}} A typical example of an error found between the default pairing is: {{{#!bash python nemo_nml_check.py No match for: rn_rdt in namdom (at line no. 39 ) }}} and a quick check in the ''namelist_ref'' file will confirm that this is because ''rn_rdt'' has been renamed as ''rn_Dt''. == Part 2 Constructing a pseudo-reference namelist ==