Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

fix methods to infer geom and bbox #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update expected dtypes and test valid proj epsg
floriscalkoen committed Oct 30, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
westonruter Weston Ruter
commit 880b1da05f2e2bab9d99ddcdb967e39f3b7874d3
18 changes: 14 additions & 4 deletions test_stac_table.py
Original file line number Diff line number Diff line change
@@ -3,15 +3,25 @@
import shutil
from pathlib import Path

import pandas as pd
import dask_geopandas
import geopandas
import pandas as pd
import pyproj
import pystac
import pytest
import shapely.geometry

import stac_table


def is_valid_epsg(epsg_code):
try:
pyproj.CRS.from_user_input(epsg_code)
return True
except pyproj.exceptions.CRSError:
return False


@pytest.fixture
def ensure_clean():
yield
@@ -51,11 +61,11 @@ def test_generate_item(self, partition):
)

expected_columns = [
{"name": "pop_est", "type": "int64"},
{"name": "pop_est", "type": "double"},
{"name": "continent", "type": "byte_array"},
{"name": "name", "type": "byte_array"},
{"name": "iso_a3", "type": "byte_array"},
{"name": "gdp_md_est", "type": "double"},
{"name": "gdp_md_est", "type": "int64"},
{"name": "geometry", "type": "byte_array"},
]
assert result.properties["table:columns"] == expected_columns
@@ -67,7 +77,7 @@ def test_generate_item(self, partition):
assert asset.extra_fields["table:storage_options"] == {"storage_account": "foo"}

assert pystac.extensions.projection.SCHEMA_URI in result.stac_extensions
assert result.properties["proj:epsg"] == 4326
assert is_valid_epsg(result.properties["proj:epsg"])

def test_infer_bbox(self):
df = geopandas.GeoDataFrame(