Skip to content

Add configurable prefix/separator for diag_manager wildcard file names - #22

Merged
dougiesquire merged 2 commits into
mom5from
21-diag-wildcards
Aug 14, 2026
Merged

dougiesquire merged 2 commits into
mom5from
21-diag-wildcards

Conversation

@dougiesquire

@dougiesquire dougiesquire commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Description
The diag_manager wildcard file name feature (e.g. outputfile%4yr%2mo%2dy%2hr) currently joins the substituted time fields with a hardcoded _, producing e.g. outputfile_1900_01_01_00.nc. This PR adds two new diag_manager_nml namelist options, wildcard_filename_prefix and wildcard_filename_separator, that control the string inserted before the first substituted field and between subsequent fields, respectively. Both default to _, so existing behaviour is preserved.

Fixes #21

How Has This Been Tested?
See comment below

@dougiesquire dougiesquire self-assigned this Aug 13, 2026
@dougiesquire

dougiesquire commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

In the absence of a test suite in this repo, I've done some manual testing of this in ACCESS-OM2. I ran a number of 2-month cycles of the dev-1deg_jra55_iaf configuration:

  • output000: annual new file frequency; %4yr wildcard; wildcard_filename_prefix/separator unset
  • output001: monthly new file frequency; %4yr%2mo wildcard; wildcard_filename_prefix/separator unset
  • output002: monthly new file frequency; %4yr%2mo%2dy wildcard; wildcard_filename_prefix/separator unset
  • output003: monthly new file frequency; %4yr%2mo%2dy wildcard; wildcard_filename_prefix='' and wildcard_filename_separator='-'
  • output004: monthly new file frequency; %4yr%2mo%2dy wildcard; wildcard_filename_prefix='dateis' and wildcard_filename_separator=''
  • output005: monthly new file frequency; %4yr%2mo%2dy wildcard; wildcard_filename_prefix='%' and wildcard_filename_separator='%'
  • output006: monthly new file frequency; %5mo%2dy wildcard; wildcard_filename_prefix='' and wildcard_filename_separator='-'

The diagnostic names are as expected, e.g.:

$ ls -alh output00*/ocean/access-om2.mom5.3d.temp.1mon.mean*
-rw-r----- 1 ds0092 tm70  19M Aug 13 19:41 output000/ocean/access-om2.mom5.3d.temp.1mon.mean._1958.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 19:58 output001/ocean/access-om2.mom5.3d.temp.1mon.mean._1958_03.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 19:58 output001/ocean/access-om2.mom5.3d.temp.1mon.mean._1958_04.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:08 output002/ocean/access-om2.mom5.3d.temp.1mon.mean._1958_05_16.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:07 output002/ocean/access-om2.mom5.3d.temp.1mon.mean._1958_06_16.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:15 output003/ocean/access-om2.mom5.3d.temp.1mon.mean.1958-07-16.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:15 output003/ocean/access-om2.mom5.3d.temp.1mon.mean.1958-08-16.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:20 output004/ocean/access-om2.mom5.3d.temp.1mon.mean.dateis19580916.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:20 output004/ocean/access-om2.mom5.3d.temp.1mon.mean.dateis19581016.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:25 output005/ocean/access-om2.mom5.3d.temp.1mon.mean.%1958%11%16.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:25 output005/ocean/access-om2.mom5.3d.temp.1mon.mean.%1958%12%16.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:44 output006/ocean/access-om2.mom5.3d.temp.1mon.mean.23497-16.nc
-rw-r----- 1 ds0092 tm70 9.3M Aug 13 20:44 output006/ocean/access-om2.mom5.3d.temp.1mon.mean.23498-15.nc

I also checked an error is thrown if wildcard_filename_prefix/separator is '/', e.g.:

FATAL from PE    27: diag_manager_mod::diag_manager_init: DIAG_MANAGER_NML variable wildcard_filename_separator ("/") cannot contain "/"

@dougiesquire
dougiesquire marked this pull request as ready for review August 13, 2026 11:10
@dougiesquire
dougiesquire requested a review from blimlim August 13, 2026 11:10

@blimlim blimlim left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dougiesquire for adding this, it will be great to have! Code changes look good to me

@dougiesquire
dougiesquire merged commit 3636de1 into mom5 Aug 14, 2026
4 checks passed
@dougiesquire
dougiesquire deleted the 21-diag-wildcards branch August 14, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting the separators used in diag_manager::diag_util::get_time_string

2 participants