EBM base class and EBM0D & EBM1D variants#17
Merged
Merged
Conversation
Split the previous monolithic EBM into a small hierarchy: EBMBase plus EBM0D (0D global-mean) and EBM1DLat (diffusive latitudinal) variants. Introduced module-level physics helpers (OLR_func, albedo_func, albedo_func1D) and moved latitudinal implementation into ebm.py, removing the separate latitudinal_ebm.py file and exporting the new classes from the package. Adjusted PBModel integrations and parameter resolution (get_param_value) and improved array/grid handling, diagnostics, and initial-state validation for the 1D model. Updated tests to use EBM0D, added new tests for EBM1DLat, and removed the old latitudinal_ebm tests.
Clarify and expand documentation across paleobeasts.signal_models.ebm: rewrite and enrich docstrings for OLR and albedo callables (including parameter and return descriptions and units), add explanatory notes and examples to EBMBase, EBM0D and EBM1DLat class docstrings, and document method behaviour for validate_initial_state, dydt, calc_albedo, calc_OLR, annual_mean_insolation, calc_diffusion, calc_global_mean, calc_ice_line_lat and populate_diagnostics_from_history. Adds default values, optional/return semantics, and implementation notes for parameter callables/Forcing objects. These are documentation-only changes intended to improve developer ergonomics and API clarity; no functional behavior was altered.
Force albedo_func and albedo_func1D to accept climate parameters as keyword-only (added '*' to signatures) to prevent accidental positional use and improve clarity. Also adjusted EBM0D.__init__ parameter order to place var_name earlier and move state/diagnostic variables after it. These are small API changes that may require updating callers that relied on the previous positional argument order.
Add notebooks/model_demos/ebm_quickstart.ipynb: a hands-on walkthrough for paleobeasts.signal_models.ebm demonstrating EBM0D and EBM1DLat. Documents class hierarchy and key parameters (forcing, OLR, C, albedo), shows minimal instantiation and integration examples, compares constant vs. temperature-dependent albedo (including bistability), provides a custom albedo example, and demonstrates EBM1DLat usage, diagnostics, and plotting. Intended as a usage/demo notebook (not a scientific analysis).
Merges origin/main (PR #16 forcing_fixes) into the ebm branch. Conflict in test_signal_models_ebm.py resolved by keeping the rewritten version from this branch. EBM0D.dydt updated to use self.resolve_forcing(t) per the new PBModel convention. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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 pull request makes several significant changes to the codebase related to energy balance models (EBMs). The main updates include removing the legacy
latitudinal_ebmmodel, consolidating all EBM functionality under theebmmodule, and adding comprehensive tests and an example notebook for the new EBM implementations. These changes streamline the codebase, improve maintainability, and enhance test coverage.EBM Model Refactoring and Cleanup
LatitudinalEBMclass and its module: The filepaleobeasts/signal_models/latitudinal_ebm.pyand all references to the old class have been deleted, ensuring only the new EBM implementations are used. [1] [2]Documentation and Examples
notebooks/model_demos/ebm_quickstart.ipynbprovides a detailed walkthrough of theEBM0DandEBM1DLatmodels, including usage examples, parameter explanations, and visualizations.Testing Improvements
paleobeasts/tests/test_signal_models_ebm.py: Covers integration, parameterization, and output conversion forEBM0Dand basic smoke testing forEBM1DLat.paleobeasts/tests/test_signal_models_ebm1d_lat.py: Provides additional tests forEBM1DLat, checking import, equilibrium behavior, cold-state dynamics, and grid size handling.These changes collectively modernize the EBM code, improve clarity for users, and ensure robust test coverage for both zero-dimensional and latitudinal EBM variants.