techmatters / soil-id-algorithm

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

bug: crash "No objects to concatenate" #111

Closed shrouxm closed 5 months ago

shrouxm commented 5 months ago

Description

Some coordinates trigger a crash with the message "No objects to concatenate".

Steps To Reproduce

Query the algorithm with either of the following pairs of coordinates:

    {"lat": 40.79861, "lon": -112.35477},
    {"lat": 35.599180, "lon": -120.491439}

Expected behavior

The algorithm should return successfully.

Actual behavior

The algorithm crashes with the following output:

  File "/home/roux/terraso/soil-id-algorithm/soil_id/tests/us/test_us.py", line 52, in test_soil_location
    list_soils_result = list_soils(item["lon"], item["lat"])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/roux/terraso/soil-id-algorithm/soil_id/us_soil.py", line 115, in list_soils
    mucompdata_pd = process_distance_scores(mucompdata_pd, ExpCoeff)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/roux/terraso/soil-id-algorithm/soil_id/utils.py", line 1736, in process_distance_scores
    mucompdata_pd = pd.concat(mucompdata_comp_grps).reset_index(drop=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/roux/terraso/soil-id-algorithm/.venv/lib/python3.12/site-packages/pandas/core/reshape/concat.py", line 382, in concat
    op = _Concatenator(
         ^^^^^^^^^^^^^^
  File "/home/roux/terraso/soil-id-algorithm/.venv/lib/python3.12/site-packages/pandas/core/reshape/concat.py", line 445, in __init__
    objs, keys = self._clean_keys_and_objs(objs, keys)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/roux/terraso/soil-id-algorithm/.venv/lib/python3.12/site-packages/pandas/core/reshape/concat.py", line 507, in _clean_keys_and_objs
    raise ValueError("No objects to concatenate")
ValueError: No objects to concatenate

Additional context

The first coordinate is in a body of water, but the second coordinate is on land and has soil data associated (see on soilweb). I'm wondering if this is getting triggered because some associated soil series have "horizon data n/a"? Haven't seen that before on SoilWeb.