Skip to content

eamxx: set fillval thresholds to match science/diags#8481

Draft
mahf708 wants to merge 1 commit into
masterfrom
mahf708/eamxx/reset-fillval-related-thresholds
Draft

eamxx: set fillval thresholds to match science/diags#8481
mahf708 wants to merge 1 commit into
masterfrom
mahf708/eamxx/reset-fillval-related-thresholds

Conversation

@mahf708

@mahf708 mahf708 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This pull request makes targeted adjustments to threshold values in the EAMxx component, specifically affecting how masked and unfilled data are handled in output and remapping routines. These changes aim to improve the robustness and accuracy of data processing by fine-tuning when data is considered valid or should be masked.

Threshold adjustments for data validity and masking:

  • Reduced the m_avg_coeff_threshold in AtmosphereOutput from 0.5 to 0.01, making the output more tolerant of unfilled values before assigning the fill value. (components/eamxx/src/share/io/scorpio_output.hpp)
  • Changed the mask_threshold in rescale_masked_fields from std::numeric_limits<Real>::epsilon() to 0.25, setting a more practical threshold for masking out columns during remapping. (components/eamxx/src/share/remap/horizontal_remapper.cpp)

@mahf708 mahf708 linked an issue Jun 17, 2026 that may be closed by this pull request
@mahf708 mahf708 linked an issue Jun 17, 2026 that may be closed by this pull request
@mahf708 mahf708 added EAMxx C++ based E3SM atmosphere model (aka SCREAM) COSP labels Jun 17, 2026
@mahf708 mahf708 changed the title set fillval thresholds to match science/diags eamxx: set fillval thresholds to match science/diags Jun 17, 2026
@mahf708 mahf708 requested a review from Copilot June 17, 2026 04:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts two threshold constants in EAMxx that control when data is treated as valid vs
masked/fill-valued during horizontal remapping and output averaging, to better align behavior
with science/diagnostic expectations.

Changes:

  • Update the real-mask cutoff used when rescaling masked fields during horizontal remapping.
  • Lower the default averaged-output “valid sample” threshold used to decide when to emit FillValue.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
components/eamxx/src/share/remap/horizontal_remapper.cpp Changes the hard cutoff used to decide whether to rescale vs fill masked target entries during remap.
components/eamxx/src/share/io/scorpio_output.hpp Lowers the default averaging validity threshold that influences FillValue propagation in averaged output.

const int rank = layout.rank();
const int ncols = m_tgt_grid->get_num_local_dofs();
const Real mask_threshold = std::numeric_limits<Real>::epsilon(); // TODO: Should we not hardcode the threshold for simply masking out the column.
const Real mask_threshold = 0.25;
Comment on lines 223 to +224
Real m_avg_coeff_threshold =
0.5; // % of unfilled values required to not just assign value as FillValue
0.01; // % of unfilled values required to not just assign value as FillValue

@bartgol bartgol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with the direction of the change. As for the actual numbers, I think that may be somewhat up for debate.

Two comments:

  • I wonder if using the same % threshold for remappers and averaging would be better. The reason being, if you are fine with 1% of valid time snapshots, why aren't you fine with 1% of the (spatial) patch being valid and ask for 25% instead?
  • To avoid having to change hard-coded values again, we should consider making the remapper threshold configurable, and add another parameter in the output yaml to tune it (AtmosphereOutput will have to pass the param to the horiz remapper when constructing it).

These are not points on which I feel strongly, so I'm approving. More like thoughts. I'd like to hear what you think about them though.

@mahf708

mahf708 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

I wonder if using the same % threshold for remappers and averaging would be better. The reason being, if you are fine with 1% of valid time snapshots, why aren't you fine with 1% of the (spatial) patch being valid and ask for 25% instead?

Let me think, I am not very happy that we are moving out from the infinitesimal setup. To me, that's theoretically sound. I wonder if something else is amiss. Lemme take a deeper look. I'd like to keep these two thresholds defaulted to std::numeric_limits::epsilon()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

COSP EAMxx C++ based E3SM atmosphere model (aka SCREAM)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eamxx: cosp bugs with fillval redux

3 participants