techmatters / soil-id-algorithm

GNU Affero General Public License v3.0
1 stars 0 forks source link

bug: soil list result does not always provide LCC #119

Open shrouxm opened 5 months ago

shrouxm commented 5 months ago

Description

Sometimes the LCC values for list_soils are "nan" or "None". Not sure if this is due to missing data or an algorithm bug. Either we, we should return better values than "nan" or "None".

Steps To Reproduce

Query list_soils with the coordinates {"lon": -122.084000, "lat": 37.422000}.

Solution

Actual behavior

LCC values render as "nan" or "None"

Additional context

Example result json:

{
      "id": {
        "name": "Hangerone",
        "component": "Hangerone",
        "score_loc": 1.0,
        "rank_loc": "1"
      },
      "site": {
        "siteData": {
          "mapunitID": "1882928",
          "componentID": "24611985",
          "componentKind": "Series",
          "dataSource": "SSURGO",
          "textureInfill": "No",
          "rfvInfill": "No",
          "componentPct": 90,
          "distance": 133.0,
          "minCompDistance": 133.0,
          "slope": 1.0,
          "nirrcapcl": "nan",
          "nirrcapscl": "None",
          "nirrcapunit": "nan",
          "irrcapcl": "nan",
          "irrcapscl": "None",
          "irrcapunit": "nan",
          "taxsubgrp": "Cumulic Vertic Endoaquolls",
          "sdeURL": "https://casoilresource.lawr.ucdavis.edu/sde/?series=hangerone",
          "seeURL": "https://casoilresource.lawr.ucdavis.edu/see/#hangerone"
        },
        "siteDescription": "The Hangerone series consists of very deep, poorly drained soils that formed in alluvium from mixed rock sources. Hangerone soils are in basins. Slopes range from 0 to 2 percent. The mean annual precipitation is about 14 inches and the mean annual temperature is about 60 degrees F."
      },
      "esd": {
        "ESD": {
          "ecoclassid": ["R014XG903CA"],
          "ecoclassname": ["Salt Marsh"],
          "esd_url": [""]
        }
      },
      "bottom_depth": {
        "0": 24,
        "1": 42,
        "2": 68,
        "3": 88,
        "4": 115,
        "5": 183,
        "6": 225
      },
      "sand": {
        "0": 20.6,
        "1": 15.8,
        "2": 16.0,
        "3": 18.5,
        "4": 24.7,
        "5": 44.1,
        "6": 22.0
      },
      "clay": {
        "0": 41.8,
        "1": 50.7,
        "2": 49.6,
        "3": 43.8,
        "4": 33.7,
        "5": 24.4,
        "6": 48.6
      },
      "texture": {
        "0": "Clay",
        "1": "Clay",
        "2": "Clay",
        "3": "Clay",
        "4": "Clay loam",
        "5": "Loam",
        "6": "Clay"
      },
      "rock_fragments": {
        "0": 2,
        "1": 1,
        "2": 0,
        "3": 0,
        "4": 0,
        "5": 30,
        "6": 0
      },
      "cec": { "0": "CEC", "1": "CEC" },
      "ph": {
        "0": 8.3,
        "1": 8.3,
        "2": 8.4,
        "3": 8.6,
        "4": 8.5,
        "5": 8.6,
        "6": 8.2
      },
      "ec": {
        "0": 2.0,
        "1": 2.0,
        "2": 2.0,
        "3": 2.0,
        "4": 2.0,
        "5": 2.0,
        "6": 2.0
      },
      "lab": {
        "0": [41.22, 1.45, 6.17],
        "1": [41.22, 1.45, 6.17],
        "2": [41.22, 1.45, 6.17],
        "3": [60.67, 0.21, 8.29],
        "4": [71.25, -0.45, 8.34],
        "5": [71.62, 0.23, 14.6],
        "6": [41.23, 0.35, 6.53]
      },
      "munsell": {
        "0": "10YR 4/1",
        "1": "10YR 4/1",
        "2": "10YR 4/1",
        "3": "2.5Y 6/1",
        "4": "2.5Y 7/1",
        "5": "2.5Y 7/2",
        "6": "2.5Y 4/1"
      }
    }
jjmaynard commented 5 days ago

@DerekCaelin This is an issue with missing data in the SSURGO database. SoilWeb returns missing LCC fields for this particular component.

DerekCaelin commented 5 days ago

So, there is not an issue with the algorithm. We should figure out how to present this lack of information from SSURGO. Jon will reach out to SSURGO asking how we should report missing LCC.

DerekCaelin commented 5 days ago

Derek to talk with @CourtneyLee333 about this.

CourtneyLee333 commented 4 days ago

In other places where our external sources are missing data we say "None Available". Do we need a different pattern here?

DerekCaelin commented 4 days ago

I'd be fine with that. It looks like the solution we are proposing is:

IF Soil ID LCC returns nan or none (e.g. for the "Cheshire" soil available at 41.65192, -72.68794) THEN display "Not available" - does that sound right?

CourtneyLee333 commented 4 days ago

If that makes sense to the soil scientists in the house, then yes. If there is a more nuanced message we can deliver that would be good to know.

DerekCaelin commented 3 days ago

@shrouxm could you take on the solution described above? ☝️