Skip to content
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

fix: update soil id #1454

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ black==24.8.0 \
--hash=sha256:f490dbd59680d809ca31efdae20e634f3fae27fba3ce0ba3208333b713bc3920 \
--hash=sha256:fb6e2c0b86bbd43dee042e48059c9ad7830abd5c94b0bc518c0eeec57c3eddc1
# via -r requirements/dev.in
boto3==1.35.11 \
--hash=sha256:bdfb8dd2564e5cf2f5095fb8e3a0a4612202654c1196692dddd9bc48aadc7657 \
--hash=sha256:f5834dd908edda56c3da86b908693c7cd1c17c2f8150de736e9e90c56ecc78f6
boto3==1.35.14 \
--hash=sha256:7bc78d7140c353b10a637927fe4bc4c4d95a464d1b8f515d5844def2ee52cbd5 \
--hash=sha256:c3e138e9041d59cd34cdc28a587dfdc899dba02ea26ebc3e10fb4bc88e5cf31b
# via moto
botocore==1.35.14 \
--hash=sha256:24823135232f88266b66ae8e1d0f3d40872c14cd976781f7fe52b8f0d79035a0 \
Expand Down
22 changes: 9 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,13 @@ et-xmlfile==1.1.0 \
# via openpyxl
fiona==1.10.0 \
--hash=sha256:3529fd46d269ff3f70aeb9316a93ae95cf2f87d7e148a8ff0d68532bf81ff7ae
# via
# -r requirements/base.in
# geopandas
gdal==3.8.4 \
--hash=sha256:7c51e0ae7a7ccf43ad9e4bf435176baa9276653dfa16fd167c3632f6e7275207
# via -r requirements/base.in
gdal==3.9.2 \
--hash=sha256:cf9c1add09ce152975c94d48a1a89dd300c292e0761fd3d22a8071a98852e129
# via soil-id
geopandas==0.14.4 \
--hash=sha256:3bb6473cb59d51e1a7fe2dbc24a1a063fb0ebdeddf3ce08ddbf8c7ddc99689aa \
--hash=sha256:56765be9d58e2c743078085db3bd07dc6be7719f0dbe1dfdc1d705cb80be7c25
geopandas==1.0.1 \
--hash=sha256:01e147d9420cc374d26f51fc23716ac307f32b49406e4bd8462c07e82ed1d3d6 \
--hash=sha256:b8bf70a5534588205b7a56646e2082fb1de9a03599651b3d80c99ea4c2ca08ab
# via
# -r requirements/base.in
# soil-id
Expand Down Expand Up @@ -740,9 +738,7 @@ python-magic==0.4.27 \
pytz==2024.1 \
--hash=sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812 \
--hash=sha256:328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319
# via
# django-oauth-toolkit
# pandas
# via pandas
requests==2.32.3 \
--hash=sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760 \
--hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6
Expand Down Expand Up @@ -928,8 +924,8 @@ sniffio==1.3.1 \
# via
# anyio
# httpx
soil-id @ https://github.com/techmatters/soil-id-algorithm/archive/f91ebdf.zip \
--hash=sha256:5c6134a2a3b5a0485a3ef017b7069c79b32c38cfc8fed72704c67af532e5ea09
soil-id @ https://github.com/techmatters/soil-id-algorithm/archive/3faf689.zip \
--hash=sha256:dd714d05259fc3fada4d932ffda7cd68ae37e70c2fb29adeee96d0c67121b2b6
# via -r requirements/base.in
sqlparse==0.5.1 \
--hash=sha256:773dcbf9a5ab44a090f3441e2180efe2560220203dc2f8c0b0fa141e18b505e4 \
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ requests
rules
sentry-sdk[django]
shapely
soil-id @ https://github.com/techmatters/soil-id-algorithm/archive/f91ebdf.zip
soil-id @ https://github.com/techmatters/soil-id-algorithm/archive/3faf689.zip
2 changes: 2 additions & 0 deletions terraso_backend/apps/core/gis/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

