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

String stash code silently ignored on pp-save #6239

Open
rcomer opened this issue Nov 27, 2024 · 2 comments · May be fixed by #6289
Open

String stash code silently ignored on pp-save #6239

rcomer opened this issue Nov 27, 2024 · 2 comments · May be fixed by #6289
Assignees

Comments

@rcomer
Copy link
Member

rcomer commented Nov 27, 2024

🐛 Bug Report

Before saving to pp-file, a user may have reason to modify or add a stash code. If the code is added in the string form, it is silently ignored.

How To Reproduce

Steps to reproduce the behaviour:

  1. Run code
import iris

fname = iris.sample_data_path('air_temp.pp')
cube = iris.load_cube(fname)

cube.attributes['STASH'] = 'm01s34i001'

iris.save(cube, 'test.pp')
  1. Inspect the file test.pp.

  2. The stash code in the file is zero.

Expected behaviour

Either the stash code in the file is 34001 or I get a type error because I should have used a STASH object instead of a string.

Screenshots

Environment

  • OS & Version: RHEL9 🎉
  • Iris Version: 3.11

Additional context

Click to expand this section...
Please add additional verbose information in this section e.g., code, output, tracebacks, screenshots etc
@rcomer
Copy link
Member Author

rcomer commented Jan 2, 2025

I would be happy to write a PR for this, but does anyone have an opinion what the behaviour should be? Should it "just work" via from_msi? Or should it error? Or just warn that the attribute is wrong type and therefore ignored?

@ESadek-MO
Copy link
Contributor

From @SciTools/peloton, we think for this particular issue it should "just work". If a string is given, it should try to convert it to a STASH object, and if that fails it should raise a error.

We think we should revisit the rationality of how we handle STASHes generally, and I'll raise an issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants