tilupy 0.1.4__py3-none-any.whl → 1.0.0__py3-none-any.whl
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.
Potentially problematic release.
This version of tilupy might be problematic. Click here for more details.
- tilupy/calibration.py +29 -32
- tilupy/cmd.py +114 -60
- tilupy/initdata.py +36 -0
- tilupy/make_mass.py +108 -0
- tilupy/make_topo.py +415 -0
- tilupy/models/shaltop/initsimus.py +168 -55
- tilupy/models/shaltop/read.py +319 -164
- tilupy/notations.py +332 -47
- tilupy/plot.py +472 -175
- tilupy/read.py +817 -235
- tilupy/utils.py +99 -71
- {tilupy-0.1.4.dist-info → tilupy-1.0.0.dist-info}/METADATA +3 -2
- tilupy-1.0.0.dist-info/RECORD +26 -0
- {tilupy-0.1.4.dist-info → tilupy-1.0.0.dist-info}/WHEEL +1 -1
- tilupy-0.1.4.dist-info/RECORD +0 -24
- {tilupy-0.1.4.dist-info → tilupy-1.0.0.dist-info}/LICENSE +0 -0
- {tilupy-0.1.4.dist-info → tilupy-1.0.0.dist-info}/entry_points.txt +0 -0
- {tilupy-0.1.4.dist-info → tilupy-1.0.0.dist-info}/top_level.txt +0 -0
tilupy/utils.py
CHANGED
|
@@ -11,45 +11,47 @@ import matplotlib.pyplot as plt
|
|
|
11
11
|
import shapely.geometry as geom
|
|
12
12
|
import shapely.ops
|
|
13
13
|
|
|
14
|
+
|
|
14
15
|
def CSI(pred, obs):
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def diff_runout(
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
ipred = pred > 0
|
|
17
|
+
iobs = obs > 0
|
|
18
|
+
|
|
19
|
+
TP = np.sum(ipred * iobs)
|
|
20
|
+
FP = np.sum(ipred * ~iobs)
|
|
21
|
+
FN = np.sum(~ipred * iobs)
|
|
22
|
+
|
|
23
|
+
return TP / (TP + FP + FN)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def diff_runout(
|
|
27
|
+
x_contour, y_contour, point_ref, section=None, orientation="W-E"
|
|
28
|
+
):
|
|
28
29
|
npts = len(x_contour)
|
|
29
|
-
contour = geom.LineString(
|
|
30
|
-
|
|
30
|
+
contour = geom.LineString(
|
|
31
|
+
[(x_contour[i], y_contour[i]) for i in range(npts)]
|
|
32
|
+
)
|
|
31
33
|
point = geom.Point(point_ref)
|
|
32
34
|
if section is None:
|
|
33
35
|
return point.distance(contour)
|
|
34
36
|
elif isinstance(section, np.ndarray):
|
|
35
37
|
section = geom.LineString(section)
|
|
36
|
-
|
|
37
|
-
assert
|
|
38
|
+
|
|
39
|
+
assert isinstance(section, geom.LineString)
|
|
38
40
|
section = revert_line(section, orientation)
|
|
39
41
|
intersections = section.intersection(contour)
|
|
40
42
|
if isinstance(intersections, geom.MultiPoint):
|
|
41
43
|
intersections = geom.LineString(section.intersection(contour))
|
|
42
44
|
intersections = np.array(intersections.coords)
|
|
43
|
-
if orientation ==
|
|
44
|
-
i = np.argmax(intersections[:,0])
|
|
45
|
-
if orientation ==
|
|
46
|
-
i = np.argmin(intersections[:,0])
|
|
47
|
-
if orientation ==
|
|
48
|
-
i = np.argmax(intersections[:,1])
|
|
49
|
-
if orientation ==
|
|
50
|
-
i = np.argmin(intersections[:,1])
|
|
51
|
-
intersection = geom.Point(intersections[i
|
|
52
|
-
|
|
45
|
+
if orientation == "W-E":
|
|
46
|
+
i = np.argmax(intersections[:, 0])
|
|
47
|
+
if orientation == "E-W":
|
|
48
|
+
i = np.argmin(intersections[:, 0])
|
|
49
|
+
if orientation == "S-N":
|
|
50
|
+
i = np.argmax(intersections[:, 1])
|
|
51
|
+
if orientation == "N-S":
|
|
52
|
+
i = np.argmin(intersections[:, 1])
|
|
53
|
+
intersection = geom.Point(intersections[i, :])
|
|
54
|
+
|
|
53
55
|
#######
|
|
54
56
|
# plt.figure()
|
|
55
57
|
# cont = np.array(contour.coords)
|
|
@@ -61,71 +63,97 @@ def diff_runout(x_contour, y_contour, point_ref, section=None,
|
|
|
61
63
|
# pt[:,0], pt[:,1], 'o',
|
|
62
64
|
# inter[:,0], inter[:,1],'x')
|
|
63
65
|
#######
|
|
64
|
-
|
|
66
|
+
|
|
65
67
|
return section.project(intersection) - section.project(point)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def revert_line(line, orientation="W-E"):
|
|
69
71
|
pt_init = line.coords[0]
|
|
70
72
|
pt_end = line.coords[-1]
|
|
71
|
-
if orientation ==
|
|
72
|
-
if pt_init[0]>pt_end[0]:
|
|
73
|
+
if orientation == "W-E":
|
|
74
|
+
if pt_init[0] > pt_end[0]:
|
|
73
75
|
line = shapely.ops.substring(line, 1, 0, normalized=True)
|
|
74
|
-
elif orientation ==
|
|
75
|
-
if pt_init[0]<pt_end[0]:
|
|
76
|
+
elif orientation == "E-W":
|
|
77
|
+
if pt_init[0] < pt_end[0]:
|
|
76
78
|
line = shapely.ops.substring(line, 1, 0, normalized=True)
|
|
77
|
-
if orientation ==
|
|
78
|
-
if pt_init[1]>pt_end[1]:
|
|
79
|
+
if orientation == "S-N":
|
|
80
|
+
if pt_init[1] > pt_end[1]:
|
|
79
81
|
line = shapely.ops.substring(line, 1, 0, normalized=True)
|
|
80
|
-
elif orientation ==
|
|
81
|
-
if pt_init[1]<pt_end[1]:
|
|
82
|
+
elif orientation == "N-S":
|
|
83
|
+
if pt_init[1] < pt_end[1]:
|
|
82
84
|
line = shapely.ops.substring(line, 1, 0, normalized=True)
|
|
83
|
-
|
|
85
|
+
|
|
84
86
|
return line
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
#Add sup_value at the border of the array, to make sure contour
|
|
89
|
-
#lines are closed
|
|
88
|
+
|
|
89
|
+
def get_contour(x, y, z, zlevels, indstep=1, maxdist=30, closed_contour=True):
|
|
90
|
+
# Add sup_value at the border of the array, to make sure contour
|
|
91
|
+
# lines are closed
|
|
90
92
|
if closed_contour:
|
|
91
93
|
z2 = z.copy()
|
|
92
94
|
ni = z2.shape[0]
|
|
93
95
|
nj = z2.shape[1]
|
|
94
96
|
z2 = np.vstack([np.zeros((1, nj)), z2, np.zeros((1, nj))])
|
|
95
|
-
z2 = np.hstack([np.zeros((ni+2, 1)), z2, np.zeros((ni+2, 1))])
|
|
96
|
-
dxi = x[1]-x[0]
|
|
97
|
-
dxf = x[-1]-x[-2]
|
|
97
|
+
z2 = np.hstack([np.zeros((ni + 2, 1)), z2, np.zeros((ni + 2, 1))])
|
|
98
|
+
dxi = x[1] - x[0]
|
|
99
|
+
dxf = x[-1] - x[-2]
|
|
98
100
|
dyi = y[1] - y[0]
|
|
99
101
|
dyf = y[-1] - y[-2]
|
|
100
|
-
x2 = np.insert(np.append(x, x[-1]+dxf), 0, x[0]-dxi)
|
|
101
|
-
y2 = np.insert(np.append(y, y[-1]+dyf), 0, y[0]-dyi)
|
|
102
|
+
x2 = np.insert(np.append(x, x[-1] + dxf), 0, x[0] - dxi)
|
|
103
|
+
y2 = np.insert(np.append(y, y[-1] + dyf), 0, y[0] - dyi)
|
|
102
104
|
else:
|
|
103
105
|
x2, y2, z2 = x, y, z
|
|
104
|
-
|
|
106
|
+
|
|
105
107
|
backend = plt.get_backend()
|
|
106
|
-
plt.switch_backend(
|
|
108
|
+
plt.switch_backend("Agg")
|
|
107
109
|
plt.figure()
|
|
108
|
-
ax=plt.gca()
|
|
109
|
-
cs=ax.contour(x2, y2, np.flip(z2, 0), zlevels)
|
|
110
|
-
nn1=1
|
|
111
|
-
v1=np.zeros((1,2))
|
|
112
|
-
xcontour={}
|
|
113
|
-
ycontour={}
|
|
110
|
+
ax = plt.gca()
|
|
111
|
+
cs = ax.contour(x2, y2, np.flip(z2, 0), zlevels)
|
|
112
|
+
nn1 = 1
|
|
113
|
+
v1 = np.zeros((1, 2))
|
|
114
|
+
xcontour = {}
|
|
115
|
+
ycontour = {}
|
|
114
116
|
for indlevel in range(len(zlevels)):
|
|
115
117
|
for p in cs.collections[indlevel].get_paths():
|
|
116
|
-
if
|
|
117
|
-
v1=p.vertices
|
|
118
|
-
nn1=p.vertices.shape[0]
|
|
119
|
-
xc = [v1[::indstep,0]]
|
|
120
|
-
yc = [v1[::indstep,1]]
|
|
118
|
+
if p.vertices.shape[0] > nn1:
|
|
119
|
+
v1 = p.vertices
|
|
120
|
+
nn1 = p.vertices.shape[0]
|
|
121
|
+
xc = [v1[::indstep, 0]]
|
|
122
|
+
yc = [v1[::indstep, 1]]
|
|
121
123
|
if maxdist is not None and not closed_contour:
|
|
122
|
-
ddx=np.abs(v1[0,0]-v1[-1,0])
|
|
123
|
-
ddy=np.abs(v1[0,1]-v1[-1,1])
|
|
124
|
-
dd=np.sqrt(ddx**2+ddy**2)
|
|
125
|
-
if
|
|
126
|
-
xc[0]=None
|
|
127
|
-
yc[0]=None
|
|
128
|
-
xcontour[zlevels[indlevel]]=xc[0]
|
|
129
|
-
ycontour[zlevels[indlevel]]=yc[0]
|
|
124
|
+
ddx = np.abs(v1[0, 0] - v1[-1, 0])
|
|
125
|
+
ddy = np.abs(v1[0, 1] - v1[-1, 1])
|
|
126
|
+
dd = np.sqrt(ddx**2 + ddy**2)
|
|
127
|
+
if dd > maxdist:
|
|
128
|
+
xc[0] = None
|
|
129
|
+
yc[0] = None
|
|
130
|
+
xcontour[zlevels[indlevel]] = xc[0]
|
|
131
|
+
ycontour[zlevels[indlevel]] = yc[0]
|
|
130
132
|
plt.switch_backend(backend)
|
|
131
|
-
return xcontour,ycontour
|
|
133
|
+
return xcontour, ycontour
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def format_path_linux(path):
|
|
137
|
+
"""
|
|
138
|
+
Change a Windows-type path to a path formatted for Linux. \\ are changed
|
|
139
|
+
to /, and partitions like "C:" are changed to "/mnt/c/"
|
|
140
|
+
|
|
141
|
+
Parameters
|
|
142
|
+
----------
|
|
143
|
+
path : string
|
|
144
|
+
String with the path to be modified.
|
|
145
|
+
|
|
146
|
+
Returns
|
|
147
|
+
-------
|
|
148
|
+
path2 : string
|
|
149
|
+
Formatted path.
|
|
150
|
+
|
|
151
|
+
"""
|
|
152
|
+
if path[1] == ":":
|
|
153
|
+
path2 = "/mnt/{:s}/".format(path[0].lower()) + path[2:]
|
|
154
|
+
else:
|
|
155
|
+
path2 = path
|
|
156
|
+
path2 = path2.replace("\\", "/")
|
|
157
|
+
if " " in path2:
|
|
158
|
+
path2 = '"' + path2 + '"'
|
|
159
|
+
return path2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tilupy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Thin-layer models unified processing tool
|
|
5
5
|
Author-email: Marc Peruzzetto <m.peruzzetto@brgm.fr>
|
|
6
6
|
License: CeCILL-C FREE SOFTWARE LICENSE AGREEMENT
|
|
@@ -529,6 +529,7 @@ Description-Content-Type: text/markdown
|
|
|
529
529
|
License-File: LICENSE
|
|
530
530
|
Requires-Dist: seaborn
|
|
531
531
|
Requires-Dist: requests
|
|
532
|
+
Requires-Dist: scipy
|
|
532
533
|
Provides-Extra: dev
|
|
533
534
|
Requires-Dist: pipreqs ; extra == 'dev'
|
|
534
535
|
Provides-Extra: gis
|
|
@@ -559,7 +560,7 @@ It contains one submodule per thin-layer model for writing and reading raw input
|
|
|
559
560
|
Outputs are then easily compared between different simulations / models. The models themselves are not part of this package and must
|
|
560
561
|
be installed separately.
|
|
561
562
|
|
|
562
|
-
Note that `tilupy` is still under development, thus only minimal documentation is available at the moment and testing is underway.
|
|
563
|
+
Note that `tilupy` is still under development, thus only minimal documentation is available at the moment, and testing is underway.
|
|
563
564
|
Contributions are feedback are most welcome. Reading and writing is available for the `SHALTOP` model (most commonly used by the author) and `r.avaflow`
|
|
564
565
|
(only partly maintained).
|
|
565
566
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
tilupy/__init__.py,sha256=4r-aUNht-u_rUoYIyz3BOFEew11xCURWpSRYEfc8Dis,515
|
|
2
|
+
tilupy/calibration.py,sha256=AGZq1YMI60d0RYzto1xdXglZ8DfSRCfo5gCAHzvwfwg,3318
|
|
3
|
+
tilupy/cmd.py,sha256=Ly5HArNtgpZJ1IBBwjgpgJjcvMc_Pf9iQz2azEZZtk8,4046
|
|
4
|
+
tilupy/compare.py,sha256=5PkDmMen_-yJImowvFJYB3IV0x0xs9WSFAYhX81wFLg,6294
|
|
5
|
+
tilupy/download_data.py,sha256=D_R9l5XtgsmxEoKOXXPlWFV6q3e9SMa7asRRy-blQvw,1057
|
|
6
|
+
tilupy/initdata.py,sha256=3vk-pw5IzCOKimBrGiT1iBxtqp2aJ9uqAY3GN7LFPYw,2579
|
|
7
|
+
tilupy/make_mass.py,sha256=XM4HzwVLho_QDZzoXxVQCVJwNeMWawg-nRaDxiN9vW0,3442
|
|
8
|
+
tilupy/make_topo.py,sha256=6fby5Zkl657pNgPFNWFF37-sORQvyBKsYn9atKESB_I,14302
|
|
9
|
+
tilupy/notations.py,sha256=nSv49NbhlhD-zMBWFE6vk1UojCMH1R05oqrV8_6bCqk,10390
|
|
10
|
+
tilupy/plot.py,sha256=O4eF71mYfX0YmzqsBvwIQTFVLhg4HZCFq4NedeqFyxs,21252
|
|
11
|
+
tilupy/raster.py,sha256=4d_-RWGHHO0ZXkjwaHPEOBxPjb36HW8ISq_7z32sgQg,3605
|
|
12
|
+
tilupy/read.py,sha256=Z93_zbaJ1bhnSibyQHA_aCWWge62zZy9WPTGKM5TPNA,27178
|
|
13
|
+
tilupy/utils.py,sha256=N3qGhjOvVoQl9ySqxNsUzpE0W0gin1v6z94v-2Mya0Q,4705
|
|
14
|
+
tilupy/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
tilupy/models/ravaflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
tilupy/models/ravaflow/initsimus.py,sha256=VCr_k2HuYecbX7KYS54FtY109OCzlslJ9pY1J1_iWNQ,5104
|
|
17
|
+
tilupy/models/ravaflow/read.py,sha256=xKuMFRHyC0SV6QubMOcQ9EpJ3c843g2RKViDq7g-yHY,7900
|
|
18
|
+
tilupy/models/shaltop/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
tilupy/models/shaltop/initsimus.py,sha256=lmAr_rKozsv1CW0hfHsIi7me_X0ZuwG36F1cBdN0emE,8597
|
|
20
|
+
tilupy/models/shaltop/read.py,sha256=w6c-1eh-SEQ73_W9Gr2jUOGf0L2ElV6nRxncVsI4O3w,13161
|
|
21
|
+
tilupy-1.0.0.dist-info/LICENSE,sha256=bNrodROEaIAk5t7X7Db_7d2CjDfHBp_FjweStZO2gZk,21863
|
|
22
|
+
tilupy-1.0.0.dist-info/METADATA,sha256=_7us2zgoWLJ0LI9gSApA4AEHZnqNUqSEIEu6-oS8R18,41875
|
|
23
|
+
tilupy-1.0.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
24
|
+
tilupy-1.0.0.dist-info/entry_points.txt,sha256=jf71F8J1P5s-zVt5BIxKZDmCIaoUqryMCtT7tc3BkkA,104
|
|
25
|
+
tilupy-1.0.0.dist-info/top_level.txt,sha256=jhJY_A8Vzmqub_dVy0wPSfelUqFPjHMZOaepGVcrpxA,7
|
|
26
|
+
tilupy-1.0.0.dist-info/RECORD,,
|
tilupy-0.1.4.dist-info/RECORD
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
tilupy/__init__.py,sha256=4r-aUNht-u_rUoYIyz3BOFEew11xCURWpSRYEfc8Dis,515
|
|
2
|
-
tilupy/calibration.py,sha256=O3UT-H9-eebaDttAN7GCQ4QDXynCb4IvwXSs8dHsL0E,3424
|
|
3
|
-
tilupy/cmd.py,sha256=A_Xv9rq0e6vx4QIBQx_EunjDBKITXrZpQjQpjWu6tKA,4260
|
|
4
|
-
tilupy/compare.py,sha256=5PkDmMen_-yJImowvFJYB3IV0x0xs9WSFAYhX81wFLg,6294
|
|
5
|
-
tilupy/download_data.py,sha256=D_R9l5XtgsmxEoKOXXPlWFV6q3e9SMa7asRRy-blQvw,1057
|
|
6
|
-
tilupy/initdata.py,sha256=UmUMff9zIu8df0s5prV6DVBD-KzBqdTUfMDJiDDzmQI,1334
|
|
7
|
-
tilupy/notations.py,sha256=s4p9jsz0n2nXNxxVG5SU14j37b2kqYoIcTKvSehNOOI,3509
|
|
8
|
-
tilupy/plot.py,sha256=bD1MeZyTH3hOYwbqto2mn1v49aUI2dJvagGy2qKwUwY,16552
|
|
9
|
-
tilupy/raster.py,sha256=4d_-RWGHHO0ZXkjwaHPEOBxPjb36HW8ISq_7z32sgQg,3605
|
|
10
|
-
tilupy/read.py,sha256=vyhbqBeh3ade8sXcCZK8ZZIjjVX7Dr9E7h1JhwY8mZw,12602
|
|
11
|
-
tilupy/utils.py,sha256=P4OyIGggrUVC0aKqTlZuwGhUN-nyORI870S9QFWWJAA,4118
|
|
12
|
-
tilupy/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
tilupy/models/ravaflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
tilupy/models/ravaflow/initsimus.py,sha256=VCr_k2HuYecbX7KYS54FtY109OCzlslJ9pY1J1_iWNQ,5104
|
|
15
|
-
tilupy/models/ravaflow/read.py,sha256=xKuMFRHyC0SV6QubMOcQ9EpJ3c843g2RKViDq7g-yHY,7900
|
|
16
|
-
tilupy/models/shaltop/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
tilupy/models/shaltop/initsimus.py,sha256=X0FSwwDSHWh-ODEu_zTZMCpB4cR4yFQpiDAF5ufNXxM,4600
|
|
18
|
-
tilupy/models/shaltop/read.py,sha256=LetbNT19KvOJx0gdMOnlHxr0KlAg8TN3FmfBB9NIct0,9209
|
|
19
|
-
tilupy-0.1.4.dist-info/LICENSE,sha256=bNrodROEaIAk5t7X7Db_7d2CjDfHBp_FjweStZO2gZk,21863
|
|
20
|
-
tilupy-0.1.4.dist-info/METADATA,sha256=uP3gHp-Qq6dV7ydTSALDWiLh5r9AEJZ4XsTCblVw1QM,41853
|
|
21
|
-
tilupy-0.1.4.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
22
|
-
tilupy-0.1.4.dist-info/entry_points.txt,sha256=jf71F8J1P5s-zVt5BIxKZDmCIaoUqryMCtT7tc3BkkA,104
|
|
23
|
-
tilupy-0.1.4.dist-info/top_level.txt,sha256=jhJY_A8Vzmqub_dVy0wPSfelUqFPjHMZOaepGVcrpxA,7
|
|
24
|
-
tilupy-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|