-
Notifications
You must be signed in to change notification settings - Fork 35
Add geologic timescale to plots (#270) #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Corrected the function name from 'hightlight_intervals' to 'highlight_intervals' and updated all references. Improved type checking for intervals, color, alpha, and labels to accept both lists and numpy arrays. Enhanced color handling to support named CSS4 colors and fixed logic for interval boundary checks.
Replaces legacy CSV-based GTS plotting with a new system that loads the ICS chart from RDF (Turtle) using rdflib, and provides robust DataFrame-based utilities for geologic time scale annotation. Adds functions to load and customize GTS data, determine label placement, and render colored interval bars with smart label fitting and abbreviation support. The new approach is more flexible, supports up-to-date ICS data, and improves maintainability.
Moved load_ics_chart_to_df and apply_custom_traits from plotting.py to the datasets module. Updated imports and function calls accordingly to improve code organization and modularity.
Introduces `load_ics_chart_to_df` to parse ICS stratigraphic charts in Turtle format into DataFrames, including robust namespace handling and rank normalization. Adds `apply_custom_traits` to allow custom overrides of DataFrame columns based on trait matching. These utilities facilitate integration and customization of geologic timescale data.
The load_ics_chart_to_df function now accepts a time_units argument to allow conversion of boundary values to different time units (Ma, ka, Ga, or years). This enhances flexibility for users needing geological time data in various units.
Introduces the add_GTS function to plot the Geologic Time Scale (GTS) on Matplotlib axes, with options for label preferences, time units, rank order, and improved font size handling. Refactors argument names for clarity, adds new parameters (e.g., zorder, reverse_rank_order), and improves axis handling and label fitting logic.
Refactored load_ics_chart_to_df to import rdflib only within the function and handle ImportError by falling back to loading a local CSV. This improves compatibility for users without rdflib installed and avoids unnecessary imports when not needed.
Changed default reverse_rank_order to True and updated docstring to clarify rank ordering. Fixed duration calculation to use .values for numpy arrays. Modified rank iteration to follow the order in the ranks list. Adjusted y-axis inversion logic to depend on location instead of reverse_rank_order.
Added i-c-stratigraphy_2024_11_24.csv containing the International Chronostratigraphic Chart (ICS) with boundaries, colors, and abbreviations for geologic time units. Data is sourced from the ICS chart.ttl as of 2024-11-24.
Added a usage example in the plot method docstring demonstrating how to plot the CENOGRID d18O timeseries with Geologic Time Scale annotation using add_GTS.
khider
approved these changes
Oct 6, 2025
CommonClimate
approved these changes
Oct 6, 2025
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 adds support for adding Geologic Timescale to plots (Resolves #270) via util:
utils/datasets.pyto pull information from url and return a dataframe (includes RDF graph operations).utils/plotting.pyto add a new annotation axis and plot the geologic timescale