Skip to content

Refactor package - #31

Open
nreinicke wants to merge 15 commits into
mainfrom
ndr/refactor-package
Open

Refactor package#31
nreinicke wants to merge 15 commits into
mainfrom
ndr/refactor-package

Conversation

@nreinicke

@nreinicke nreinicke commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Refactors the package and adds real documentation.

  • Adds in a new default filter Wood2014 that is based on the paper: https://docs.nlr.gov/docs/fy14osti/61109.pdf. This approach has been tested against high quality TomTom grade data and performs better than the previous default method.
  • Make the interface simpler so we can take traces in various formats (numpy array, python dict, pandas dataframe, etc).
  • Allow composable elevation filters so you can run a bridge correction routine before the generic smoothing based correction step
  • Updates the API elevation model to batch points for improved performance.

Nicholas Reinicke added 4 commits May 27, 2026 10:52
 - update lab name
 - make requests optional
 - remove setup.py
 - Add savgol filter implementation and drop scipy
 - add grade/elevation filter abstractions
 - drop strict pandas dep
 - clean up top level imports
 - only do elevation filtering
 - make bridge filter more robust and operate on elevation data
 - pass in elevation model directly instead of soruce and elevation model
 - add plotting utilities

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

Refactors GradeIT into a lighter, pandas-optional core API that returns a structured GradeResult, adds optional folium-based interactive plotting, and reorganizes filtering/elevation logic into clearer modules.

Changes:

  • Replaced the old DataFrame-mutating gradeit/gradeit.py API with a new orchestrator in gradeit/core.py returning GradeResult and supporting flexible coordinate inputs.
  • Introduced optional-dependency features (pandas, plot) and lazy imports to keep import gradeit cheap.
  • Added substantial unit test coverage for IO coercion, filtering behavior, plotting, and import surface guarantees.

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_plotting.py New tests for folium plotting layers, error paths, and tooltip content.
tests/test_io.py New tests for to_coordinates() coercion and GradeResult export helpers.
tests/test_imports.py Ensures top-level import surface works and avoids eager heavy imports.
tests/test_gradeit.py End-to-end tests for new gradeit() core API, filtering semantics, and input immutability.
tests/test_filtering.py Tests Savitzky-Golay primitive and filter behavior (optionally validated vs SciPy).
tests/test_bridge_filter.py Extensive tests for new BridgeFilter detection/correction behavior.
setup.py Removed legacy setup.py stub (pyproject-based packaging).
README.md Updated usage docs, extras installation, filtering pipeline, and plotting docs.
pyproject.toml Made pandas/folium optional extras; updated metadata and pixi env features.
pixi.lock Lockfile updated to reflect dependency graph changes and new extras/dev deps.
LICENSE Updated copyright line.
gradeit/plotting.py New plot_grade_map() implementation using folium with raw/filtered layering.
gradeit/io.py New to_coordinates() + GradeResult container with lazy pandas/folium helpers.
gradeit/gradeit.py Removed old DataFrame-based gradeit() implementation.
gradeit/filters/savitzky_golay.py Added pure-numpy Savitzky-Golay implementation + filter wrapper.
gradeit/filters/elevation_filter.py Introduced ElevationFilter abstraction.
gradeit/filters/bridge.py Added BridgeFilter implementation for bridge/overpass DEM dip correction.
gradeit/filters/init.py Exposed filter public surface.
gradeit/filter_bridge.py Removed legacy bridge filtering implementation.
gradeit/exceptions.py New package exception hierarchy for consistent error handling.
gradeit/elevation/usgs_api.py Made requests import lazy and introduced gradeit-specific error types.
gradeit/elevation/filtering.py Removed legacy SciPy-based filtering module.
gradeit/elevation/init.py New elevation module public surface exports.
gradeit/core.py New primary gradeit() orchestration with model injection + filter pipeline.
gradeit/init.py Curated top-level public API surface (models, filters, result type, plotting).
examples/basic.py Updated example to new API, optional filtering pipeline, and plotting output.
CLAUDE.md Added architecture documentation describing the refactor and new API surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gradeit/plotting.py
Comment thread gradeit/filters/savitzky_golay.py Outdated
Comment thread README.md Outdated
Comment thread pyproject.toml Outdated
Comment thread gradeit/elevation/usgs_api.py Outdated
@nreinicke

nreinicke commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@jakeholden @jhoshiko If you have a chance I would really appreciate your eyes on these updates, especially the new documentation, see:
new-gradeit-docs.zip

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