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

workaround for bug in f90nml package #633

Closed
seb-wahl opened this issue Mar 31, 2022 · 3 comments · Fixed by #733
Closed

workaround for bug in f90nml package #633

seb-wahl opened this issue Mar 31, 2022 · 3 comments · Fixed by #733
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@seb-wahl
Copy link
Contributor

Describe the bug
The package f90nml (https://github.com/marshallward/f90nml) used by ESM-Tools has a bug (marshallward/f90nml#110) which means it cannot handle certain types of namelists correctly. Unfortunately we have such namelists (which are valid fortran namelists) sometimes with NEMO in FOCI and

   sn_tracer(1)   = 'DET'   , 'Detritus                   '  , 'mmole-N/m3' ,  .false.
   sn_tracer(2)   = 'ZOO'   , 'Zooplankton concentration  '  , 'mmole-N/m3' ,  .false.
   sn_tracer(3)   = 'PHY'   , 'Phytoplankton concentration'  , 'mmole-N/m3' ,  .false.

is turned into

sn_tracer(1:3)   = 'DET', 'ZOO', 'PHY'

by f90nml together with warnings (see marshallward/f90nml#110 for details)

Workaround
Since it seems to be difficult to fix this in f90nml (see discussion at marshallward/f90nml#110) a workaround is to rewrite the problematic section by using named entries in the namelist. To do so, you need to look up the names in the source code. In the above test case I was able to produce a workaround with

namelist_changes:
      namelist_top_cfg:
        namtrc:
           sn_tracer: "remove_from_namelist"
           sn_tracer(1)%clsname: DET
           sn_tracer(2)%clsname: ZOO
           sn_tracer(3)%clsname: PHY
           sn_tracer(1)%cllname: "Detritus"
           sn_tracer(2)%cllname: "Zooplankton concentration"
           sn_tracer(3)%cllname: "Phytoplankton concentration"
           sn_tracer(1:3)%clunit: "mmole-N/m3"

But maybe one of us is able to actually fix this in f90nml correctly, but I doubt that we have time to do this...

@seb-wahl
Copy link
Contributor Author

FYI @pgierz @mandresm @JanStreffing in case you hit the same bug...

@pgierz
Copy link
Member

pgierz commented Mar 31, 2022

Hi @seb-wahl, yeah I saw this. I don't think anything in ECHAM or FESOM currently uses this style of namelist. Out of curiosity, what does this translate to? A 3x4 array?

[
['DET'   , 'Detritus                   '  , 'mmole-N/m3' ,  .false.],
[ZOO'   , 'Zooplankton concentration  '  , 'mmole-N/m3' ,  .false.],
['PHY'   , 'Phytoplankton concentration'  , 'mmole-N/m3' ,  .false.],
]

The namelist parser should certainly be able to handle that somehow, but I do not have time to look into it (plus it is foreign code, so it would take me even longer 😞

@seb-wahl
Copy link
Contributor Author

I even thought having a go at this myself, but reading the comments in marshallward/f90nml#110 I realised that this might not be that easy.

@pgierz pgierz added bug Something isn't working wontfix This will not be worked on labels Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants