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

Add global metadata attributes to diagnostic output files #1640

Open
aidanheerdegen opened this issue Sep 17, 2024 · 1 comment
Open

Add global metadata attributes to diagnostic output files #1640

aidanheerdegen opened this issue Sep 17, 2024 · 1 comment

Comments

@aidanheerdegen
Copy link

ACCESS-NRI would like the capability to embed global metadata attributes into diagnostic ouput files.

Specifically we want to add unique tracking IDs to model diagnostic (and tracer) outputs to create a full experiment provenance chain that would enable users to discover experiment metadata.

Ideally there would be a config file where any global attribute could be set. A fallback option would be dedicated namelist options for setting specific global metadata attributes.

For background see this related issue for the tool we're using to run our models:

payu-org/payu#510

From the docs it appears quite straightforward:

For MOM6 Global attributes can be written by calling register_global_attribute. Scalar and 1d real and integers (32 and 64 bit) and scalar string values are supported

call register_global_attribute(fileobj, "global_attribute_name", value)

Is it already possible? If not has anyone done anything of this nature before so there is a design pattern we could follow?

@marshallward
Copy link
Collaborator

marshallward commented Sep 19, 2024

I don't know of any canonical way to add model-specific metadata to netCDF output. AFAIK anyone doing this would apply to their own model-specific output, rather than modifications to output from MOM6.

We have the write_metadata_axis/field/global functions, handled by the write_metadata interface, which append the usual netCDF metadata content to the data records. That seems like it may provide the low-level functionality you need.

I think the current write_metadata_axis/field can only write specific content, such as longname, units, etc. But it could be generalized to support other metadata. write_metadata_global is more general-purpose and might already meet your needs.

You would also need some way to pass your information from (say) driver/coupler to MOM. At the moment, I'm not sure there is an established "MOM API" function to do that. If not, then it could also be provided. (The MOM_infra_file object may be able to do this. If not, then this is where I would add it.)

Note that these functions all pass through FMS, and their main purpose was to ensure that output works smoothly with FMS. The FMS developers are currently working on a redesign of the diag manager, so you might want to see how that is going.

@aidanheerdegen aidanheerdegen moved this to New Issues 🌅 in Model Release Nov 1, 2024
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

No branches or pull requests

2 participants