Skip to content

feat: add function to create HTML representations of custom classes#178

Merged
tsutterley merged 2 commits into
mainfrom
repr
Jul 14, 2026
Merged

feat: add function to create HTML representations of custom classes#178
tsutterley merged 2 commits into
mainfrom
repr

Conversation

@tsutterley

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

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 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 in gravity_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.

Comment thread gravity_toolkit/utilities.py
Comment thread gravity_toolkit/spatial.py Outdated
Comment thread gravity_toolkit/spatial.py Outdated
Comment thread gravity_toolkit/harmonics.py Outdated
Comment thread gravity_toolkit/harmonics.py Outdated
Comment thread gravity_toolkit/harmonics.py
Comment thread gravity_toolkit/geocenter.py Outdated
Comment thread gravity_toolkit/geocenter.py Outdated
Comment thread gravity_toolkit/tools.py
fix: case where there are months but it is an integer

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread gravity_toolkit/tools.py
"""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))
@tsutterley tsutterley merged commit 0e3a093 into main Jul 14, 2026
6 checks passed
@tsutterley tsutterley deleted the repr branch July 14, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants