Repository navigation
Add RESSURF, the surface energy flux residual, as a derived variable - #493
Merged
Merged
Conversation
RESSURF = FSNS - FLNS - SHFLX - (Lv+Lf)*QFLX + Lf*1e3*(PRECC+PRECL-PRECSC-PRECSL), the same terms CAM uses in its own energy budget. It is derived from the eight time series, so it works with any history stream name. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Closes #167.
RESTOM was already in the ADF; this adds RESSURF, the surface energy flux residual, so it can go in the AMWG table:
RESSURF = FSNS - FLNS - SHFLX - (Lv+Lf)*QFLX + Lf*1e3*(PRECC+PRECL-PRECSC-PRECSL)with
Lv = 2.501e6andLf = 3.337e5J/kg (CAMshr_const). These are the same terms as CAM's own energy budget (check_energy_chng.F90), so the snow term is included as in CAM.Changes
lib/adf_derive.py: a RESSURF branch next to RESTOM.lib/adf_variable_defaults.yamland..._era5-1deg.yaml: RESSURF entry (copied from RESTOM, category "Sfc energy flux"),derivable_fromlists the eight time series. The header note now mentions the two formula variables.lib/test/unit_tests/test_adf_derive.py: one test for the formula and the file name withcam.h0andcam.h0a.To use it, add
RESSURFtodiag_var_list. The run needs all eight variables in the same history stream; if one is missing, RESSURF is skipped with a message. It is not added to the example config.Testing
pytest lib/test/unit_tests: 264 passed.blackis clean.cam.h0avs CAM6cam.h0, 2 years each), RESSURF and RESTOM only: it finished with no errors, the derived files carry the right stream name, and the table row and lat/lon maps were made. The derived field matches a direct recomputation from the raw time series exactly.Not checked
black25.11.0; I ran 26.5.1.Claude-assisted: written with Claude Code, and reviewed by a separate read-only Claude agent following AGENTS.md (no blocking findings; its non-blocking findings are fixed in this PR).
🤖 Generated with Claude Code