Skip to content

Add support for accumulated fields and fill values; clean-up - #8

Merged
peverwhee merged 11 commits into
ESMCI:developmentfrom
peverwhee:add-accum
May 14, 2026
Merged

peverwhee merged 11 commits into
ESMCI:developmentfrom
peverwhee:add-accum

Conversation

@peverwhee

Copy link
Copy Markdown
Collaborator

The main purpose of this PR is to add logic to accumulate fields (average, min, max, standard deviation). Side effects of these changes:

  1. Logic relies on whether there are fill values, so I added fill_values to the hist_field_info_t object.
  2. All accumulation needs to be done with REAL64 or the numbers are off, so took the opportunity to clean up the hist_buffer interfaces to only have real64 buffers (conversion to real32 happens before writing to a file)
  3. I added an interface in hist_api.F90 so that the host model doesn't need to know about buffers.

Modified files:

M    src/hist_api.F90
- add new hist_field_norm_value interfaces (called by host). These, in turn, call hist_buffer_norm_value
- remove unnecessary interfaces - all buffers are now real64, so the only thing that varies is the dimension

M   src/hist_buffer.F90
- remove unnecessary interfaces - all buffers are now real64
- add accumulation logic for min, max, avg, var (standard deviation)
  - includes addition of new var_buffer for standard deviation calculation
  - also includes check_fill_value that confirms that the fill values are consistently applied across a whole column (all vertical layers); errors otherwise
- change num_samples to be a 1d array - we only need to keep track of samples once per column since fill values are ensured to be consistently applied

M    src/hist_field.F90
- add fillvalue to object; add a getter for fill value

@peverwhee
peverwhee requested a review from nusbaume April 9, 2026 19:24

@nusbaume nusbaume left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for implementing the new history capabilities @peverwhee! I have some change requests, a few of which might take extra effort and thus could be pushed off as future work. Also like always if you want to discuss any of my requests then just let me know!

Comment thread src/hist_api.F90 Outdated
Comment thread src/hist_api.F90 Outdated
Comment thread src/hist_api.F90
Comment thread src/hist_api.F90 Outdated
Comment thread src/hist_api.F90 Outdated
Comment thread src/hist_buffer.F90
Comment thread src/hist_buffer.F90
Comment thread src/hist_buffer.F90 Outdated
Comment thread src/hist_buffer.F90 Outdated
Comment thread src/hist_buffer.F90
nusbaume
nusbaume previously approved these changes May 9, 2026

@nusbaume nusbaume left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for addressing my comments @peverwhee! I have one last request for adding an additional error check, but otherwise everything looks good to me. Thanks again!

Comment thread src/hist_api.F90
@peverwhee
peverwhee requested a review from nusbaume May 11, 2026 21:49
@peverwhee
peverwhee merged commit dc000fe into ESMCI:development May 14, 2026
1 check passed
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.

2 participants