techmatters / soil-id-algorithm

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

bug: texture in output is sometimes `NaN` #110

Open shrouxm opened 3 months ago

shrouxm commented 3 months ago

Description

Sometimes the values for texture in the algorithm output are NaN. Ideally we would return empty string in this case instead of having multiple values for "missing" to handle downstream, although I'm also not sure if NaN indicates "missing" or is indicative of an actual bug somewhere.

Steps To Reproduce

Run the algorithm on the following coordinates:

{"latitude": 47.690602, "longitude": -122.116982}

Expected behavior

Texture values in the soil_list_json should be strings (empty or with a texture value).

Actual behavior

Some texture values are NaN. Here's an example output:

    {
      "id": {
        "name": "Mckenna",
        "component": "Mckenna",
        "score_loc": 0.015,
        "rank_loc": "8"
      },
      "site": {
        "siteData": {
          "mapunitID": "1389406",
          "componentID": "23930452",
          "componentKind": "Series",
          "dataSource": "SSURGO",
          "textureInfill": "No",
          "rfvInfill": "No",
          "componentPct": 5,
          "distance": 977.0,
          "minCompDistance": 977.0,
          "slope": 1.0,
          "nirrcapcl": "nan",
          "nirrcapscl": "None",
          "nirrcapunit": "None",
          "irrcapcl": "nan",
          "irrcapscl": "None",
          "irrcapunit": "None",
          "taxsubgrp": "Aquandic Epiaquepts",
          "sdeURL": "https://casoilresource.lawr.ucdavis.edu/sde/?series=norma",
          "seeURL": "https://casoilresource.lawr.ucdavis.edu/see/#norma"
        },
        "siteDescription": "Landscape--glacial drift plains\r\nLandform--depressions and drainageways\r\nSlope--0 to 5 percent\r\nParent material--alluvium over glacial drift\r\nMean annual precipitation--about 1100 mm\r\nMean annual temperature--about 10 degrees C\r\nDepth class--moderately deep to densic contact\r\nDrainage class--poorly drained\r\nSoil moisture regime--aquic\r\nSoil temperature regime--mesic\r\nSoil moisture subclass--typic"
      },
      "esd": {
        "ESD": {
          "ecoclassid": ["F002XA004WA"],
          "ecoclassname": ["Puget Lowlands Forest"],
          "esd_url": [""]
        }
      },
      "bottom_depth": { "0": 0 },
      "sand": { "0": NaN },
      "clay": { "0": NaN },
      "texture": { "0": NaN },
      "rock_fragments": { "0": 0 },
      "cec": { "0": "CEC" },
      "ph": { "0": "" },
      "ec": { "0": "" },
      "lab": { "0": ["", "", ""] },
      "munsell": { "0": "" }
    },