From b23aece7074c38556e951b8e57ec481cd59a01d5 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Fri, 6 Sep 2024 16:57:19 -0400 Subject: [PATCH 1/3] fix: use fiona as pyogrio engine --- terraso_backend/apps/core/gis/parsers.py | 2 ++ terraso_backend/tests/graphql/test_shared_data.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/terraso_backend/apps/core/gis/parsers.py b/terraso_backend/apps/core/gis/parsers.py index 395800ca0..d76e1c56c 100644 --- a/terraso_backend/apps/core/gis/parsers.py +++ b/terraso_backend/apps/core/gis/parsers.py @@ -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" diff --git a/terraso_backend/tests/graphql/test_shared_data.py b/terraso_backend/tests/graphql/test_shared_data.py index 5add53eb1..9d0de8250 100644 --- a/terraso_backend/tests/graphql/test_shared_data.py +++ b/terraso_backend/tests/graphql/test_shared_data.py @@ -29,6 +29,8 @@ from ..core.gis.test_parsers import KML_TEST_FILES +gpd.options.io_engine = "fiona" + pytestmark = pytest.mark.django_db From 9338e0da4011f41cca90eb424bcd7ced45d98016 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Mon, 9 Sep 2024 16:58:54 -0400 Subject: [PATCH 2/3] build: update soild-id commit hash --- requirements-dev.txt | 6 +++--- requirements.txt | 22 +++++++++------------- requirements/base.in | 2 +- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index c54063dea..7a6ccf0bc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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 \ diff --git a/requirements.txt b/requirements.txt index 2e3b09e4b..91ecb4f91 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 @@ -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 @@ -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 \ diff --git a/requirements/base.in b/requirements/base.in index b1f7ecfaf..f3e37aaad 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -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 From 3d34165baeff617945870a54c5aeb0c78d11dcbc Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Mon, 9 Sep 2024 16:59:20 -0400 Subject: [PATCH 3/3] Revert "build: Revert "fix: update esd_url to edit_url (#1413)"" This reverts commit 3bc17beebc5682d11005637701d994f11ad3dfd7. --- .../apps/soil_id/graphql/soil_id/resolvers.py | 2 +- .../tests/soil_id/test_graphql_resolvers.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/terraso_backend/apps/soil_id/graphql/soil_id/resolvers.py b/terraso_backend/apps/soil_id/graphql/soil_id/resolvers.py index a34ada8fb..b4846167c 100644 --- a/terraso_backend/apps/soil_id/graphql/soil_id/resolvers.py +++ b/terraso_backend/apps/soil_id/graphql/soil_id/resolvers.py @@ -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], ) diff --git a/terraso_backend/tests/soil_id/test_graphql_resolvers.py b/terraso_backend/tests/soil_id/test_graphql_resolvers.py index 81ef094e5..61124fc06 100644 --- a/terraso_backend/tests/soil_id/test_graphql_resolvers.py +++ b/terraso_backend/tests/soil_id/test_graphql_resolvers.py @@ -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}, @@ -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}, @@ -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}, @@ -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": [""], } )