Skip to content

Commit 5d76a16

Browse files
Merge pull request #34 from mitrefireline/add-geopy-and-fix-tests
Add geopy and fix tests
2 parents 6ff9ebe + 3dc2def commit 5d76a16

File tree

6 files changed

+53
-17
lines changed

6 files changed

+53
-17
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Build Coverage File
4343
run: |
4444
export PATH=$PATH:$HOME/.local/bin
45-
poetry run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=simfire | tee pytest-coverage.txt
45+
poetry run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=simfire --no-cov-on-fail simfire | tee pytest-coverage.txt
4646
4747
- name: Comment on PR with Coverage
4848
continue-on-error: true # To let people create forked PRs

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ keywords:
4444
- fire
4545
- python
4646
license: Apache-2.0
47-
version: 2.0.0
47+
version: 2.0.1
4848
date-released: '2024-07-08'

poetry.lock

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "simfire"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
description = "Fire simulator built in Python"
55
authors = ["Tim Welsh <twelsh@mitre.org>", "Marissa Dotter <mdotter@mitre.org>",
66
"Michael Doyle <mdoyle@mitre.org>", "Dhanuj Gandikota <dgandikota@mitre.org>",
@@ -33,6 +33,7 @@ imagecodecs = "^2023.7.10"
3333
landfire = "^0.5.0"
3434
geotiff = "^0.2.10"
3535
geopandas = "^0.14.4"
36+
geopy = "^2.4.1"
3637

3738
[tool.poetry.group.coverage.dependencies]
3839
pytest-cov = "^3.0.0"

simfire/game/_tests/test_sprites.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_non_headless(self) -> None:
192192
)
193193

194194
rgba = sprite.image.get_at((0, 0))
195-
valid_rgba = (155, 118, 83, 255)
195+
valid_rgba = (255, 0, 0, 255)
196196
self.assertEqual(
197197
rgba,
198198
valid_rgba,
@@ -242,7 +242,7 @@ def test_non_headless(self) -> None:
242242
)
243243

244244
rgba = sprite.image.get_at((0, 0))
245-
valid_rgba = (139, 125, 58, 255)
245+
valid_rgba = (255, 0, 0, 255)
246246
self.assertEqual(
247247
rgba,
248248
valid_rgba,

simfire/world/_tests/test_rothermel.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
from ..rothermel import compute_rate_of_spread
99

1010
KNOWN_ROTHERMEL_OUTPUT = [
11-
1087.6337458150563,
12-
1087.6337458150563,
13-
1087.6337458150563,
14-
1087.6337458150563,
15-
391.63742469666437,
16-
391.63742469666437,
17-
391.63742469666437,
18-
391.63742469666437,
11+
1059.7013711275968,
12+
1059.7013711275968,
13+
1059.7013711275968,
14+
1059.7013711275968,
15+
382.0360259132064,
16+
382.0360259132064,
17+
382.0360259132064,
18+
382.0360259132064,
1919
]
2020

2121

@@ -51,10 +51,10 @@ def test_compute_rate_of_spread(self) -> None:
5151
el_fn = np.vectorize(flat())
5252
elevations = el_fn(X, Y).astype(np.float32)
5353

54-
grad_x, grad_y = np.gradient(elevations)
55-
slope_mag = (grad_x**2 + grad_y**2) ** 0.5
54+
grad_y, grad_x = np.gradient(elevations, 1)
55+
slope_mag = np.sqrt(grad_x**2 + grad_y**2)
5656
slope_mag = slope_mag[new_loc_y, new_loc_x]
57-
slope_dir = np.tan(grad_y / (grad_x + 1e-6))
57+
slope_dir = np.arctan2(grad_y, grad_x + 0.000001)
5858
slope_dir = slope_dir[new_loc_y, new_loc_x]
5959

6060
loc_x = np.array(new_loc_x, dtype=np.float32)
@@ -96,4 +96,5 @@ def test_compute_rate_of_spread(self) -> None:
9696
slope_mag,
9797
slope_dir,
9898
)
99-
self.assertListEqual(R.tolist(), KNOWN_ROTHERMEL_OUTPUT)
99+
for i, r in enumerate(R.tolist()):
100+
self.assertAlmostEqual(r, KNOWN_ROTHERMEL_OUTPUT[i], places=2)

0 commit comments

Comments
 (0)