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

Trailing comma at end of character namelist entry will throw error #294

Open
jimmielin opened this issue Aug 23, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@jimmielin
Copy link
Member

What is the feature/what would you like to discuss?

Hi all - not sure if this is intended behavior (couldn't find a closed issue discussing it - sorry if there is!) so I'm posting to see if it's an issue that should be fixed.

In user_nl_cam, for character-type namelist entries (e.g., ncdata), if the entry terminates with a comma, this comma is erroneously considered by the atm_in_paramgen as part of the namelist character entry and complains about mis-matched quotes:

atm_in_paramgen.AtmInParamGenError: Namelist entry 'ncdata' is of type character but its input value:
'/example/path/here',
has mis-matched quotes.  Please fix.

the 'offending' user_nl_cam file would be

ncdata = '/example/path/here',
ncdata_check = /example/path/here'

This is because the mis-matched quotes checker only checks the last character of the input string, regardless of whether there's a value separator (i.e., ,) at the end. The Fortran 90 Standard (https://wg5-fortran.org/N001-N1100/N692.pdf) states, in pertinent part:

A value separator for namelist formatting is the same as for list-directed formatting (10.8).
10.9.1 Namelist input
Input for a namelist input statement consists of:
...
(4) A sequence of zero or more name-value subsequences separated by value separators, and
...

In section 10.8:

A value separator is one of the following:
(1) A comma optionally preceded by one or more contiguous blanks and optionally followed by one or more contiguous blanks,
...

This only affects character-type entries because it's the quotes checker blocking this particular format. Other types (e.g., pver = 32,) will work fine.

Is there anyone in particular you want to be part of this conversation?

No response

Will this change (regression test) answers?

No

Will you be implementing this enhancement yourself?

Yes

@jimmielin jimmielin added the enhancement New feature or request label Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant