Skip to content

fix: gower normalization and site-based score_data return with no user data input #262

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

Closed
wants to merge 5 commits into from

Conversation

jjmaynard
Copy link
Collaborator

Description

Code changes address issues #250 and #261

Issues Fixed

  1. Incorrect Site Similarity: rank_soils returns site-based data scores even when users provide insufficient inputs. Gower's distance needs at least 2 variables - since elevation is auto-extracted, users must provide slope OR depth-to-bedrock for valid site-based data calculations.

  2. Double Normalization: _gower_distance_row normalizes values already normalized by gower_distances, preventing proper soil reordering.

Changes

  • Added validation to only calculate site scores when sufficient inputs provided
  • Removed redundant normalization in _gower_distance_row

Test Cases

Incorrect Site Similarity: #250
Test point: {"lon": -72.68237, "lat": 41.66272}

Double Normalization: #261
Test point: : {"lon": -94.31005777, "lat": 42.63413723}
Location with Nicollet (clay loam) as top-ranked soil:

  • Input: User enters 'loam' texture (similar to Clarion)
  • Before: Nicollet incorrectly stays top-ranked
  • After: Clarion correctly ranks highest
    Fixes accurate soil ranking based on user data.

@garobrik
Copy link
Member

this code was merged to main in #266

@garobrik garobrik closed this Jun 26, 2025
@garobrik garobrik deleted the fix/gower-normalization branch June 26, 2025 00:47
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