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

Write parameter values as global attributes to nc-file #329

Merged
merged 5 commits into from
Feb 12, 2024

Conversation

jmaerz
Copy link
Collaborator

@jmaerz jmaerz commented Feb 8, 2024

This is an implementation and PR to write model parameters as global attributes to each individual netcdf file. It enables i) better tracing of used parameter values and ii) can be easier used in scripts to trace parameter changes during tuning processes. The code is tested on betzy with a 1month run.

If there is a wish for it, we can also make it optional by adding a switch.

draft implementation - to be extended to all parameter values
@jmaerz jmaerz added enhancement New feature or request iHAMOCC Issue mainly concerns the iHAMOCC code base labels Feb 8, 2024
@jmaerz jmaerz self-assigned this Feb 8, 2024
Copy link
Contributor

@JorgSchwinger JorgSchwinger left a comment

Choose a reason for hiding this comment

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

I'm not sure how useful this will be, but I also see no drawbacks - so fine for me.

@@ -221,6 +221,9 @@ subroutine ncwrt_bgc(iogrp)
call ncdims('ks',ks)
call ncdims('bounds',2)
call ncdims('time',0)
do i=1,nentries
call ncputr(param4nc(i)%pname,param4nc(i)%pvalue)
Copy link
Contributor

Choose a reason for hiding this comment

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

For the result in the nc-file, it would be maybe nicer to have call ncputr('Parameter value for '//param4nc(i)%pname,param4nc(i)%pvalue) or something similar.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @JorgSchwinger , this results in ugly formatting of global attributes:
globa-attr
while keeping it simple:
globa-attr-simple
also eases usage in scripts (output of ncdump - h). Hence, I would stay with the current version.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't find the 1st one particularly ugly... that's what ncdump always does with blanks. But anyway, the original is ok, too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you prefer something like parameter_xxxx, we can write this during the call to pinfo_add_entry.

@@ -728,8 +739,43 @@ subroutine write_parambgc()
write(io_stdo_bgc,*) '* opaldens = ',opaldens
write(io_stdo_bgc,*) '* calcdens = ',calcdens
write(io_stdo_bgc,*) '* claydens = ',claydens
call add_entry('orgdens',orgdens,'','')
call add_entry('calcdens',calcdens,'','')
call add_entry('claydens',claydens,'','')
Copy link
Contributor

Choose a reason for hiding this comment

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

A more descriptive name for the routine might be better? E.g. pinfo_add_entry

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, I'll adopt your suggestion (as written initially, I also didn't like the naming).

Copy link
Contributor

@TomasTorsvik TomasTorsvik left a comment

Choose a reason for hiding this comment

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

Thanks Jöran, it should be fine to add parameter output to netcdf files.

@jmaerz jmaerz marked this pull request as ready for review February 9, 2024 16:14
@jmaerz jmaerz removed the request for review from mvertens February 12, 2024 09:31
@jmaerz jmaerz merged commit bdb7966 into NorESMhub:master Feb 12, 2024
4 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request iHAMOCC Issue mainly concerns the iHAMOCC code base
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants