-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed missing crs var in saved network (#719)
* fixed missing crs var in saved network * simplified calcdist_fromlatlon in polyline_mapslice * added unittest for polyline_mapslice * updated whatsnew
- Loading branch information
1 parent
f921fcc
commit 1bd1cd5
Showing
6 changed files
with
67 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Wed Dec 13 12:17:41 2023 | ||
@author: veenstra | ||
""" | ||
|
||
|
||
import pytest | ||
import numpy as np | ||
import dfm_tools as dfmt | ||
|
||
|
||
@pytest.mark.unittest | ||
def test_polyline_mapslice(): | ||
uds = dfmt.data.fm_curvedbend_map() | ||
timestep = 72 | ||
line_array = np.array([[ 104.15421399, 2042.7077107 ], | ||
[2913.47878063, 2102.48057382]]) | ||
|
||
uds_crs = dfmt.polyline_mapslice(uds.isel(time=timestep), line_array) | ||
assert len(uds_crs.grid.node_x) == 720 | ||
assert uds_crs.grid.face_node_connectivity.shape == (180, 4) | ||
assert np.isclose(uds_crs.grid.node_x.min(), 484.02691589067194) | ||
assert np.isclose(uds_crs.grid.node_x.max(), 1737.0864257281437) | ||
assert np.isclose(uds_crs.grid.node_y.min(), -5) | ||
assert np.isclose(uds_crs.grid.node_y.max(), 0.9261683648147339) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters