diff --git a/pyproject.toml b/pyproject.toml index cb46df5..6f22fb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,9 @@ pc = [ test = [ "pytest", "requests", - "pre-commit" + "pre-commit", + "stac-geoparquet[pgstac]", + "stac-geoparquet[pc]", ] diff --git a/stac_geoparquet/stac_geoparquet.py b/stac_geoparquet/stac_geoparquet.py index 95f3a2c..c1f10aa 100644 --- a/stac_geoparquet/stac_geoparquet.py +++ b/stac_geoparquet/stac_geoparquet.py @@ -80,7 +80,7 @@ def to_geodataframe(items: Sequence[dict[str, Any]]) -> geopandas.GeoDataFrame: for col in opt_columns: if col not in gdf.columns: columns.remove(col) - + gdf = pd.concat([gdf[columns], gdf.drop(columns=columns)], axis="columns") for k in ["type", "stac_version", "id", "collection"]: if k in gdf: diff --git a/tests/test_pgstac_reader.py b/tests/test_pgstac_reader.py index 4f6d9ba..9cdc8cc 100644 --- a/tests/test_pgstac_reader.py +++ b/tests/test_pgstac_reader.py @@ -148,11 +148,11 @@ def test_generate_endpoints(): ) endpoints = cfg.generate_endpoints() assert endpoints[0][0] == pd.Timestamp("2010-01-01 00:00:00+0000", tz="utc") - assert endpoints[-1][1] == pd.Timestamp("2021-01-01 00:00:00+0000", tz="utc") + assert endpoints[-1][1] >= pd.Timestamp("2021-01-01 00:00:00+0000", tz="utc") endpoints = cfg.generate_endpoints(since=pd.Timestamp("2018-01-01", tz="utc")) assert endpoints[0][0] == pd.Timestamp("2018-01-01 00:00:00+0000", tz="utc") - assert endpoints[-1][1] == pd.Timestamp("2021-01-01 00:00:00+0000", tz="utc") + assert endpoints[-1][1] >= pd.Timestamp("2021-01-01 00:00:00+0000", tz="utc") @pytest.mark.parametrize( diff --git a/tests/test_stac_geoparquet.py b/tests/test_stac_geoparquet.py index 1b3256b..7cd1b78 100644 --- a/tests/test_stac_geoparquet.py +++ b/tests/test_stac_geoparquet.py @@ -252,8 +252,10 @@ def test_s1_grd(): # pystac migrates EO extension to latest version, but PC is still on 1.0.0 for i, ext in enumerate(item["stac_extensions"]): if ext == "https://stac-extensions.github.io/eo/v1.0.0/schema.json": - item["stac_extensions"][i] = "https://stac-extensions.github.io/eo/v1.1.0/schema.json" - + item["stac_extensions"][ + i + ] = "https://stac-extensions.github.io/eo/v1.1.0/schema.json" + item["geometry"] = fix_empty_multipolygon(item["geometry"]).__geo_interface__ df = stac_geoparquet.to_geodataframe([item])