logger = structlog.get_logger(__name__)

gpd.options.io_engine = "fiona"

supported_drivers["KML"] = "rw"
supported_drivers["LIBKML"] = "rw"
supported_drivers["GPX"] = "rw"
Expand Down
2 changes: 1 addition & 1 deletion terraso_backend/apps/soil_id/graphql/soil_id/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def resolve_ecological_site(ecological_site: dict):
return EcologicalSite(
name=ecological_site["ecoclassname"][0],
id=ecological_site["ecoclassid"][0],
url=ecological_site["esd_url"][0],
url=ecological_site["edit_url"][0],
)


Expand Down
2 changes: 2 additions & 0 deletions terraso_backend/tests/graphql/test_shared_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

from ..core.gis.test_parsers import KML_TEST_FILES

gpd.options.io_engine = "fiona"

pytestmark = pytest.mark.django_db


Expand Down
13 changes: 7 additions & 6 deletions terraso_backend/tests/soil_id/test_graphql_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"siteDescription": "The Randall series consists of very deep, poorly drained, very slowly permeable soils that formed in clayey lacustrine sediments derived from the Blackwater Draw Formation of Pleistocene age. These nearly level soils are on the floor of playa basins 3 to 15 m (10 to 50 ft) below the surrounding plain and range in size from 10 to more than 150 acres. Slope ranges from 0 to 1 percent. Mean annual precipitation is 483 mm (19 in), and mean annual temperature is 15 degrees C (59 degrees F).", # noqa: E501
},
"esd": {"ESD": {"ecoclassid": "", "ecoclassname": "", "esd_url": ""}},
"esd": {"ESD": {"ecoclassid": "", "ecoclassname": "", "edit_url": ""}},
"bottom_depth": {"0": 30, "1": 94, "2": 203},
"texture": {"0": "", "1": "Clay loam", "2": float("nan")},
"rock_fragments": {"0": 0, "1": "", "2": 0},
Expand Down Expand Up @@ -70,7 +70,7 @@
},
"siteDescription": "",
},
"esd": {"ESD": {"ecoclassid": "", "ecoclassname": "", "esd_url": ""}},
"esd": {"ESD": {"ecoclassid": "", "ecoclassname": "", "edit_url": ""}},
"bottom_depth": {"0": 30, "1": 97, "2": 147, "3": 203},
"sand": {"0": 49.1, "1": 48.9, "2": 48.7, "3": 52.5},
"clay": {"0": 20.2, "1": 27.6, "2": 32.1, "3": 29.8},
Expand Down Expand Up @@ -128,7 +128,7 @@
},
"siteDescription": "",
},
"esd": {"ESD": {"ecoclassid": "", "ecoclassname": "", "esd_url": ""}},
"esd": {"ESD": {"ecoclassid": "", "ecoclassname": "", "edit_url": ""}},
"bottom_depth": {"0": 30, "1": 97, "2": 147, "3": 203},
"sand": {"0": 50.9, "1": 48.9, "2": 48.7, "3": 52.5},
"clay": {"0": 19.1, "1": 27.6, "2": 32.1, "3": 29.8},
Expand Down Expand Up @@ -238,16 +238,17 @@ def test_resolve_soil_data():


def test_resolve_ecological_site():
assert resolve_ecological_site({"ecoclassid": "", "ecoclassname": "", "esd_url": ""}) is None
assert resolve_ecological_site({"ecoclassid": "", "ecoclassname": "", "edit_url": ""}) is None
assert (
resolve_ecological_site({"ecoclassid": [""], "ecoclassname": [""], "esd_url": [""]}) is None
resolve_ecological_site({"ecoclassid": [""], "ecoclassname": [""], "edit_url": [""]})
is None
)

result = resolve_ecological_site(
{
"ecoclassid": ["AX001X02X001"],
"ecoclassname": ["Mesic Udic Riparian Forest"],
"esd_url": [""],
"edit_url": [""],
}
)

Expand Down
Loading