Skip to content

Conversation

@jjmaynard
Copy link
Collaborator

@jjmaynard jjmaynard commented Oct 1, 2025

Description

This PR resolves URL mapping issues in the US soil identification system where soil components were receiving incorrect SDE/SEE URLs due to index misalignment caused by component reordering during processing. #294

Problem

  • Soil components were receiving incorrect SDE (Soil Data Explorer) and SEE (Soil Series Explorer) URLs
  • The issue occurred because URL lists were created based on original component order, but the Site list generation used indices from [mucompdata_cond_prob.iterrows()] which had been reordered by multiple sorting operations
  • Index misalignment caused components to receive URLs intended for different components
  • Non-deterministic component ordering in groupby operations added inconsistency

Solution

URL Mapping Overhaul:

  • Replaced index-based URL storage (SDE_URL/SEE_URL arrays) with component key (cokey) based mapping
  • Implemented [cokey_to_urls] dictionary for safe component-to-URL lookups
  • Used component keys for URL retrieval instead of positional indices

Deterministic Ordering:

  • Changed [groupby("cokey", sort=False)]to [groupby("cokey", sort=True)] for consistent component processing
  • Added deterministic component name handling for duplicate soil series

@jjmaynard jjmaynard changed the title Fix/soilweb links Fix: soilweb links Oct 1, 2025
@jjmaynard jjmaynard changed the title Fix: soilweb links fix: soilweb links Oct 1, 2025
@jjmaynard jjmaynard requested a review from garobrik October 1, 2025 00:06
garobrik and others added 2 commits October 1, 2025 13:04
…soil identification

- Replace index-based URL storage with component key mapping to fix URL mismatches
- Add deterministic sorting to groupby operations for consistent component ordering
- Improve component name duplication handling with sorted processing
- Fix Series URL generation logic to properly match components with their URLs

Resolves issues where soil components received incorrect SDE/SEE URLs due to sorting misalignment between URL lists and component data ordering.
Improves code readability by reformatting long sort_values and other function calls across the file. No functional changes were made; only code style and formatting were updated for clarity and consistency.
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.

3 participants