Skip to content

Replace standardise_mom6_filenames.sh with a new script#133

Open
dougiesquire wants to merge 2 commits into
mainfrom
mom-filenames
Open

Replace standardise_mom6_filenames.sh with a new script#133
dougiesquire wants to merge 2 commits into
mainfrom
mom-filenames

Conversation

@dougiesquire

Copy link
Copy Markdown
Collaborator

The new script:

  • Supports more than just annual timestamps (e.g. _2023_01_01)
  • Supports OM2 output as well

Closes #132

- Supports more than just annual timestamps (e.g. _2023_01_01)
- Supports OM2 output as well
@dougiesquire

Copy link
Copy Markdown
Collaborator Author

I've tested that this:

  • Works as expected as a archive userscript with ACCESS-OM2 output (yearly and monthly output)
  • Doesn't change things for ACCESS-OM3 output

@anton-seaice anton-seaice marked this pull request as ready for review June 16, 2026 00:54
anton-seaice
anton-seaice previously approved these changes Jun 16, 2026

@anton-seaice anton-seaice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code review only - looks good to me

basename = os.path.basename(path)

# Split the .nc extension
ext_match = re.match(r"^(.*?)(\.nc.*)$", basename)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the matches against things where there is anything(.*) after .nc, is that needed ?

Probably harmless even if not needed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, we also want to match uncollated files e.g. *.nc.0001

Comment thread payu_config/archive_scripts/standardise_mom_filenames.py Outdated
# Create files at the expected destination paths so there is something to protect
expected_paths = [standardised_path(p, s) for p, s in zip(original_paths, suffixes)]
for p in expected_paths:
Path(p).touch()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these files should probably be made in a fixture, otherwise they might impact later tests right ?

anyway, again you can say "no worse than the old method"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is using the pytest tmp_path fixture so I think it is safe. Files created in one tests tmp_path are invisible to others.

I think the chdir could be an issue if we weren't running this sequentially, but we are.

Comment thread payu_config/archive_scripts/standardise_mom_filenames.py Outdated
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.

standardise_mom6_filenames.sh doesn't support non-annual filenames

2 participants