WIP: Changes to speed up BoundaryForcing calls#616
Open
kthyng wants to merge 3 commits into
Open
Conversation
added 2 commits
June 9, 2026 16:32
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a source-fill and regrid-engine API for
BoundaryForcing, and deprecates theapply_2d_horizontal_fillboolean flag. Users can now explicitly control source-side filling (prefill: None (default), "2d_lateral_fill", "inverse_dist", "nearest_s2d", "nearest_neighbor") and choose the horizontal regrid engine independently (regrid_method: "auto" (default = xESMF if installed, else scipy), "xesmf", "scipy"). The default path is xESMF masked-bilinear interpolation with inverse-distance-weighted destination extrapolation when available, with a nearest-neighbor source pre-fill + scipy interp fallback on Windows/pip installs. When a prefill is set, the source is pre-filled so that nan's are not present (matching the legacy AMG precedent) before per-boundary regridding with plain bilinear, making extrap_method irrelevant. The deprecated apply_2d_horizontal_fill=True/False still works with a clear DeprecationWarning, mapping to the equivalent prefill values for backward compatibility.Scope and testing: Changes are confined to BoundaryForcing only; InitialConditions, SurfaceForcing, Topography, and TidalForcing are intentionally unchanged and produce numerically equivalent output to pre-change. Shared validation helpers (validate_prefill, validate_extrap, resolve_regrid_engine) and an apply_prefill dispatcher on the dataset class enable forward-compatible rollout to other classes later. Comprehensive test coverage includes deprecation mapping, conflict detection, xESMF-availability gating, YAML round-trip compat (old and new formats), per-prefill-method NaN-free assertions, and cross-engine tolerances. All boundary/fill/prefill tests pass; 135 untouched-class tests pass. The physics boundary forcing regression fixture reflects the new xESMF default; BGC fixtures are pinned to regrid_method="scipy" for byte-reproducibility with pre-v4 outputs.
pre-commit run --all-filesdocs/releases.mddocs/api.rst