feat: add function to create HTML representations of custom classes#178
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds HTML (Jupyter-friendly) representations for several gravity_toolkit classes and updates notebook/widget defaults to improve interactive usability.
Changes:
- Introduces a shared
html_repr()helper ingravity_toolkit.utilities. - Adds/updates
__str__,__repr__, and_repr_html_methods across multiple core data classes (e.g.,harmonics,spatial,geocenter,love_numbers,gia,units). - Updates Jupyter widgets/notebooks to use cache-based defaults and to pass the selected endpoint value correctly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| gravity_toolkit/utilities.py | Adds html_repr() helper used by class _repr_html_ methods. |
| gravity_toolkit/units.py | Adds string/HTML representations for units. |
| gravity_toolkit/tools.py | Defaults widget directory to cache path; adjusts defaults and widget descriptions. |
| gravity_toolkit/spatial.py | Adds HTML representation and tweaks month display logic. |
| gravity_toolkit/read_love_numbers.py | Adds HTML representation for love_numbers. |
| gravity_toolkit/read_GIA_model.py | Adds string/HTML representations for gia. |
| gravity_toolkit/harmonics.py | Adds HTML representation and tweaks month display logic. |
| gravity_toolkit/geocenter.py | Adds HTML representation and tweaks month display logic. |
| doc/source/notebooks/GRACE-Spatial-Maps.ipynb | Updates endpoint usage and adds object inspection to show rich repr output. |
| doc/source/notebooks/GRACE-Spatial-Error.ipynb | Updates endpoint usage and adds object inspection to show rich repr output. |
| doc/source/notebooks/GRACE-Harmonic-Plots.ipynb | Updates endpoint usage and adds object inspection to show rich repr output. |
| doc/source/notebooks/GRACE-Geostrophic-Maps.ipynb | Updates endpoint usage and adds object inspection to show rich repr output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fix: case where there are months but it is an integer
| """Widgets and functions for running GRACE/GRACE-FO analyses""" | ||
| # set default keyword arguments | ||
| kwargs.setdefault('directory', pathlib.Path.cwd()) | ||
| kwargs.setdefault('directory', get_cache_path(ensure_exists=False)) |
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.
No description provided.