SW1Dto2D 0.0.4__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {SW1Dto2D-0.0.4/SW1Dto2D.egg-info → SW1Dto2D-0.0.6}/PKG-INFO +1 -1
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6/SW1Dto2D.egg-info}/PKG-INFO +1 -1
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/sw1dto2d/__init__.py +4 -1
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/sw1dto2d/sw1dto2d.py +14 -4
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/.github/workflows/cicd.yml +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/.gitignore +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/LICENSE +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/README.md +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/SW1Dto2D.egg-info/SOURCES.txt +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/SW1Dto2D.egg-info/dependency_links.txt +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/SW1Dto2D.egg-info/requires.txt +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/SW1Dto2D.egg-info/top_level.txt +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/pyproject.toml +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/pytest.ini +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/setup.cfg +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/setup.py +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/__init__.py +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/brahmaputra/brahmaputra_results.csv +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/brahmaputra/centerline.dbf +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/brahmaputra/centerline.prj +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/brahmaputra/centerline.shp +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/brahmaputra/centerline.shx +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/garonne/Garonne2019_results_selection.csv +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/garonne/__init__.py +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/garonne/centerline.dbf +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/garonne/centerline.prj +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/garonne/centerline.shp +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/data/garonne/centerline.shx +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/test_basic_processes.py +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/test_brahmaputra.py +0 -0
- {SW1Dto2D-0.0.4 → SW1Dto2D-0.0.6}/tests/test_garonne.py +0 -0
|
@@ -88,7 +88,7 @@ class SW1Dto2D:
|
|
|
88
88
|
|
|
89
89
|
return self._curv_abscissa
|
|
90
90
|
|
|
91
|
-
def compute_xs_parameters(self, dx: float = None, optimize_normals: bool = True, enforce_length: bool = True):
|
|
91
|
+
def compute_xs_parameters(self, dx: float = None, optimize_normals: bool = True, enforce_length: bool = True, optimize_normals_maxiter: int=1000):
|
|
92
92
|
"""
|
|
93
93
|
Compute cross-sections parameters (coordinates and normals)
|
|
94
94
|
|
|
@@ -97,6 +97,7 @@ class SW1Dto2D:
|
|
|
97
97
|
dx : Resampling spacing (in curvilinear axis)
|
|
98
98
|
optimize_normals : True to optimize normals to prevent cutlines instersections
|
|
99
99
|
enforce_length : True to enforce length of the centerline to the total distance computed from xs
|
|
100
|
+
optimize_normals_maxiter : Maximum number of iteration for normals optimization
|
|
100
101
|
"""
|
|
101
102
|
|
|
102
103
|
logging.info("-" * 60)
|
|
@@ -133,7 +134,7 @@ class SW1Dto2D:
|
|
|
133
134
|
# Optimize normals
|
|
134
135
|
if optimize_normals is True:
|
|
135
136
|
# xs_normals, intersect_flag = self._optimize_xs_normals(xs_coords, xs_normals)
|
|
136
|
-
xs_normals, _ = self._optimize_xs_normals(xs_coords, xs_normals)
|
|
137
|
+
xs_normals, _ = self._optimize_xs_normals(xs_coords, xs_normals, maxiter=optimize_normals_maxiter)
|
|
137
138
|
|
|
138
139
|
self._curv_absc_normals = xs_normals
|
|
139
140
|
self._curv_absc_coords = xs_coords
|
|
@@ -231,7 +232,7 @@ class SW1Dto2D:
|
|
|
231
232
|
return np.stack((xs_nx, xs_ny), axis=-1)
|
|
232
233
|
|
|
233
234
|
def _optimize_xs_normals( # noqa: C901
|
|
234
|
-
self, xs_coords: np.ndarray, xs_normals: np.ndarray
|
|
235
|
+
self, xs_coords: np.ndarray, xs_normals: np.ndarray, maxiter: int=1000
|
|
235
236
|
) -> Tuple[np.ndarray, np.ndarray]:
|
|
236
237
|
"""
|
|
237
238
|
Optimize normals by filtering to prevent intersections
|
|
@@ -240,6 +241,7 @@ class SW1Dto2D:
|
|
|
240
241
|
----------
|
|
241
242
|
xs_coords : array of coordinates of the cross-sections
|
|
242
243
|
xs_normals : array of normals of the cross-sections
|
|
244
|
+
maxiter : Maximum number of iterations
|
|
243
245
|
|
|
244
246
|
Return
|
|
245
247
|
------
|
|
@@ -262,7 +264,11 @@ class SW1Dto2D:
|
|
|
262
264
|
Wmax = np.interp(self._curv_abscissa, self._curv_abscissa_base, Wmax)
|
|
263
265
|
|
|
264
266
|
nintersect = 1
|
|
265
|
-
|
|
267
|
+
iter = 0
|
|
268
|
+
while nintersect > 0 and iter < maxiter:
|
|
269
|
+
|
|
270
|
+
iter += 1
|
|
271
|
+
|
|
266
272
|
# Compute cross-sections lines
|
|
267
273
|
xs_lines = []
|
|
268
274
|
|
|
@@ -365,6 +371,10 @@ class SW1Dto2D:
|
|
|
365
371
|
xs_normals[:, 0] = np.sin(angles * np.pi / 180.0)
|
|
366
372
|
xs_normals[:, 1] = np.cos(angles * np.pi / 180.0)
|
|
367
373
|
|
|
374
|
+
if iter >= maxiter:
|
|
375
|
+
logging.error("Optimisation failed: maximum iterations reached.")
|
|
376
|
+
else:
|
|
377
|
+
logging.info("Optimisation successful (%i iterations)." % iter)
|
|
368
378
|
logging.info("")
|
|
369
379
|
|
|
370
380
|
return xs_normals, intersect_flag
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|