Fix dataset prefix matching in STAC server#9
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesSTAC Strict Dataset Matching and ERA5-Land Docs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dclimate_client_py/stac_server.py`:
- Around line 78-82: The code in this area has not been formatted according to
Ruff's formatting standards, causing the CI pre-commit check to fail. Run the
pre-commit tool or ruff-format command locally to automatically reformat the
code in the stac_server.py file to comply with the project's formatting
requirements, then commit these formatting changes before merging the pull
request.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 61e36dab-5972-4d68-b1de-07e328f04ad2
📒 Files selected for processing (3)
README.mddclimate_client_py/stac_server.pytests/test_stac_server_listing.py
This pull request improves the accuracy and reliability of dataset resolution in the dClimate client, specifically when dealing with datasets whose names are prefixes of other datasets (such as
precipitation_totalandprecipitation_total_land). The changes ensure that only exact dataset matches are returned, preventing accidental conflation of similarly named datasets. The update also adds comprehensive tests and clarifies usage in the documentation.Exact dataset matching and bug fix:
resolve_cid_from_stac_serverto use a new helper function_feature_matches_dataset, ensuring that only exact dataset IDs are matched and avoiding prefix collisions (e.g.,precipitation_totalvs.precipitation_total_land). [1] [2]Testing improvements:
tests/test_stac_server_listing.pythat verifyresolve_cid_from_stac_servercorrectly handles datasets with similar prefixes, rejects prefix-only matches, and supports legacy ID fallback, ensuring robust behavior for edge cases.Documentation update:
README.mdto clarify the distinction between ERA5 and ERA5-Land datasets, including usage examples and recommendations to inspect dataset names before loading.Minor codebase updates:
resolve_cid_from_stac_serverto the import list intests/test_stac_server_listing.pyto support the new tests.Summary by CodeRabbit
Documentation
load_datasetpattern (including precipitation examples).Bug Fixes
Tests
Chores