-
Notifications
You must be signed in to change notification settings - Fork 25
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
Conversation
draft implementation - to be extended to all parameter values
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
while keeping it simple:
also eases usage in scripts (output of ncdump - h). Hence, I would stay with the current version.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
hamocc/mo_param_bgc.F90
Outdated
@@ -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,'','') |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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).
There was a problem hiding this 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.
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.