Skip to content

Commit

Permalink
TST: test wuhan on nightly and push to main
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfleis committed Dec 10, 2024
1 parent 5fade1e commit 3b3dcb7
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@
--cov-report term-missing \
--cov-report xml . \
--env_type ${{ matrix.environment-file }}
-m "not wuhan"
- name: run tests (Wuhan)
run: |
pytest \
neatnet/ \
--verbose \
-r a \
--numprocesses logical \
--color yes \
--cov neatnet \
--cov-append \
--cov-report term-missing \
--cov-report xml . \
--env_type ${{ matrix.environment-file }}
-m wuhan
if: ${{ github.event_name == 'push' }} || ${{ github.event_name == 'schedule' }} || ${{ github.event_name == 'workflow_dispatch' }}

- name: zip artifacts - Ubuntu & macOS
run: zip ci_artifacts.zip ci_artifacts -r
Expand Down
13 changes: 7 additions & 6 deletions data/generate_simplified.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
logging.info("")

fua_city = {
1133: "aleppo",
869: "auckland",
4617: "bucaramanga",
809: "douala",
1656: "liege",
4881: "slc",
# 1133: "aleppo",
# 869: "auckland",
# 4617: "bucaramanga",
# 809: "douala",
# 1656: "liege",
# 4881: "slc",
8989: "wuhan",
}

# dict of cityname: fua ID
Expand Down
Binary file added data/wuhan_8989/original.parquet
Binary file not shown.
Binary file added data/wuhan_8989/simplified.parquet
Binary file not shown.
26 changes: 26 additions & 0 deletions neatnet/tests/test_simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,29 @@ def test_simplify_network_full_fua(aoi, tol, known_length):
observed.drop(columns=["_status", "geometry"]),
)
pytest.geom_test(known, observed, tolerance=tol, aoi=aoi)


@pytest.mark.wuhan
def test_simplify_network_wuhan(aoi="wuhan_8989", tol=0.3, known_length=4_702_861):
known = geopandas.read_parquet(full_fua_data / aoi / "simplified.parquet")
observed = neatnet.simplify_network(
geopandas.read_parquet(full_fua_data / aoi / "original.parquet")
)
observed_length = observed.geometry.length.sum()
assert "highway" in observed.columns

# storing GH artifacts
artifact_dir = ci_artifacts / aoi
artifact_dir.mkdir(parents=True, exist_ok=True)
observed.to_parquet(artifact_dir / "simplified.parquet")

assert pytest.approx(observed_length, rel=0.0001) == known_length
assert observed.index.dtype == numpy.dtype("int64")

if pytest.ubuntu and pytest.env_type != "oldest":
assert_series_equal(known["_status"], observed["_status"])
assert_frame_equal(
known.drop(columns=["_status", "geometry"]),
observed.drop(columns=["_status", "geometry"]),
)
pytest.geom_test(known, observed, tolerance=tol, aoi=aoi)

0 comments on commit 3b3dcb7

Please sign in to comment.