Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe9c348ee0 | ||
|
|
0d36ba188e | ||
|
|
5a6d55c2ca | ||
|
|
36ad9562eb | ||
|
|
bf06a9fe43 | ||
|
|
34c9fbd77a | ||
|
|
f4ca2650e5 | ||
|
|
1d0aded01d | ||
|
|
3322bafdca | ||
|
|
6a0f66c244 | ||
|
|
40757b949d | ||
|
|
b6c91f63f7 | ||
|
|
e36206b436 | ||
|
|
797a853b36 | ||
|
|
bdc5e35453 | ||
|
|
1bd05ee1c2 | ||
|
|
dc406147df | ||
|
|
87fa63d8f9 | ||
|
|
2355a14a0c | ||
|
|
69e94e978c | ||
|
|
97fafe9b9b | ||
|
|
312abc9501 | ||
|
|
ca8c7a23fd | ||
|
|
9d69d60ea8 | ||
|
|
7ab6db184d | ||
|
|
e72d06bf6f | ||
|
|
fbf342f1ad | ||
|
|
699e174b3d | ||
|
|
48f6c09436 | ||
|
|
bab2c33e38 | ||
|
|
c725e15015 | ||
|
|
3bad91ec37 | ||
|
|
ceaab3c2fc | ||
|
|
e183c5d1de | ||
|
|
dc73213bee | ||
|
|
2ed57fbbe0 | ||
|
|
4de04d1af8 | ||
|
|
7ae64d390f | ||
|
|
f56d87f648 | ||
|
|
6c65d84d5e | ||
|
|
490b5466da | ||
|
|
3805cc9932 | ||
|
|
b56172328e | ||
|
|
e4a012b5a3 | ||
|
|
3dfdc308e3 | ||
|
|
14a2abaebd | ||
|
|
d0afd0ed74 | ||
|
|
473aac4500 | ||
|
|
ad59afc4f5 | ||
|
|
3be2973032 | ||
|
|
b5a3ee7568 | ||
|
|
aad7d75fa6 | ||
|
|
70f1581a3b | ||
|
|
641003ded4 | ||
|
|
28526d8f91 | ||
|
|
416a807e5d | ||
|
|
e723b56e18 | ||
|
|
67b76a3113 | ||
|
|
1169f3cc94 | ||
|
|
82ab7b5429 | ||
|
|
9b3a281e35 | ||
|
|
00f0e39eda | ||
|
|
1e7e5b0328 | ||
|
|
8afd5023e9 | ||
|
|
100003ad90 | ||
|
|
7fd6e4469b | ||
|
|
793289dd80 | ||
|
|
ab10970025 | ||
|
|
3c9eccdfab | ||
|
|
6c4636917a | ||
|
|
56b170d767 | ||
|
|
318f6e9965 | ||
|
|
63f7095508 | ||
|
|
1965782348 | ||
|
|
a54bf30c3d | ||
|
|
1e245004c9 | ||
|
|
03c3c37435 | ||
|
|
19ad9c4d1a | ||
|
|
c183e5016c | ||
|
|
4790b9c071 | ||
|
|
770bb5f96f | ||
|
|
6319ac9310 | ||
|
|
b6f0c6f49a | ||
|
|
486ff5c239 | ||
|
|
73475220e9 | ||
|
|
852a3f58ff | ||
|
|
8b8aff7df1 | ||
|
|
e86111bd7a | ||
|
|
870cba5005 | ||
|
|
c5df959210 | ||
|
|
631e52b486 | ||
|
|
5e32082fcf | ||
|
|
8834afa4f3 | ||
|
|
0d88b954d8 | ||
|
|
46602227af | ||
|
|
99fe5e8f74 | ||
|
|
9e9f56ee65 | ||
|
|
cf53985fed | ||
|
|
0ace259d2d | ||
|
|
f73b9b06c0 | ||
|
|
906ed801c7 | ||
|
|
975f2027ed | ||
|
|
22f3823699 | ||
|
|
c81dfb3ccc | ||
|
|
2c8c2699ef | ||
|
|
7fd570c5a7 | ||
|
|
76ab3114f0 | ||
|
|
76975a85e0 | ||
|
|
7b9c725f04 | ||
|
|
6fea7baea2 | ||
|
|
9c2b2033ec | ||
|
|
f67b7c6f60 | ||
|
|
fb0f1ad866 | ||
|
|
2b1fa93ebe | ||
|
|
e3140763ba | ||
|
|
e60b388930 | ||
|
|
f4914934f2 | ||
|
|
7115632d30 | ||
|
|
52112a5413 | ||
|
|
07798bbf46 | ||
|
|
134c66d51c | ||
|
|
84cf693528 | ||
|
|
7ef2df8535 | ||
|
|
4d95e42d20 | ||
|
|
30702cb118 | ||
|
|
e930bcaa91 | ||
|
|
1e2432e298 | ||
|
|
1243b2dc88 | ||
|
|
f2b97b68bd | ||
|
|
2149fa0dcb | ||
|
|
6293c6206c | ||
|
|
f451731877 | ||
|
|
d74c78eff5 | ||
|
|
af347349e1 | ||
|
|
2f47b190ac | ||
|
|
655982e908 | ||
|
|
82eba020ac | ||
|
|
eb65ce4c1b | ||
|
|
691ec4f3bd | ||
|
|
c1069adc2f | ||
|
|
097b5eb7fc | ||
|
|
e965e2b4c1 | ||
|
|
d81f341303 | ||
|
|
1ea6fd7c54 | ||
|
|
3025c995b6 | ||
|
|
ecc75c45eb | ||
|
|
09dcf486d8 | ||
|
|
592c1e5dbc | ||
|
|
cd3baf2870 | ||
|
|
93734ff1b9 | ||
|
|
dfb7d37cfb | ||
|
|
83aa6a5791 | ||
|
|
45f020edaa | ||
|
|
ad1c5c487e | ||
|
|
5c323b28e2 | ||
|
|
da2250df3a | ||
|
|
cb1d6b4db7 | ||
|
|
f96cee145c | ||
|
|
e4670e4a4d | ||
|
|
5c0f90b43e | ||
|
|
e6de528b7f | ||
|
|
dfff8d2fcb | ||
|
|
33a1fd2b52 | ||
|
|
f083b7f6ef | ||
|
|
25de73812b | ||
|
|
6b232d2971 | ||
|
|
9c0ffa8356 | ||
|
|
ffbd2e2413 | ||
|
|
58300b8c1a | ||
|
|
cd2fda8224 | ||
|
|
73ae571de1 | ||
|
|
7aee4c64a3 | ||
|
|
c3cae35de4 | ||
|
|
2736d2f399 | ||
|
|
00afc6c06b | ||
|
|
4eefa88490 | ||
|
|
92e54bf11e | ||
|
|
c11350d49a | ||
|
|
8f5fb4cc3b | ||
|
|
fc7a7bb7fd | ||
|
|
5a1c363e8a | ||
|
|
77a6da3024 | ||
|
|
c4a66281f6 | ||
|
|
7ffc2482fc | ||
|
|
f37da68a67 | ||
|
|
f64ed131f9 | ||
|
|
79b31e8d08 | ||
|
|
d1c8e3e4f5 | ||
|
|
c253ad832d | ||
|
|
6081b09267 | ||
|
|
592c2c9a72 | ||
|
|
ce45776a63 | ||
|
|
02bbdf9fda | ||
|
|
6c9e90ceaf | ||
|
|
b99be5a280 | ||
|
|
1acd582de9 | ||
|
|
8ce5a4d215 | ||
|
|
ccb55ff4e1 | ||
|
|
3ef4b40558 | ||
|
|
c667d94e84 | ||
|
|
1b601460e6 | ||
|
|
7db65f127e | ||
|
|
f302e18d71 | ||
|
|
352c0beb27 | ||
|
|
d6561ab44d | ||
|
|
5d9b6f99c6 | ||
|
|
163a842384 | ||
|
|
eea355a784 | ||
|
|
1ab1cb37b0 | ||
|
|
be19a11387 | ||
|
|
062743d748 | ||
|
|
ac2a2002b7 | ||
|
|
6951b82339 | ||
|
|
e41c23120a | ||
|
|
4c5281ea30 | ||
|
|
7b7ba2eb37 | ||
|
|
4a43653d7f | ||
|
|
0307927fa9 | ||
|
|
db11c9d968 | ||
|
|
d85e5c4666 | ||
|
|
45ee8a9662 | ||
|
|
5ab06dbe51 | ||
|
|
d73e901a96 | ||
|
|
c17e39e3cf | ||
|
|
af4cce96ef | ||
|
|
0a780e5f78 | ||
|
|
fb2b1f680f | ||
|
|
6957986632 | ||
|
|
13d23502a9 | ||
|
|
5fa888768e | ||
|
|
07451899c4 | ||
|
|
2aa693e4ae | ||
|
|
ff480fb593 | ||
|
|
d6753dc986 | ||
|
|
2d2484d8fa | ||
|
|
bb97f1977b | ||
|
|
eb26eba131 | ||
|
|
2d3e214514 | ||
|
|
894a7c8477 | ||
|
|
21197ead23 | ||
|
|
d79a0cc973 | ||
|
|
a55669d181 | ||
|
|
2fd44fbfb4 | ||
|
|
962bfa945d | ||
|
|
65c1163a55 | ||
|
|
8d67442ca3 | ||
|
|
f7d2ac8b86 | ||
|
|
4f91de4c97 | ||
|
|
37b04961f1 | ||
|
|
0a63f16f62 | ||
|
|
92eb729a39 | ||
|
|
d891c9783d | ||
|
|
51858597cd | ||
|
|
8b3baf433f | ||
|
|
12e3d779c6 | ||
|
|
c6274890a7 | ||
|
|
907fc0c53a | ||
|
|
b4ee76416e | ||
|
|
a88b42a8ef | ||
|
|
08f01aee69 | ||
|
|
c69cbdb34e | ||
|
|
01fd7dbec8 | ||
|
|
2af9b0018c | ||
|
|
7f8e8d5a9f | ||
|
|
c9887a97e7 | ||
|
|
1a708921e3 | ||
|
|
9fe1b35a59 | ||
|
|
edf744eee1 | ||
|
|
e400980103 | ||
|
|
b12e935a5d | ||
|
|
1d4422e9c5 | ||
|
|
1a10da9c89 | ||
|
|
470eae8b92 | ||
|
|
9b53b4302b | ||
|
|
461202219d | ||
|
|
ddfaa3a73f | ||
|
|
3e531130fe | ||
|
|
595eb29c42 | ||
|
|
ccbbc83502 | ||
|
|
fd0a8ddf51 | ||
|
|
ce5808e3ce | ||
|
|
4dafa345b4 | ||
|
|
90776f0af9 | ||
|
|
32777456b9 | ||
|
|
dcaa7fafbd | ||
|
|
17eb3e8184 | ||
|
|
7bbca7cf54 | ||
|
|
3c738ebcb9 | ||
|
|
6522cea03f | ||
|
|
ea2dbfba3e | ||
|
|
8d92fbbdac | ||
|
|
77f06aaa07 | ||
|
|
b79c5b30c0 | ||
|
|
fdac834d48 | ||
|
|
4355be1a9c | ||
|
|
66f6d3505b | ||
|
|
65c261887c | ||
|
|
6c794d2eb4 | ||
|
|
51c912f3a8 |
No files matched your search
@@ -19,6 +19,8 @@ tmp
|
||||
*.pdf
|
||||
*.odt
|
||||
|
||||
!doc/**/*.pdf
|
||||
|
||||
doc/dev/images/auto_*
|
||||
doc/dev/documentation.*
|
||||
!doc/dev/*.org
|
||||
|
||||
@@ -26,6 +26,23 @@ stages:
|
||||
# DOWNLOADS #
|
||||
#############
|
||||
|
||||
variables:
|
||||
MAGE_VERSION: "v8.3.3"
|
||||
|
||||
dl-mage-doc:
|
||||
stage: downloads
|
||||
tags:
|
||||
- linux
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- mkdir -p doc
|
||||
- cd doc
|
||||
- curl -L -o mage8.pdf https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/$MAGE_VERSION/downloads/documents/Mage-8_Documentation.pdf
|
||||
artifacts:
|
||||
paths:
|
||||
- doc/mage8.pdf
|
||||
|
||||
dl-mage-linux:
|
||||
stage: downloads
|
||||
tags:
|
||||
@@ -33,7 +50,7 @@ dl-mage-linux:
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test6/downloads/packages/mage_linux.tgz
|
||||
- curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/$MAGE_VERSION/downloads/packages/mage_linux.tgz
|
||||
- mkdir -p mage-linux
|
||||
- cd mage-linux
|
||||
- tar xvf ../mage.tgz
|
||||
@@ -41,7 +58,8 @@ dl-mage-linux:
|
||||
paths:
|
||||
- mage-linux/mage
|
||||
- mage-linux/mage_extraire
|
||||
- mage-linux/mailleurPF
|
||||
- mage-linux/mailleurTT
|
||||
- mage-linux/libbief.so
|
||||
|
||||
dl-mage-windows:
|
||||
stage: downloads
|
||||
@@ -50,7 +68,7 @@ dl-mage-windows:
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test6/downloads/packages/mage_windows.tgz
|
||||
- curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/$MAGE_VERSION/downloads/packages/mage_windows.tgz
|
||||
- mkdir -p mage-windows
|
||||
- cd mage-windows
|
||||
- tar xvf ../mage.tgz
|
||||
@@ -58,7 +76,8 @@ dl-mage-windows:
|
||||
paths:
|
||||
- mage-windows/mage.exe
|
||||
- mage-windows/mage_extraire.exe
|
||||
- mage-windows/mailleurPF.exe
|
||||
- mage-windows/mailleurTT.exe
|
||||
- mage-windows/libbief.dll
|
||||
|
||||
#############
|
||||
# CONFIGURE #
|
||||
@@ -122,7 +141,7 @@ test-pep8:
|
||||
- pip3 install -r ./requirements.txt
|
||||
- pip3 install -U -r ./requirements.txt
|
||||
- pip3 install pycodestyle
|
||||
- pycodestyle ./src
|
||||
- pycodestyle --exclude="*_to_*.py" ./src
|
||||
allow_failure: true
|
||||
|
||||
#########
|
||||
@@ -146,6 +165,24 @@ build-users-doc:
|
||||
- doc/users/images/
|
||||
allow_failure: true
|
||||
|
||||
|
||||
build-td:
|
||||
stage: build
|
||||
tags:
|
||||
- linux
|
||||
needs:
|
||||
- job: set-version
|
||||
artifacts: true
|
||||
script:
|
||||
- cd ./doc/users/Tuto1/
|
||||
- ./build.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- doc/users/Tuto1/step-by-step.pdf
|
||||
- doc/users/Tuto1/pas-a-pas.pdf
|
||||
- doc/users/Tuto1/data/
|
||||
allow_failure: true
|
||||
|
||||
build-developers-doc:
|
||||
stage: build
|
||||
tags:
|
||||
@@ -186,6 +223,8 @@ build-linux:
|
||||
needs:
|
||||
- job: dl-mage-linux
|
||||
artifacts: true
|
||||
- job: dl-mage-doc
|
||||
artifacts: true
|
||||
- job: set-version
|
||||
artifacts: true
|
||||
- job: build-lang
|
||||
@@ -194,6 +233,8 @@ build-linux:
|
||||
artifacts: true
|
||||
- job: build-users-doc
|
||||
artifacts: true
|
||||
- job: build-td
|
||||
artifacts: true
|
||||
script:
|
||||
- mkdir -p linux
|
||||
- cd linux
|
||||
@@ -237,13 +278,25 @@ build-linux:
|
||||
- mkdir -p pamhyr/doc/
|
||||
- mkdir -p pamhyr/doc/images/
|
||||
- mkdir -p pamhyr/doc/html/
|
||||
- cp ../doc/users/documentation.pdf pamhyr/doc/Pamhyr2-users.pdf
|
||||
- cp ../doc/users/documentation.html pamhyr/doc/Pamhyr2-users.html
|
||||
# - cp ../doc/users/documentation.pdf pamhyr/doc/Pamhyr2-users.pdf
|
||||
# - cp ../doc/users/documentation.html pamhyr/doc/Pamhyr2-users.html
|
||||
- cp ../doc/mage8.pdf pamhyr/doc/mage8.pdf
|
||||
- cp ../doc/dev/documentation.pdf pamhyr/doc/Pamhyr2-dev.pdf
|
||||
- cp ../doc/dev/documentation.html pamhyr/doc/Pamhyr2-dev.html
|
||||
#- cp ../doc/users/images/* pamhyr/doc/images
|
||||
- cp ../doc/dev/images/* pamhyr/doc/images
|
||||
- cp ../doc/images/* pamhyr/doc/images
|
||||
- cp -r ../doc/dev/images/* pamhyr/doc/images
|
||||
- cp -r ../doc/images/* pamhyr/doc/images
|
||||
# Copy Tuto
|
||||
- mkdir -p pamhyr/doc/Tuto1/
|
||||
- mkdir -p pamhyr/doc/Tuto1/data
|
||||
- cp ../doc/users/Tuto1/Hogneau_Engees2022.pdf pamhyr/doc/Tuto1/Hogneau_Engees2022.pdf
|
||||
- cp ../doc/users/Tuto1/step-by-step.pdf pamhyr/doc/Tuto1/Tuto1-en.pdf
|
||||
- cp ../doc/users/Tuto1/pas-a-pas.pdf pamhyr/doc/Tuto1/Tuto1-fr.pdf
|
||||
- cp ../doc/users/Tuto1/*.pamhyr pamhyr/doc/Tuto1/
|
||||
- cp ../doc/users/Tuto1/data/* pamhyr/doc/Tuto1/data/
|
||||
# Copy TP charriage
|
||||
- mkdir -p pamhyr/doc/TP_charriage/
|
||||
- cp ../doc/users/TP_charriage/* pamhyr/doc/TP_charriage
|
||||
# Create running script
|
||||
- echo "#!/bin/sh" > pamhyr/Pamhyr2
|
||||
- echo "./pamhyr/pamhyr $@" >> pamhyr/Pamhyr2
|
||||
@@ -261,6 +314,8 @@ build-windows:
|
||||
needs:
|
||||
- job: dl-mage-windows
|
||||
artifacts: true
|
||||
- job: dl-mage-doc
|
||||
artifacts: true
|
||||
- job: set-version
|
||||
artifacts: true
|
||||
- job: build-lang
|
||||
@@ -269,6 +324,8 @@ build-windows:
|
||||
artifacts: true
|
||||
- job: build-users-doc
|
||||
artifacts: true
|
||||
- job: build-td
|
||||
artifacts: true
|
||||
script:
|
||||
- mkdir windows
|
||||
- cd windows
|
||||
|
||||
@@ -10,35 +10,50 @@ modelling of rivers.
|
||||
+ Define boundary conditions
|
||||
+ Define lateral contribution
|
||||
+ Edit river friction
|
||||
+ Add reservoirs
|
||||
+ Add hydraulic structures
|
||||
+ Generate initial conditions
|
||||
+ Edit river sedimentary layers
|
||||
+ Save the study in a unique file
|
||||
+ Run Mage 8 on a study and visualize results
|
||||
|
||||
Let see the
|
||||
[documentation](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home)
|
||||
for more details.
|
||||
|
||||
## Install
|
||||
|
||||
### GNU/Linux
|
||||
|
||||
Downloads [last
|
||||
Downloads the [last
|
||||
realease](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/releases/permalink/latest)
|
||||
GNU/Linux binary archive.
|
||||
|
||||
```shell
|
||||
tar xf pamhyr-gnulinux-amd64.tar.xz
|
||||
tar xf pamhyr-gnulinux.tar.xz
|
||||
cd pamhyr
|
||||
./pamhyr
|
||||
./Pamhyr2
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
Downloads [last
|
||||
Downloads the [last
|
||||
realease](https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/releases/permalink/latest)
|
||||
Windows installer.
|
||||
Windows installer or ZIP archive.
|
||||
|
||||
### From source code
|
||||
|
||||
```shell
|
||||
# Get source code
|
||||
# Get mage
|
||||
mkdir mage
|
||||
cd mage
|
||||
|
||||
curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/v8.3.2/downloads/packages/mage_linux.tgz
|
||||
tar xf mage.tgz
|
||||
|
||||
cd ..
|
||||
|
||||
# Get Pamhyr2 source code
|
||||
git clone https://gitlab.irstea.fr/theophile.terraz/pamhyr/
|
||||
cd pamhyr
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,4 @@
|
||||
#! /bin/sh
|
||||
|
||||
pdflatex -no-shell-escape step-by-step.tex
|
||||
pdflatex -no-shell-escape pas-a-pas.tex
|
||||
@@ -0,0 +1,442 @@
|
||||
1 0 0 8 31090.0000
|
||||
31090.0000 0.0000 23.7300
|
||||
31090.0000 2.5000 20.2800 rg
|
||||
31090.0000 2.5000 19.2900
|
||||
31090.0000 4.4000 19.2900
|
||||
31090.0000 10.7000 19.5900
|
||||
31090.0000 10.7000 20.5900 rd
|
||||
31090.0000 14.5000 21.7100
|
||||
31090.0000 17.6000 23.7300
|
||||
999.9990 999.9990 999.9990
|
||||
2 0 0 8 31165.0000
|
||||
31165.0000 0.0000 22.8400
|
||||
31165.0000 2.5000 20.1300 rg
|
||||
31165.0000 2.5000 19.2300
|
||||
31165.0000 4.4000 19.2300
|
||||
31165.0000 10.7000 19.5300
|
||||
31165.0000 10.7000 20.5300 rd
|
||||
31165.0000 14.5000 21.7500
|
||||
31165.0000 17.6000 23.5000
|
||||
999.9990 999.9990 999.9990
|
||||
3 0 0 10 31425.0000
|
||||
31425.0000 -1.0000 22.8000
|
||||
31425.0000 0.0000 21.9000
|
||||
31425.0000 1.7000 20.3600 rg
|
||||
31425.0000 2.5000 19.6300
|
||||
31425.0000 2.5000 19.0300
|
||||
31425.0000 4.4000 19.0300
|
||||
31425.0000 10.7000 19.3300
|
||||
31425.0000 10.7000 20.3300 rd
|
||||
31425.0000 14.5000 21.9200
|
||||
31425.0000 17.6000 23.4200
|
||||
999.9990 999.9990 999.9990
|
||||
4 0 0 10 31590.0000
|
||||
31590.0000 -1.0000 22.7500
|
||||
31590.0000 0.0000 22.0500
|
||||
31590.0000 1.6700 20.2200 rg
|
||||
31590.0000 2.5000 19.3100
|
||||
31590.0000 2.5000 18.9000
|
||||
31590.0000 4.4000 18.9000
|
||||
31590.0000 10.7000 19.2000
|
||||
31590.0000 10.7000 20.2000 rd
|
||||
31590.0000 14.5000 22.0200
|
||||
31590.0000 17.6000 23.2500
|
||||
999.9990 999.9990 999.9990
|
||||
5 0 0 10 31780.0000
|
||||
31780.0000 -1.0000 22.7000
|
||||
31780.0000 0.0000 22.0500
|
||||
31780.0000 1.6000 20.0500 rg
|
||||
31780.0000 2.5000 18.9400
|
||||
31780.0000 2.5000 18.7500
|
||||
31780.0000 4.4000 18.7500
|
||||
31780.0000 10.7000 19.0500
|
||||
31780.0000 10.7000 20.0500 rd
|
||||
31780.0000 14.5000 22.1400
|
||||
31780.0000 17.6000 23.0000
|
||||
999.9990 999.9990 999.9990
|
||||
6 0 0 9 31874.0000
|
||||
31874.0000 0.0000 22.9900
|
||||
31874.0000 0.0000 22.6900
|
||||
31874.0000 2.5000 19.6900 rg
|
||||
31874.0000 2.5000 18.6900
|
||||
31874.0000 4.4000 18.6900
|
||||
31874.0000 10.7000 18.9900
|
||||
31874.0000 10.7000 19.9900 rd
|
||||
31874.0000 14.5000 22.1900
|
||||
31874.0000 17.6000 22.9900
|
||||
999.9990 999.9990 999.9990
|
||||
7 0 0 9 31875.0000 PontRD101m
|
||||
31875.0000 0.5400 23.0000
|
||||
31875.0000 0.5400 21.8900
|
||||
31875.0000 2.5000 19.6900 rg
|
||||
31875.0000 2.5000 18.6900
|
||||
31875.0000 4.4000 18.6900
|
||||
31875.0000 10.7000 18.9900
|
||||
31875.0000 10.7000 19.9900 rd
|
||||
31875.0000 13.8900 21.8900
|
||||
31875.0000 13.8900 23.0000
|
||||
999.9990 999.9990 999.9990
|
||||
8 0 0 9 31885.0000 PontRD101v
|
||||
31885.0000 0.5400 23.0000
|
||||
31885.0000 0.5400 21.8900
|
||||
31885.0000 2.5000 19.6900 rg
|
||||
31885.0000 2.5000 18.6900
|
||||
31885.0000 4.4000 18.6900
|
||||
31885.0000 10.7000 18.9900
|
||||
31885.0000 10.7000 19.9900 rd
|
||||
31885.0000 13.8900 21.8900
|
||||
31885.0000 13.8900 23.0000
|
||||
999.9990 999.9990 999.9990
|
||||
9 0 0 9 31886.0000
|
||||
31886.0000 0.0000 22.9900
|
||||
31886.0000 0.0000 22.6900
|
||||
31886.0000 2.5000 19.6900 rg
|
||||
31886.0000 2.5000 18.6900
|
||||
31886.0000 4.4000 18.6900
|
||||
31886.0000 10.7000 18.9900
|
||||
31886.0000 10.7000 19.9900 rd
|
||||
31886.0000 14.5000 22.1900
|
||||
31886.0000 17.6000 22.9900
|
||||
999.9990 999.9990 999.9990
|
||||
10 0 0 13 32015.0000
|
||||
32015.0000 0.0000 22.6400
|
||||
32015.0000 0.2000 22.2200
|
||||
32015.0000 1.3000 20.9900
|
||||
32015.0000 2.0000 19.8800 rg
|
||||
32015.0000 3.0000 18.6600
|
||||
32015.0000 3.0000 18.5800
|
||||
32015.0000 5.5000 18.5800
|
||||
32015.0000 10.0000 18.9100
|
||||
32015.0000 11.5000 19.2500
|
||||
32015.0000 11.5000 20.0800 rd
|
||||
32015.0000 15.1000 22.0600
|
||||
32015.0000 17.6000 22.5100
|
||||
32015.0000 18.0000 22.8100
|
||||
999.9990 999.9990 999.9990
|
||||
11 0 0 13 32205.0000
|
||||
32205.0000 0.0000 22.3300
|
||||
32205.0000 0.2000 22.1800
|
||||
32205.0000 1.5000 21.0600
|
||||
32205.0000 2.5000 19.7700 rg
|
||||
32205.0000 3.6000 18.5100
|
||||
32205.0000 3.6000 18.4500
|
||||
32205.0000 6.9000 18.4500
|
||||
32205.0000 8.8000 19.0500
|
||||
32205.0000 12.5000 19.5700 rd
|
||||
32205.0000 12.5000 20.1800
|
||||
32205.0000 15.8000 21.9000
|
||||
32205.0000 18.1000 22.4000
|
||||
32205.0000 18.6000 22.5500
|
||||
999.9990 999.9990 999.9990
|
||||
12 0 0 13 32460.0000
|
||||
32460.0000 0.0000 22.1500
|
||||
32460.0000 0.3000 22.1300
|
||||
32460.0000 1.8000 21.1600
|
||||
32460.0000 3.0000 19.6400 rg
|
||||
32460.0000 4.4000 18.3100
|
||||
32460.0000 4.4000 18.2800
|
||||
32460.0000 8.7000 18.2800
|
||||
32460.0000 10.4000 19.2400 rd
|
||||
32460.0000 13.7000 19.9900
|
||||
32460.0000 13.7000 20.3300
|
||||
32460.0000 16.8000 21.6800
|
||||
32460.0000 18.9000 22.2500
|
||||
32460.0000 19.3000 22.5500
|
||||
999.9990 999.9990 999.9990
|
||||
13 0 0 13 32655.0000
|
||||
32655.0000 0.0000 22.4500
|
||||
32655.0000 0.3000 22.0900
|
||||
32655.0000 2.1000 21.2300
|
||||
32655.0000 3.4000 19.5300 rg
|
||||
32655.0000 5.0000 18.1600
|
||||
32655.0000 5.0000 18.1400
|
||||
32655.0000 10.1000 18.1400
|
||||
32655.0000 11.6000 19.3900 rd
|
||||
32655.0000 14.7000 20.3100
|
||||
32655.0000 14.7000 20.4300
|
||||
32655.0000 17.5000 21.5200
|
||||
32655.0000 19.4000 22.1400
|
||||
32655.0000 19.8000 22.4500
|
||||
999.9990 999.9990 999.9990
|
||||
14 0 0 13 32755.0000
|
||||
32755.0000 0.0000 22.4500
|
||||
32755.0000 0.3000 22.0900
|
||||
32755.0000 2.1000 21.2300
|
||||
32755.0000 3.4000 19.5300 rg
|
||||
32755.0000 4.0000 18.0500
|
||||
32755.0000 5.0000 18.0100
|
||||
32755.0000 10.1000 18.0100
|
||||
32755.0000 13.0000 19.3900 rd
|
||||
32755.0000 14.7000 20.3100
|
||||
32755.0000 14.7000 20.4300
|
||||
32755.0000 17.5000 21.5200
|
||||
32755.0000 19.4000 22.1400
|
||||
32755.0000 19.8000 22.4500
|
||||
999.9990 999.9990 999.9990
|
||||
15 0 0 10 32770.0000 PontA2
|
||||
32770.0000 0.0000 25.0000
|
||||
32770.0000 1.9000 25.0000
|
||||
32770.0000 1.9000 21.2700
|
||||
32770.0000 3.3000 19.4700 rg
|
||||
32770.0000 5.0000 18.0100
|
||||
32770.0000 10.5000 18.0100
|
||||
32770.0000 12.0000 19.4700 rd
|
||||
32770.0000 19.4000 21.4700
|
||||
32770.0000 19.4000 25.0000
|
||||
32770.0000 20.3000 25.0000
|
||||
999.9990 999.9990 999.9990
|
||||
16 0 0 10 32800.0000 PontA2
|
||||
32800.0000 0.0000 25.0000
|
||||
32800.0000 1.9000 25.0000
|
||||
32800.0000 1.9000 21.2700
|
||||
32800.0000 3.3000 19.4700 rg
|
||||
32800.0000 5.0000 18.0100
|
||||
32800.0000 10.5000 18.0100
|
||||
32800.0000 12.0000 19.4700 rd
|
||||
32800.0000 19.4000 21.4700
|
||||
32800.0000 19.4000 25.0000
|
||||
32800.0000 20.3000 25.0000
|
||||
999.9990 999.9990 999.9990
|
||||
17 0 0 13 32820.0000
|
||||
32820.0000 0.0000 22.4500
|
||||
32820.0000 0.3000 22.0900
|
||||
32820.0000 2.1000 21.2300
|
||||
32820.0000 3.4000 19.5300 rg
|
||||
32820.0000 4.0000 18.0500
|
||||
32820.0000 5.0000 18.0100
|
||||
32820.0000 10.1000 18.0100
|
||||
32820.0000 13.0000 19.3900 rd
|
||||
32820.0000 14.7000 20.3100
|
||||
32820.0000 14.7000 20.4300
|
||||
32820.0000 17.5000 21.5200
|
||||
32820.0000 19.4000 22.1400
|
||||
32820.0000 19.8000 22.4500
|
||||
999.9990 999.9990 999.9990
|
||||
18 0 0 11 32915.0000
|
||||
32915.0000 0.0000 22.5500
|
||||
32915.0000 0.4000 21.9500
|
||||
32915.0000 1.7000 21.2200
|
||||
32915.0000 2.4000 20.9700
|
||||
32915.0000 3.8000 19.4100 rg
|
||||
32915.0000 3.9000 19.3100
|
||||
32915.0000 5.8000 18.0100
|
||||
32915.0000 11.0000 18.0100
|
||||
32915.0000 12.4000 19.3400 rd
|
||||
32915.0000 19.4000 21.9900
|
||||
32915.0000 19.7000 22.5500
|
||||
999.9990 999.9990 999.9990
|
||||
19 0 0 10 33140.0000
|
||||
33140.0000 0.4000 21.7700
|
||||
33140.0000 1.9000 20.7600
|
||||
33140.0000 2.7000 20.5100
|
||||
33140.0000 4.2000 19.1500 rg
|
||||
33140.0000 4.3000 19.0600
|
||||
33140.0000 6.4000 17.9200
|
||||
33140.0000 11.3000 17.9200
|
||||
33140.0000 12.6000 19.1400 rd
|
||||
33140.0000 18.9000 21.8700
|
||||
33140.0000 19.2000 22.1800
|
||||
999.9990 999.9990 999.9990
|
||||
20 0 0 10 33425.0000
|
||||
33425.0000 0.0000 21.6800
|
||||
33425.0000 0.5000 21.5300
|
||||
33425.0000 2.2000 20.1600
|
||||
33425.0000 3.0000 19.9400
|
||||
33425.0000 4.8000 18.8200 rg
|
||||
33425.0000 4.9000 18.7500
|
||||
33425.0000 7.2000 17.8000
|
||||
33425.0000 11.7000 17.8000
|
||||
33425.0000 12.8000 18.8800 rd
|
||||
33425.0000 18.2000 21.6800
|
||||
999.9990 999.9990 999.9990
|
||||
21 0 0 10 33685.0000
|
||||
33685.0000 0.0000 21.5300
|
||||
33685.0000 0.5000 21.3200
|
||||
33685.0000 2.4000 19.6200
|
||||
33685.0000 3.3000 19.4200
|
||||
33685.0000 5.2000 18.5300 rg
|
||||
33685.0000 5.4000 18.4700
|
||||
33685.0000 7.9000 17.7000
|
||||
33685.0000 12.0000 17.7000
|
||||
33685.0000 12.9000 18.6500 rd
|
||||
33685.0000 17.6000 21.5300
|
||||
999.9990 999.9990 999.9990
|
||||
22 0 0 9 33920.0000
|
||||
33920.0000 0.6000 20.9800
|
||||
33920.0000 2.6000 19.1300
|
||||
33920.0000 3.6000 18.9400
|
||||
33920.0000 5.7000 18.2600 rg
|
||||
33920.0000 5.8000 18.2200
|
||||
33920.0000 8.5000 17.6000
|
||||
33920.0000 12.3000 17.6000
|
||||
33920.0000 13.1000 18.4400 rd
|
||||
33920.0000 17.0000 21.1300
|
||||
999.9990 999.9990 999.9990
|
||||
23 0 0 9 34095.0000
|
||||
34095.0000 0.6000 20.9500
|
||||
34095.0000 2.7000 18.7700
|
||||
34095.0000 3.8000 18.5900
|
||||
34095.0000 6.0000 18.0600 rg
|
||||
34095.0000 6.1000 18.0300
|
||||
34095.0000 9.0000 17.5300
|
||||
34095.0000 12.5000 17.5300
|
||||
34095.0000 13.2000 18.2800 rd
|
||||
34095.0000 16.6000 20.9800
|
||||
999.9990 999.9990 999.9990
|
||||
24 0 0 10 34295.0000
|
||||
34295.0000 0.0000 21.3600
|
||||
34295.0000 0.6000 20.8300
|
||||
34295.0000 2.4000 18.3500
|
||||
34295.0000 3.5000 18.1900
|
||||
34295.0000 5.8000 17.8300 rg
|
||||
34295.0000 6.5000 17.3400
|
||||
34295.0000 9.5000 17.3600
|
||||
34295.0000 12.8000 17.4100
|
||||
34295.0000 14.0000 18.1000 rd
|
||||
34295.0000 16.1000 21.3600
|
||||
999.9990 999.9990 999.9990
|
||||
25 0 0 10 34334.0000 amontPontThivencel
|
||||
34334.0000 0.0000 21.3600
|
||||
34334.0000 0.6000 20.8300
|
||||
34334.0000 2.4000 18.3500
|
||||
34334.0000 3.5000 18.1900
|
||||
34334.0000 5.8000 17.8300 rg
|
||||
34334.0000 6.5000 17.3400
|
||||
34334.0000 9.5000 17.3600
|
||||
34334.0000 12.8000 17.4100
|
||||
34334.0000 14.0000 18.1000 rd
|
||||
34334.0000 16.1000 21.1300
|
||||
999.9990 999.9990 999.9990
|
||||
26 0 0 9 34335.0000 PontmThivencelle
|
||||
34335.0000 2.9000 22.0000
|
||||
34335.0000 2.9000 20.7400
|
||||
34335.0000 2.9000 18.2900 rg
|
||||
34335.0000 6.4000 17.7900
|
||||
34335.0000 9.6000 17.2600
|
||||
34335.0000 12.8000 17.2600
|
||||
34335.0000 12.8000 18.3100 rd
|
||||
34335.0000 12.8000 20.7400
|
||||
34335.0000 12.8000 22.0000
|
||||
999.9990 999.9990 999.9990
|
||||
27 0 0 9 34343.0000 PontvThivencelle
|
||||
34343.0000 2.9000 22.0000
|
||||
34343.0000 2.9000 20.7400
|
||||
34343.0000 2.9000 18.2900 rg
|
||||
34343.0000 6.4000 17.7900
|
||||
34343.0000 9.6000 17.2600
|
||||
34343.0000 12.8000 17.2600
|
||||
34343.0000 12.8000 18.2900 rd
|
||||
34343.0000 12.8000 20.7400
|
||||
34343.0000 12.8000 22.0000
|
||||
999.9990 999.9990 999.9990
|
||||
28 0 0 10 34345.0000 avalPontThivencell
|
||||
34345.0000 0.0000 21.3600
|
||||
34345.0000 0.6000 20.8300
|
||||
34345.0000 2.4000 18.3500
|
||||
34345.0000 3.5000 18.1900
|
||||
34345.0000 5.8000 17.8300 rg
|
||||
34345.0000 6.5000 17.3400
|
||||
34345.0000 9.5000 17.2600
|
||||
34345.0000 12.8000 17.4100
|
||||
34345.0000 14.0000 18.1000 rd
|
||||
34345.0000 16.1000 21.1300
|
||||
999.9990 999.9990 999.9990
|
||||
29 0 0 7 34405.0000
|
||||
34405.0000 0.0000 21.1400
|
||||
34405.0000 2.9000 17.8400 rg
|
||||
34405.0000 6.4000 17.4400
|
||||
34405.0000 9.6000 17.2000
|
||||
34405.0000 12.8000 17.2200
|
||||
34405.0000 13.9000 17.8400 rd
|
||||
34405.0000 19.0000 21.0000
|
||||
999.9990 999.9990 999.9990
|
||||
30 0 0 7 34535.0000
|
||||
34535.0000 0.0000 20.5900
|
||||
34535.0000 2.9000 17.7400 rg
|
||||
34535.0000 6.4000 17.2400
|
||||
34535.0000 9.6000 17.0300
|
||||
34535.0000 12.8000 17.0300
|
||||
34535.0000 13.5000 17.7400 rd
|
||||
34535.0000 15.8000 20.6000
|
||||
999.9990 999.9990 999.9990
|
||||
31 0 0 7 34705.0000
|
||||
34705.0000 0.0000 20.5000
|
||||
34705.0000 2.9000 17.6100 rg
|
||||
34705.0000 6.4000 17.1100
|
||||
34705.0000 9.6000 16.8500
|
||||
34705.0000 12.8000 16.8500
|
||||
34705.0000 14.0000 18.0000 rd
|
||||
34705.0000 16.2000 20.5300
|
||||
999.9990 999.9990 999.9990
|
||||
32 0 0 7 34825.0000
|
||||
34825.0000 0.0000 20.6200
|
||||
34825.0000 2.9000 17.5200 rg
|
||||
34825.0000 6.4000 17.0200
|
||||
34825.0000 9.6000 16.7100
|
||||
34825.0000 12.8000 16.7100
|
||||
34825.0000 13.5000 17.5200 rd
|
||||
34825.0000 16.2000 20.5000
|
||||
999.9990 999.9990 999.9990
|
||||
33 0 0 7 34995.0000
|
||||
34995.0000 0.0000 20.3900
|
||||
34995.0000 2.9000 17.3900 rg
|
||||
34995.0000 6.4000 16.8900
|
||||
34995.0000 9.6000 16.5300
|
||||
34995.0000 12.8000 16.5300
|
||||
34995.0000 13.6000 17.4300 rd
|
||||
34995.0000 16.2000 20.3200
|
||||
999.9990 999.9990 999.9990
|
||||
34 0 0 7 35135.0000
|
||||
35135.0000 0.0000 20.1600
|
||||
35135.0000 2.9000 17.2900 rg
|
||||
35135.0000 6.4000 16.7900
|
||||
35135.0000 9.6000 16.4300
|
||||
35135.0000 12.8000 16.4300
|
||||
35135.0000 13.9000 17.3700 rd
|
||||
35135.0000 16.2000 20.0600
|
||||
999.9990 999.9990 999.9990
|
||||
35 0 0 7 35360.0000
|
||||
35360.0000 0.0000 19.8600
|
||||
35360.0000 2.9000 17.1200 rg
|
||||
35360.0000 6.4000 16.6200
|
||||
35360.0000 9.6000 16.2600
|
||||
35360.0000 12.8000 16.2600
|
||||
35360.0000 13.7000 17.1200 rd
|
||||
35360.0000 16.2000 19.4600
|
||||
999.9990 999.9990 999.9990
|
||||
36 0 0 7 35580.0000
|
||||
35580.0000 0.0000 20.0000
|
||||
35580.0000 2.9000 16.9500 rg
|
||||
35580.0000 3.0000 16.0900
|
||||
35580.0000 11.5000 16.0500
|
||||
35580.0000 20.0000 16.0900
|
||||
35580.0000 21.0000 17.0300 rd
|
||||
35580.0000 23.0000 19.5000
|
||||
999.9990 999.9990 999.9990
|
||||
37 0 0 7 35920.0000
|
||||
35920.0000 0.0000 20.0000
|
||||
35920.0000 2.2000 16.0200 rg
|
||||
35920.0000 3.0000 14.5500
|
||||
35920.0000 11.5000 14.5000
|
||||
35920.0000 20.0000 14.5500
|
||||
35920.0000 20.9000 16.0200 rd
|
||||
35920.0000 23.0000 19.5000
|
||||
999.9990 999.9990 999.9990
|
||||
38 0 0 7 36270.0000 S1
|
||||
36270.0000 0.0000 20.0000
|
||||
36270.0000 1.8000 17.0100 rg
|
||||
36270.0000 3.0000 15.0800
|
||||
36270.0000 11.5000 15.0500
|
||||
36270.0000 20.0000 15.0800
|
||||
36270.0000 21.3000 17.0100 rd
|
||||
36270.0000 23.0000 19.5000
|
||||
999.9990 999.9990 999.9990
|
||||
39 0 0 7 36271.0000 S1bis
|
||||
36271.0000 0.0000 20.0000
|
||||
36271.0000 1.8000 17.0100 rg
|
||||
36271.0000 3.0000 13.0800
|
||||
36271.0000 11.5000 13.0500
|
||||
36271.0000 20.0000 13.0800
|
||||
36271.0000 21.3000 17.0100 rd
|
||||
36271.0000 23.0000 19.5000
|
||||
999.9990 999.9990 999.9990
|
||||
@@ -0,0 +1,2 @@
|
||||
0:00:00:00 15
|
||||
0:00:01:00 15
|
||||
@@ -0,0 +1,25 @@
|
||||
0:00:00:00 5,53
|
||||
0:11:37:00 5,72
|
||||
0:16:17:00 5,82
|
||||
0:22:57:00 5,92
|
||||
1:00:00:00 6,6
|
||||
1:00:57:00 8,04
|
||||
1:02:29:00 14,3
|
||||
1:04:38:00 24,4
|
||||
1:08:48:00 40
|
||||
1:11:27:00 46,3
|
||||
1:13:47:00 48,8
|
||||
1:16:07:00 47,9
|
||||
1:17:17:00 44,8
|
||||
1:20:23:00 27,8
|
||||
1:21:57:00 24,3
|
||||
2:01:15:00 19,2
|
||||
2:05:15:00 15,8
|
||||
2:11:25:00 11,5
|
||||
2:11:57:00 11,1
|
||||
2:13:17:00 10,5
|
||||
2:19:07:00 9,84
|
||||
2:23:59:00 8,43
|
||||
3:04:51:00 7,02
|
||||
3:09:43:00 5,61
|
||||
3:14:35:00 5,53
|
||||
@@ -0,0 +1,25 @@
|
||||
**************** SINGULARITES **********************
|
||||
*BieSec Nb Longueur Cote dev Cote charg Coef deb Impression
|
||||
*===---===----------==========----------==========-----------------------------
|
||||
*****************************************************
|
||||
* Bief n° 1
|
||||
*****************************************************
|
||||
* Ouvrage au pk 36270.0 seuil_aval
|
||||
*SeuilR type D
|
||||
D 1 36270.00 18.250 15.500 0.000 0.400 99999.000 seuil palplanches
|
||||
* Ouvrage au pk 31875.0 PontRS101
|
||||
*OrificeR type O
|
||||
O 1 31875.00 9.660 18.710 21.890 0.400 9999.000
|
||||
*SeuilR type D
|
||||
D 1 31875.00 14.000 22.890 0.000 0.400 99999.000
|
||||
* Ouvrage au pk 34335.0 PontThivencelle
|
||||
*SeuilR type D
|
||||
D 1 34335.00 13.000 21.740 0.000 0.400 99999.000
|
||||
*OrificeR type O
|
||||
O 1 34335.00 9.070 17.280 20.740 0.400 9999.000
|
||||
*****************************************************
|
||||
* Bief n° 3
|
||||
*****************************************************
|
||||
* Ouvrage au pk 0.0 Orifice
|
||||
*OrificeR type O
|
||||
*O 3 0.000 6.000 19.000 19.001 0.400 20.000 Clapet_001
|
||||
@@ -0,0 +1 @@
|
||||
$Clapet_001 clapet
|
||||
@@ -0,0 +1,2 @@
|
||||
0:00:00:00 4
|
||||
0:00:01:00 4
|
||||
@@ -0,0 +1,24 @@
|
||||
16,03 0
|
||||
16,13 1,29
|
||||
16,23 3,64
|
||||
16,33 6,7
|
||||
16,43 10,31
|
||||
16,53 14,41
|
||||
16,63 18,94
|
||||
16,73 23,87
|
||||
16,83 29,16
|
||||
16,93 34,79
|
||||
17,03 40,75
|
||||
17,13 47,01
|
||||
17,23 53,57
|
||||
17,33 60,4
|
||||
17,43 67,5
|
||||
17,53 74,86
|
||||
17,63 82,47
|
||||
17,73 90,33
|
||||
17,83 98,41
|
||||
17,93 106,73
|
||||
18,03 115,26
|
||||
18,13 124,01
|
||||
18,23 132,98
|
||||
18,33 142,14
|
||||
@@ -0,0 +1,9 @@
|
||||
0:00:00:00 4
|
||||
0:01:16:48 4
|
||||
0:16:00:00 50
|
||||
1:11:46:28 36,8
|
||||
2:07:27:22 23,3
|
||||
5:04:24:58 13,8
|
||||
10:03:00:06 9,38
|
||||
20:02:19:58 7,29
|
||||
30:01:54:37 5,97
|
||||
@@ -0,0 +1,10 @@
|
||||
0:00:00:00 4
|
||||
0:01:49:48 4
|
||||
0:16:00:00 35
|
||||
1:11:25:48 25
|
||||
2:07:30:00 16,4
|
||||
5:03:55:12 9,66
|
||||
10:03:00:00 6,56
|
||||
27:00:54:00 4,91
|
||||
30:01:48:36 4
|
||||
31:06:00:00 4
|
||||
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 37 KiB |
@@ -0,0 +1,299 @@
|
||||
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
|
||||
%% Do not edit unless you really know what you are doing.
|
||||
\documentclass[12pt,french]{article}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[latin9]{inputenc}
|
||||
\usepackage{geometry}
|
||||
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm,headheight=2cm,headsep=2cm,footskip=2cm}
|
||||
\usepackage{textcomp}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{hyperref}
|
||||
|
||||
\makeatletter
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
|
||||
\newcommand{\noun}[1]{\textsc{#1}}
|
||||
%% Because html converters don't know tabularnewline
|
||||
\providecommand{\tabularnewline}{\\}
|
||||
|
||||
\makeatother
|
||||
|
||||
\usepackage{babel}
|
||||
\addto\extrasfrench{%
|
||||
\providecommand{\og}{\leavevmode\flqq~}%
|
||||
\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}%
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
\includegraphics[width=5cm]{img/Logo-INRAE_Transparent.png}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
|
||||
Tutoriel pour Pamhyr2
|
||||
|
||||
Janvier 2024
|
||||
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
|
||||
\textbf{\LARGE Modélisation 1D de la rivière } \\
|
||||
\textbf{\LARGE Hogneau (Nord, France) avec Pamhyr2}
|
||||
|
||||
\par\end{center}{\LARGE \par}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
{\large INRAE Lyon-Grenoble Auvergne-Rhône-Alpes}
|
||||
\par\end{center}{\large \par}
|
||||
|
||||
\begin{center}
|
||||
|
||||
RiverLy, Hydraulique des rivières
|
||||
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{lll}
|
||||
Autors : & Pierre-Antoine Rouby & pierre-antoine.rouby@inrae.fr\tabularnewline
|
||||
& Théophile TERRAZ & theophile.terraz@inrae.fr\tabularnewline
|
||||
& Lionel Pénard & lionel.penard@inrae.fr\tabularnewline
|
||||
|
||||
\end{tabular}
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
\pagebreak{}
|
||||
|
||||
\begin{center}
|
||||
\tableofcontents{}
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
\pagebreak{}
|
||||
|
||||
% \section{Introduction}
|
||||
%
|
||||
% TODO
|
||||
%
|
||||
% \pagebreak{}
|
||||
|
||||
|
||||
\section{Installer Pamhyr2}
|
||||
|
||||
Pamhyr2 peut être téléchargé ici : \url{https://gitlab.irstea.fr/theophile.terraz/pamhyr}.
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/dl.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Utilisez le bouton de téléchargement GNU Linux ou Windows en fonction de votre système. Sous Windows, lancez le programme d'installation. Sous Linux, décompressez l'archive et lancez Pamhyr2.
|
||||
|
||||
|
||||
\section{Créer une première étude}
|
||||
|
||||
Dans la fenêtre principale, cliquez sur \texttt{[Fichier] => [Nouvelle étude]} pour créer une nouvelle étude. Choisissez un nom, par exemple Hogneau, et validez
|
||||
|
||||
Cliquez sur \texttt{[Réseau] => [Editer le réseau]} pour créer les biefs de votre rivière. Dans cette fenêtre, vous devez définir un graphe orienté qui représente les biefs de votre réseau fluvial : les arêtes sont les biefs et les n½uds sont soit des conditions limites amont, soit des conditions limites aval, soit des jonctions entre biefs.
|
||||
Appuyez sur le bouton \includegraphics[width=0.5cm]{img/gtk_add.png} pour entrer dans le mode \textit{Ajout}. Créez deux n½uds en cliquant dans la zone grise de la fenêtre, et créez un lien en cliquant à nouveau sur chaque n½ud. Appuyez à nouveau sur \includegraphics[width=0.5cm]{img/gtk_add.png} pour quitter le mode \textit{Ajout}. Vous avez créé votre premier bief, avec un n½ud amont et un n½ud aval. Dans la partie inférieure de la fenêtre \textit{Editer le réseau hydrographique}, vous pouvez renommer les n½uds et les biefs. Comme le bief que vous avez créé est automatiquement sélectionné, toutes les étapes suivantes s'appliqueront à ce bief. La fenêtre doit se présenter comme suit :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/network.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Fermer la fenêtre \textit{Editer le réseau}.
|
||||
|
||||
|
||||
\section{Editer la géometrie de la rivière}
|
||||
|
||||
Cliquez sur \texttt{[Géometrie] => [Editer la géometrie]} pour définir la géométrie du bief sélectionné. Cliquez sur le bouton \texttt{[Importer]} et sélectionnez le fichier \texttt{Data/Bief\_1.st}. Vous devriez voir :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/Geo.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Le panneau de gauche contient une liste de toutes les sections en travers avec leur nom et leur abscisse longitudinale (PK). Dans le graphique en haut à gauche, vous pouvez voir la vue de dessus de la rivière, dans le panneau en haut à droite, la coupe longitudinale de la rivière et dans le graphique en bas, vous pouvez voir la section en travers sélectionnée (bleu) ainsi que la suivante (pointillés violets) et la précédente (pointillés noirs). Vous pouvez vous déplacer dans la liste des sections en cliquant dans le tableau ou à l'aide de l'ascenseur situé entre le tableau et les graphiques.
|
||||
|
||||
Vous pouvez éditer la section en travers sélectionnée en cliquant sur l'icône \includegraphics[width=0.5cm]{"img/edit.png"}.
|
||||
|
||||
Sélectionnez la section en travers nommée \textit{PontRD101m} et ouvrez la fenêtre d'édition. Vous devriez voir :
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/editsect.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Sur le panneau de gauche se trouve la liste de tous les points de la section, avec leurs coordonnées, leur nom et leur abscisse transversale. La coordonnée Z du point le plus haut est inscrite en bleu et celle du point le plus bas en rouge. Les points peuvent avoir un nom. Si un point portant le même nom existe dans toutes les sections d'un bief, il forme une ligne longitudinale (ou ligne directrice). Par exemple, nous avons ici \textit{rg} et \textit{rd} qui représentent la rive gauche et la rive droite du lit mineur.
|
||||
|
||||
Sur le graphique figure une projection de la section en travers. Vous pouvez utiliser \texttt{[ctrl + clic]} pour sélectionner un point dans le tracé et \texttt{[maj + clic]} pour sélectionner une ligne d'eau et visualiser des données géométriques utiles. Vous pouvez fermer la fenêtre d'édition de la section en travers et la fenêtre d'édition de la géométrie.
|
||||
|
||||
\section{Editer les conditions aux limites}
|
||||
|
||||
Dans la fenêtre principale, cliquez sur \texttt{[Hydraulique] => [Conditions aux limites et apports ponctuels]} :
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/boundary.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Utilisez le bouton \textit{ajouter} en haut à gauche de la fenêtre pour ajouter une condition limite pour le liquide.
|
||||
Sur la nouvelle ligne, on peut cliquer pour sélectionner la ligne entière, et double-cliquer pour sélectionner la cellule.
|
||||
Sélectionnez la cellule \textit{Type} pour donner un nom à la condition limite. Ici, nous définirons le débit mesuré lors de la crue de février 2002. Vous pouvez nommer cette condition limite "crue2002".
|
||||
Sélectionner la cellule \textit{Type} et utiliser la combo box pour mettre une loi Q(t).
|
||||
Sélectionnez la cellule \textit{Noeud} et attribuez cette condition au noeud amont.
|
||||
Les noms des noeuds sont rappelés dans le réseau du panneau de droite.
|
||||
Sélectionnez maintenant la ligne entière et cliquez sur le bouton d'édition \includegraphics[width=0.5cm]{"img/edit.png"}. Vous avez ouvert la fenêtre \textit{Éditer les conditions aux limites}.
|
||||
Dans un éditeur de texte, ouvrez le fichier \texttt{Données/Fevrier\_2002.txt}. Copiez le contenu du fichier (par exemple avec \textit{ctrl+a} puis \textit{ctrl+c}) et collez-le dans le panneau gauche de la fenêtre \textit{Éditer les conditions aux limites} avec \textit{ctrl+v}. Vous pouvez maintenant voir la courbe de débit :
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/fev2002.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Fermer cette fenêtre. Revenir sur la fenêtre \textit{Conditions aux limites}. Ajouter une nouvelle ligne, lui donner un nom, lui donner le type \textit{Z(T)} et l'associer au noeud aval du réseau. Ouvrez la fenêtre \textit{Éditer les conditions aux limites} (\includegraphics[width=0.5cm]{"img/edit.png"}). Ajoutez deux lignes. Dans la première, entrez le temps : 0.00.00 et Z : 15.000.
|
||||
Dans la seconde, saisissez le temps : 1.00.00 et Z : 15.000. Cela crée une côte constante de l'eau en aval. Pour le calcul, Mage extrapolera continuellement l'élévation de l'eau.
|
||||
Vous pouvez fermer les fenêtres \textit{Éditer les conditions aux limites} et \textit{Conditions aux limites}.
|
||||
|
||||
\section{Créer les conditions initiales}
|
||||
|
||||
Dans la fenêtre principale, cliquez sur \texttt{[Hydraulique] => [Conditions initiales]}.
|
||||
Si vous ne connaissez pas les conditions initiales de la côte de l'eau et du débit de la rivière, vous pouvez utiliser les boutons \texttt{[Générer une hauteur minimale]} ou \texttt{[Générer un débit constant]} pour laisser Pamhyr2 estimer une condition initiale à l'aide de la formule de Manning-Strickler.
|
||||
Cliquez sur \texttt{[Générer à partir du débit]} et saisissez un débit de $4 m^3$ dans la fenêtre contextuelle pour générer une condition initiale de hauteur d'eau basée sur la formule de Manning-Strickler et un débit uniforme de $4 m^3$. Vous devriez voir :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/ic.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Fermer la fenêtre \textit{Conditions initiales}
|
||||
|
||||
|
||||
\section{Editer les coefficients de frottement}
|
||||
|
||||
Dans la fenêtre principale, cliquez sur \texttt{[Hydraulique] => [Editer les frottements]}.
|
||||
Vous devez d'abord définir des jeux de coefficients de Strickler. Cliquez sur \includegraphics[width=0.5cm]{"img/edit.png"} pour ouvrir la fenêtre \textit{Strickler}. Vous pouvez y créer des couples de coefficients de Strickler, le premier pour le lit mineur, le second pour le lit moyen. Cliquez quatre fois sur \textit{add} pour créer quatre nouveaux couples. Donnez-leur les valeurs suivantes :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/K.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Fermez la fenêtre \textit{Strickler}. Dans la fenêtre \textit{Editer les frottements}, ajoutez quatre lignes avec le bouton \includegraphics[width=0.5cm]{img/gtk_add.png} pour créer quatre zones de frottement. Chaque zone est définie par un PK \textit{début} et de \textit{fin} PK et un couple \textit{begin} et \textit{end} couple de Strickler. Les couples de coefficients de Strickler à l'intérieur d'une zone sont interpolés à partir des couples \textit{begin} et \textit{end}. Dans notre cas, nous utiliserons des coefficients constants par zone. Définissez les zones comme suit :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/frictions.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
La zone sélectionnée est surlignée en bleu. Fermez la fenêtre \textit{Editer les frottements}.
|
||||
|
||||
|
||||
\section{Modélisation des ouvrages hydrauliques}
|
||||
|
||||
Parfois, il peut y avoir des sections en travers dans lesquelles les équations de Saint-Venant ne peuvent pas être utilisées pour modéliser l'écoulement de l'eau. Dans ce cas, nous devons définir une autre loi pour relier la côte de l'eau et le débit. C'est le cas, par exemple, au niveau des ponts lorsque la hauteur d'eau est trop élevée, ce qui entraîne un écoulement en charge. Pamhyr2 permet de définir différents ouvrages hydrauliques avec des lois paramétrables. Dans notre cas, on doit représenter un seuil et deux ponts comme ouvrages hydrauliques.
|
||||
Dans la fenêtre principale, cliquez sur \texttt{[Hydraulique] => [Ouvrages hydrauliques]} pour ouvrir la fenêtre des ouvrages hydrauliques. Cliquez trois fois sur le bouton \includegraphics[width=0.5cm]{img/gtk_add.png} pour créer trois ouvrages hydrauliques. Chaque structure peut avoir un nom et doit avoir une portée et un PK. Définissez-les comme suit :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/hs.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Sélectionnez le seuil aval et cliquez sur \includegraphics[width=0.5cm]{"img/edit.png"} pour modifier les lois de cette ouvrage. Les ouvrages hydrauliques sont composés d'ouvrages hydrauliques élémentaires. Vous pouvez combiner les lois de plusieurs ouvrages hydrauliques élémentaires pour créer votre ouvrage. Pour ce seuil, nous n'avons besoin que d'un ouvrage hydraulique élémentaire de type déversoir. Cliquez sur \includegraphics[width=0.5cm]{img/gtk_add.png} pour ajouter un nouvel ouvrage hydraulique élémentaire, donnez-lui le type \textit{seuil} et configurez-le comme suit :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/seuil.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Retournez à la fenêtre \textit{Ouvrages hydrauliques}.
|
||||
|
||||
Sélectionnez le pont RS101 et cliquez sur \includegraphics[width=0.5cm]{"img/edit.png"} pour éditer les lois de cet ouvrage. Un pont peut être modélisé comme une combinaison d'un orifice pour l'écoulement sous le pont et d'un déversoir pour l'écoulement au-dessus du pont. Créez deux ouvrages hydrauliques élémentaires et définissez-les comme suit :
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/seuilRS101.png}
|
||||
|
||||
\includegraphics[width=15cm]{img/orificeRS101.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Revenez à la fenêtre \textit{Ouvrages hydrauliques} et appliquez la même procédure pour le pont de Thivencelle :
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/orificeThivencelle.png}
|
||||
|
||||
\includegraphics[width=15cm]{img/seuilThivencelle.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Vous pouvez maintenant fermer les fenêtres \textit{Ouvrages hydrauliques}.
|
||||
|
||||
\section{Paramètres du solveur}
|
||||
|
||||
Dans la fenêtre principale, cliquez sur \texttt{[Exécuter] => [Parameters numériques des solveurs]}.
|
||||
Dans la fenêtre \textit{Paramètres du solveur}, sélectionnez l'onglet \textit{Mage v8}. Réglez les paramètres du solveur comme suit :
|
||||
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/param.png}
|
||||
\par\end{center}
|
||||
|
||||
|
||||
Fermer la fenêtre \textit{Paramètres du solveur}.
|
||||
|
||||
\section{Lancer la simulation}
|
||||
|
||||
Dans la fenêtre principale, cliquez sur \texttt{[Exécuter] => [Lancer le solveur]}.
|
||||
Sélectionnez \textit{Defaut-Mage - (Mage8)} et cliquez sur le bouton \textit{Exécuter}.
|
||||
Deux fenêtres s'ouvrent : la fenêtre \textit{check list} et la fenêtre \textit{Log du solveur}.
|
||||
La fenêtre \textit{Check list} donne quelques indications sur la validité de votre modèle, et la fenêtre \textit{Log du solveur} affiche les résultats du solveur.
|
||||
À partir de la fenêtre \textit{Log du solveur}, vous pouvez réexécuter le calcul, et vous pouvez cliquer sur le bouton \textit{Résultats} pour ouvrir la fenêtre \textit{Résultats}.
|
||||
|
||||
\section{Visualiser les résultats}
|
||||
|
||||
il est aussi possible d'ouvrir la fenêtre \textit{Résultats} si vous avez fermé la fenêtre \textit{Log du solveur}, en cliquant sur \texttt{[Résultats] => [Visualiser les derniers résultats]} à partir de la fenêtre principale. Le panneau supérieur vous permet de sélectionner le bief, le panneau inférieur gauche vous permet de sélectionner une section en travers dans ce bief. Les trois diagrammes sur la droite montrent le bief et la section en travers de la même manière que dans la fenêtre \textit{Géométrie}. Vous pouvez utiliser le curseur du bas pour visualiser la côte de l'eau à différents pas de temps.
|
||||
Pour visualiser le débit, passez à l'onglet \textit{Hydrogramme}.
|
||||
Pour créer des tracés 2D personnalisés, cliquez sur le bouton \includegraphics[width=0.5cm]{img/gtk_add.png} en haut à gauche de la fenêtre. Sélectionnez les valeurs que vous voulez sur les axes $X$ et $Y$ et cliquez sur \textit{OK}.
|
||||
Vous pouvez maintenant voir un nouvel onglet avec le tracé 2D personnalisé dans le panneau droit de la fenêtre \textit{Results}.
|
||||
|
||||
|
||||
|
||||
\pagebreak{}
|
||||
\end{document}
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
%% LyX 2.0.2 created this file. For more info, see http://www.lyx.org/.
|
||||
%% Do not edit unless you really know what you are doing.
|
||||
\documentclass[12pt,french]{article}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[latin9]{inputenc}
|
||||
\usepackage{geometry}
|
||||
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm,headheight=2cm,headsep=2cm,footskip=2cm}
|
||||
\usepackage{textcomp}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{hyperref}
|
||||
|
||||
\makeatletter
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
|
||||
\newcommand{\noun}[1]{\textsc{#1}}
|
||||
%% Because html converters don't know tabularnewline
|
||||
\providecommand{\tabularnewline}{\\}
|
||||
|
||||
\makeatother
|
||||
|
||||
\usepackage{babel}
|
||||
\addto\extrasfrench{%
|
||||
\providecommand{\og}{\leavevmode\flqq~}%
|
||||
\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}%
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
\includegraphics[width=5cm]{img/Logo-INRAE_Transparent.png}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
Tutorial for Pamhyr2
|
||||
|
||||
January 2024
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
\textbf{\LARGE 1D Modeling of the Hogneau River (Nord, France)}
|
||||
|
||||
using Pamhyr2
|
||||
\par\end{center}{\LARGE \par}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
{\large INRAE Lyon-Grenoble Auvergne-Rhône-Alpes}
|
||||
\par\end{center}{\large \par}
|
||||
|
||||
\begin{center}
|
||||
RiverLy, river hydraulics
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
~
|
||||
|
||||
\begin{center}
|
||||
\begin{tabular}{lll}
|
||||
Authors : & Pierre-Antoine Rouby & pierre-antoine.rouby@inrae.fr\tabularnewline
|
||||
& Théophile Terraz & theophile.terraz@inrae.fr\tabularnewline
|
||||
& Lionel Pénard & lionel.penard@inrae.fr\tabularnewline
|
||||
\end{tabular}
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
\pagebreak{}
|
||||
|
||||
\begin{center}
|
||||
\tableofcontents{}
|
||||
\par\end{center}
|
||||
|
||||
~
|
||||
|
||||
\pagebreak{}
|
||||
|
||||
% \section{Introduction}
|
||||
%
|
||||
% TODO
|
||||
%
|
||||
% \pagebreak{}
|
||||
|
||||
\section{Install Pamhyr2}
|
||||
|
||||
Pamhyr2 can be downloaded from \url{https://gitlab.irstea.fr/theophile.terraz/pamhyr}.
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/dl.png}
|
||||
\par\end{center}
|
||||
|
||||
Use the GNU Linux or the Windows download button depending on your system. On windows, launch the installer. On Linux, unpack the archive and launch Pamhyr2.
|
||||
|
||||
|
||||
\section{Create your first study}
|
||||
|
||||
On the main windows, click on \texttt{[Files] => [New Study]} to create a new study.
|
||||
|
||||
Click on \texttt{[River Network] => [Edit River Network]} to create the reaches of your river. In this window, you must define an oriented graph that represents the reaches of your river network: the edges are the reaches and the nodes are either upstream boundary conditions, downstream boundary conditions or junctions.
|
||||
Press the \includegraphics[width=0.5cm]{img/gtk_add.png} to enter the \textit{add} mode. Create two nodes by clicking in the grey zone of the window, and create a link by clicking again on each node. press \includegraphics[width=0.5cm]{img/gtk_add.png} again to exit the \textit{add} mode. You created your first reach, with an upstream node and a downstream node. In the lower part of the \textit{Edit River Network} window you can rename the nodes and the reaches. As the reach you created is automaticaly selected, all the next steps will apply to this reach. The window should look like that:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/network.png}
|
||||
\par\end{center}
|
||||
|
||||
Close the \textit{Edit River Network} window.
|
||||
|
||||
|
||||
\section{Edit the river geometry}
|
||||
|
||||
Click on \texttt{[Geometry] => [Edit Geometry]} to define the geometry of the selected bief. Click on the \texttt{[Import]} button and select the file \texttt{Data/Bief\_1.st}. You should see:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/Geo.png}
|
||||
\par\end{center}
|
||||
|
||||
On the left panel is a list of all the cross sections with their name and longitudinal abscisa. In the top left plot you can see the top view of the river, on the top right panel the longitudinal cross-section of the river and in the bottom plot you can see the selected cross-section (blue) along with the next one (dashed purple) and previous one (dashed black). You can move in the section list using the slider at the very right of the window.
|
||||
|
||||
You can edit the selected cross section by clicking on the \includegraphics[width=0.5cm]{"img/edit.png"} icon.
|
||||
|
||||
select the cross section named \textit{PontRD101m} and open the edition window. You should see:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/editsect.png}
|
||||
\par\end{center}
|
||||
|
||||
On the left panel is the list of all the points of the section, with their coordinates, their name and their transversal absisa. The Z coordinate of the highest point is written in blue and the lowest in red. Points can have a name. If a point with the same name exists in every section in a reach, it forms a longitudinal line. For example, here we have \textit{rg} and \textit{rd} which represent the left bank and the right bank of the main chanel.
|
||||
|
||||
On the plot is a projection of the cross section. You can use \texttt{[ctrl + click]} to select a point in the plot and \texttt{[shift + click]} to select a water line and visualize usefull geometric data. You can close the cross section edition window and the geometry edition window.
|
||||
|
||||
\section{Edit the boundary conditions}
|
||||
|
||||
From the main window, click on \texttt{[Hydraulics] => [Boundary conditions and punctual contributions]}.You should see:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/boundary.png}
|
||||
\par\end{center}
|
||||
|
||||
Use the \textit{add} button on the top left of the window to add a liquid boundary condition.
|
||||
On the new line, click to select the whole line, double click to select the cell.
|
||||
Select the \textit{Type} cell to give a name to the boundary condition. here, we will define the flow discharge mesured during the february 2002 flood. You can name this boundary condition "flood2002".
|
||||
Select the \textit{Type} cell and use the combo box to put a Q(t) law.
|
||||
Select the \textit{Node} cell and atribute this condition to the upstream node.
|
||||
Names of the nodes are recalled in network in the right panel.
|
||||
Now select the whole line and click on the edit button \includegraphics[width=0.5cm]{"img/edit.png"}. You opened the \textit{Edit Boundary Conditions} window.
|
||||
On a text editor, open the \texttt{Data/Fevrier\_2002.txt} file. Copy the content of the file (for example with \textit{ctrl+a ctrl+c}) and paste it in the left panel of the \textit{Edit Boundary Conditions} window with \textit{ctrl+v}. You can now see the flow discharge curve:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/fev2002.png}
|
||||
\par\end{center}
|
||||
|
||||
Close this window. Go back on the \textit{Boundary Conditions} window. Add a new line, give it a name, give it the textit{Z(T)} type and associate it to the downstream node of the network. Open the \textit{Edit Boundary Conditions} window (\includegraphics[width=0.5cm]{"img/edit.png"}). Add two lines. In the first one, enter time: 0.00.00 and Z: 15.000.
|
||||
On the second one, time: 1.00.00 and Z: 15.000. It creates a constant downstream water elevation. For the computaion, Mage will extrapolate continuously the water elevation, that's why we only need to define one hour.
|
||||
You can close the the \textit{Edit Boundary Conditions} and the \textit{Boundary Conditions} window.
|
||||
|
||||
\section{Create initial conditions}
|
||||
|
||||
From the main window, click on \texttt{[Hydraulics] => [Initial conditions]}.
|
||||
If you don't know the initial conditions in water elevation and flow discharge of the river, you can use \texttt{[Generate minimal height]} or \texttt{[Generate from discharge]} buttons to let Pamhyr2 estimate an initial condition using the Manning-Strickler formula.
|
||||
Click on \texttt{[Generate from discharge]} and enter a discharge of $4 m^3$ in the pop-up window to generate an initial water height condition based on the Manning-Strickler formula and a uniform discharge of $4 m^3$. You should see:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/ic.png}
|
||||
\par\end{center}
|
||||
|
||||
Close the \textit{Initial conditions} window.
|
||||
|
||||
|
||||
\section{Edit friction coefficients}
|
||||
|
||||
From the main window, click on \texttt{[Hydraulics] => [Edit friction]}.
|
||||
You fist have to define sets of Strickler coefficients. Click on \includegraphics[width=0.5cm]{"img/edit.png"} to open the \textit{Strickler} window. Here you can create couples of Strickler coefficients, the first one for the minor bed, the second one for the medium bed. Click on \textit{add} four times to create four new couple. Give them the folowing values:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/K.png}
|
||||
\par\end{center}
|
||||
|
||||
Close the \textit{Strickler} window. On the \textit{Edit friction} window, add four lines with the button \includegraphics[width=0.5cm]{img/gtk_add.png} to create four friction zones. Each zone is defined by a \textit{begin} and \textit{end} KP and a \textit{begin} and \textit{end} Strickler couple. The strickler coefficient couples inside a zone are interpolated from the \textit{begin} and \textit{end} couples. In our case, we will use constant coefficients per zone. Set the zones as follow:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/frictions.png}
|
||||
\par\end{center}
|
||||
|
||||
The selected zone is highlighted in blue. Close the \textit{Edit friction} window.
|
||||
|
||||
|
||||
\section{Model hydraulic structures}
|
||||
|
||||
Sometimes there can be cross-sections in which Shallow water equations can not be used to model the water flow. In that case, we have to define an other law to link the water elevation and the flow discharge. This is the case, for example, under bridges when the water elevation is too high, leading to a flow in charge. Pamhyr2 enables to define various hydraulic structures with laws that can be parametrized. In our case, a weir and two bridges have to be represented as hydraulic structures.
|
||||
From the main window, click on \texttt{[Hydraulics] => [Hydraulic structures]} to open the hydraulic structures window. Click tree times on the \includegraphics[width=0.5cm]{img/gtk_add.png} button to create three hydraulic structures. Each structure can have a name and must have a reach and a KP. Set them as follow:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/hs.png}
|
||||
\par\end{center}
|
||||
|
||||
Select the downstream weir and click on \includegraphics[width=0.5cm]{"img/edit.png"} to edit the laws of this structure. Hydraulic structures are composed of basic hydraulic structures. You can combine the laws of several basic hydraulic structures to setup your structure. For this weir, we only need a weir basic hydraulic structure. Click on \includegraphics[width=0.5cm]{img/gtk_add.png} to add a new basic hydraulic structure, give it the \textit{weir} type and set it up as folow:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/seuil.png}
|
||||
\par\end{center}
|
||||
|
||||
Go back to the \textit{hydraulic structures} window.
|
||||
|
||||
Select the RS101 bridge and click on \includegraphics[width=0.5cm]{"img/edit.png"} to edit the laws of this structure. A bridge can be modeled as a combination of an orifice for the flow under the bridge and a weir for the flow over the bridge. Create two basic hydraulic structures and set them as folow:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/seuilRS101.png}
|
||||
|
||||
\includegraphics[width=15cm]{img/orificeRS101.png}
|
||||
\par\end{center}
|
||||
|
||||
Go back to the \textit{hydraulic structures} window and aply the same procedure for the Thivencelle bridge:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/orificeThivencelle.png}
|
||||
|
||||
\includegraphics[width=15cm]{img/seuilThivencelle.png}
|
||||
\par\end{center}
|
||||
|
||||
You can now close the \textit{hydraulic structures} windows.
|
||||
|
||||
\section{Solver parameters}
|
||||
|
||||
From the main window, click on \texttt{[Execute] => [Numerical parameters for solvers]}.
|
||||
In the window \textit{solver parameters} select the \textit{Mage v8} tab. Set the solver parameters as follow:
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=15cm]{img/param.png}
|
||||
\par\end{center}
|
||||
|
||||
Close the \textit{solver parameters} window.
|
||||
|
||||
\section{Run the simulation}
|
||||
|
||||
From the main window, click on \texttt{[Execute] => [Run solver]}.
|
||||
Select \textit{Defaut-Mage - (Mage8)} anc click on the \textit{Run} button.
|
||||
It will open two windows: the \textit{Check list} window and the \textit{Solver log} window.
|
||||
The \textit{Check list} window gives som hints about the validity of your model, and the \textit{Solver log} window displays the outputs of the solver.
|
||||
From the \textit{Solver log} window you can re-run the computation, and from the textit{Solver log} window you can click on the \textit{Results} button to open the \textit{Results} window.
|
||||
|
||||
\section{Visualize the results}
|
||||
|
||||
If you closed the \textit{Solver log} window, you can click on \texttt{[Results] => [Visualize last results]} from the main window to open the \textit{Results} window. The top lets panel let you select your reach, the bottom left panel lets you select a cross-section in that reach. the three plots on the right show the reach and the cross-section the same way than in the \textit{Geometry} window. You can use the bottom slider to visualize the water elevation at different timesteps.
|
||||
To visualize the flow discharge, switch to the \textit{Hydrograph} tab.
|
||||
To create custom 2D plots, click on the \includegraphics[width=0.5cm]{img/gtk_add.png} button on the top left of the window. Select the values you want on the $X$ and $Y$ axis and click on \textit{OK}.
|
||||
You can now see a new tab with the custom 2D plot in the right panel of the \textit{Results} window.
|
||||
|
||||
|
||||
\pagebreak{}
|
||||
\end{document}
|
||||
|
||||
@@ -9,3 +9,4 @@ numpy>=1.24.2
|
||||
colorama>=0.4.3
|
||||
pyinstaller>=5.11.0
|
||||
shapely>=2.0.1
|
||||
lxml>=4.9.3
|
||||
@@ -42,7 +42,8 @@ rem MAGE
|
||||
mkdir pamhyr\mage
|
||||
copy /y ..\mage-windows\mage.exe pamhyr\mage\
|
||||
copy /y ..\mage-windows\mage_extraire.exe pamhyr\mage\
|
||||
copy /y ..\mage-windows\mailleurPF.exe pamhyr\mage\
|
||||
copy /y ..\mage-windows\mailleurTT.exe pamhyr\mage\
|
||||
copy /y ..\mage-windows\libbief.dll pamhyr\mage\
|
||||
|
||||
rem Copy tests_cases
|
||||
mkdir pamhyr\tests_cases
|
||||
@@ -52,10 +53,24 @@ copy /y ..\tests_cases\Saar\Saar.pamhyr pamhyr\tests_cases\Saar\
|
||||
rem Documentations
|
||||
mkdir pamhyr\doc
|
||||
mkdir pamhyr\doc\images
|
||||
copy /y ..\doc\users\documentation.pdf pamhyr\doc\Pamhyr2-users.pdf
|
||||
rem copy /y ..\doc\users\documentation.pdf pamhyr\doc\Pamhyr2-users.pdf
|
||||
copy /y ..\doc\dev\documentation.pdf pamhyr\doc\Pamhyr2-dev.pdf
|
||||
copy /y ..\doc\users\documentation.html pamhyr\doc\Pamhyr2-users.html
|
||||
copy /y ..\doc\mage8.pdf pamhyr\doc\mage8.pdf
|
||||
rem copy /y ..\doc\users\documentation.html pamhyr\doc\Pamhyr2-users.html
|
||||
copy /y ..\doc\dev\documentation.html pamhyr\doc\Pamhyr2-dev.html
|
||||
copy /y ..\doc\users\images\* pamhyr\doc\images
|
||||
copy /y ..\doc\dev\images\* pamhyr\doc\images
|
||||
copy /y ..\doc\images\* pamhyr\doc\images
|
||||
|
||||
rem Tuto
|
||||
mkdir pamhyr\doc\Tuto1\
|
||||
mkdir pamhyr\doc\Tuto1\data
|
||||
copy /y ..\doc\users\Tuto1\Hogneau_Engees2022.pdf pamhyr\doc\Tuto1\Hogneau_Engees2022.pdf
|
||||
copy /y ..\doc\users\Tuto1\step-by-step.pdf pamhyr\doc\Tuto1\Tuto1-en.pdf
|
||||
copy /y ..\doc\users\Tuto1\pas-a-pas.pdf pamhyr\doc\Tuto1\Tuto1-fr.pdf
|
||||
copy /y ..\doc\users\Tuto1\*.pamhyr pamhyr\doc\Tuto1\
|
||||
copy /y ..\doc\users\Tuto1\data\* pamhyr\doc\Tuto1\data\
|
||||
|
||||
rem TP charriage
|
||||
mkdir pamhyr\doc\TP_charriage
|
||||
copy /y ..\doc\users\TP_charriage\ pamhyr\doc\TP_charriage
|
||||
@@ -9,3 +9,4 @@ numpy>=1.24.2
|
||||
colorama>=0.4.3
|
||||
pyinstaller>=5.11.0
|
||||
shapely>=2.0.1
|
||||
lxml>=4.9.3
|
||||
@@ -24,6 +24,7 @@ from tools import flatten, timer
|
||||
from PyQt5.QtCore import QCoreApplication
|
||||
|
||||
from Checker.Checker import AbstractModelChecker, STATUS
|
||||
from Checker.Study import StudyGeometryChecker
|
||||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
@@ -195,3 +196,51 @@ class MageNetworkGraphChecker(AbstractModelChecker):
|
||||
self._summary = summary
|
||||
self._status = status
|
||||
return True
|
||||
|
||||
|
||||
class MageGeometryGuideLineChecker(StudyGeometryChecker):
|
||||
def __init__(self):
|
||||
super(MageGeometryGuideLineChecker, self).__init__()
|
||||
|
||||
self._name = _translate("Checker", "Mage geometry guide line checker")
|
||||
self._description = _translate(
|
||||
"Checker",
|
||||
"Check if exists geometry guide line is correctly defined \
|
||||
for each reaches of the study"
|
||||
)
|
||||
self._reachs = []
|
||||
|
||||
def run(self, study):
|
||||
ok = super(MageGeometryGuideLineChecker, self).run(study)
|
||||
|
||||
if not ok:
|
||||
return ok
|
||||
|
||||
river = study.river
|
||||
edges = river.enable_edges()
|
||||
|
||||
gls = []
|
||||
|
||||
for edge in edges:
|
||||
comp, incomp = edge.reach.compute_guidelines()
|
||||
if len(incomp) != 0:
|
||||
self._status = STATUS.WARNING
|
||||
self._summary = "incomplete_guideline"
|
||||
return False
|
||||
|
||||
gls.append(comp)
|
||||
|
||||
profiles = edge.reach.profiles
|
||||
for profile in profiles:
|
||||
if not profile.has_standard_named_points():
|
||||
self._status = STATUS.WARNING
|
||||
self._summary = "no_standard_guileline_defined"
|
||||
return False
|
||||
|
||||
for gl in gls[1:]:
|
||||
if len(gls[0].symmetric_difference(gl)) != 0:
|
||||
self._status = STATUS.WARNING
|
||||
self._summary = "no_all_reaches_do_not_have_same_defined"
|
||||
return False
|
||||
|
||||
return ok
|
||||
@@ -82,15 +82,15 @@ class StudyGeometryChecker(AbstractModelChecker):
|
||||
self._summary = "no_river_found"
|
||||
return False
|
||||
|
||||
edges = list(filter(lambda e: e.is_enable(), river.edges()))
|
||||
edges = river.enable_edges()
|
||||
if len(edges) == 0:
|
||||
self._status = STATUS.ERROR
|
||||
self._summary = "no_reach_defined"
|
||||
return False
|
||||
|
||||
for edge in edges:
|
||||
if edge.is_enable() and len(edge.reach.profiles) < 3:
|
||||
summary = f"no_geometry_defined"
|
||||
if len(edge.reach.profiles) < 2:
|
||||
summary = "no_geometry_defined"
|
||||
status = STATUS.ERROR
|
||||
ok = False
|
||||
self._reachs.append(edge)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# AMeshingTool.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
|
||||
class AMeshingTool(object):
|
||||
def __init__(self):
|
||||
super(AMeshingTool, self).__init__()
|
||||
|
||||
def meshing(self, reach, **kwargs):
|
||||
raise NotImplementedMethodeError(self, self.meshing)
|
||||
@@ -0,0 +1,324 @@
|
||||
# Mage.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import logging
|
||||
import tempfile
|
||||
|
||||
from ctypes import (
|
||||
cdll,
|
||||
byref, Structure,
|
||||
c_char_p, c_wchar_p,
|
||||
create_string_buffer,
|
||||
POINTER, c_void_p,
|
||||
c_int, c_double, c_bool
|
||||
)
|
||||
from PyQt5.QtCore import QProcess
|
||||
|
||||
from tools import logger_color_red, logger_color_reset
|
||||
from Meshing.AMeshingTool import AMeshingTool
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class MeshingWithMage(AMeshingTool):
|
||||
def __init__(self):
|
||||
super(MeshingWithMage, self).__init__()
|
||||
|
||||
self._init_bief_lib()
|
||||
|
||||
def _init_bief_lib(self):
|
||||
self._bief_lib = cdll.LoadLibrary(self._lib_path())
|
||||
|
||||
self._init_c_init_bief_from_geo_file()
|
||||
self._init_c_get_nb_sections()
|
||||
self._init_c_get_nb_points_section()
|
||||
self._init_c_set_bief_name()
|
||||
self._init_c_st_to_m_compl()
|
||||
self._init_c_interpolate_profils_pas_transversal()
|
||||
self._init_c_purge()
|
||||
self._init_c_output_bief()
|
||||
|
||||
@classmethod
|
||||
def _lib_path(cls):
|
||||
ext = "so" if os.name == "posix" else "dll"
|
||||
|
||||
return os.path.abspath(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"..", "..", "..", "mage", f"libbief.{ext}"
|
||||
)
|
||||
)
|
||||
|
||||
def _init_c_init_bief_from_geo_file(self):
|
||||
self._c_init_bief_from_geo_file = getattr(
|
||||
self._bief_lib, 'c_init_bief_from_geo_file'
|
||||
)
|
||||
self._c_init_bief_from_geo_file.argtypes = [
|
||||
c_char_p, POINTER(c_int), POINTER(c_int)
|
||||
]
|
||||
self._c_init_bief_from_geo_file.restype = None
|
||||
|
||||
def _init_c_get_nb_sections(self):
|
||||
self._c_get_nb_sections = getattr(self._bief_lib, 'c_get_nb_sections')
|
||||
self._c_get_nb_sections.argtypes = [POINTER(c_int)]
|
||||
self._c_get_nb_sections.restype = None
|
||||
|
||||
def _init_c_get_nb_points_section(self):
|
||||
self._c_get_nb_points_section = getattr(
|
||||
self._bief_lib, 'c_get_nb_points_section'
|
||||
)
|
||||
self._c_get_nb_points_section.argtypes = [
|
||||
POINTER(c_int), POINTER(c_int)
|
||||
]
|
||||
self._c_get_nb_points_section.restype = None
|
||||
|
||||
def _init_c_set_bief_name(self):
|
||||
self._c_set_bief_name = getattr(self._bief_lib, 'c_set_bief_name')
|
||||
self._c_set_bief_name.argtypes = [c_char_p]
|
||||
self._c_set_bief_name.restype = None
|
||||
|
||||
def _init_c_st_to_m_compl(self):
|
||||
self._c_st_to_m_compl = getattr(self._bief_lib, 'c_st_to_m_compl')
|
||||
self._c_st_to_m_compl.argtypes = [POINTER(c_int), c_char_p, c_char_p]
|
||||
self._c_st_to_m_compl.restype = None
|
||||
|
||||
def _init_c_interpolate_profils_pas_transversal(self):
|
||||
self._c_interpolate_profils_pas_transversal = getattr(
|
||||
self._bief_lib, 'c_interpolate_profils_pas_transversal'
|
||||
)
|
||||
self._c_interpolate_profils_pas_transversal.argtypes = [
|
||||
POINTER(c_int), POINTER(c_int),
|
||||
c_char_p, c_char_p,
|
||||
POINTER(c_double), POINTER(c_bool),
|
||||
POINTER(c_int), POINTER(c_bool)
|
||||
]
|
||||
self._c_interpolate_profils_pas_transversal.restype = None
|
||||
|
||||
def _init_c_purge(self):
|
||||
self._c_purge = getattr(self._bief_lib, 'c_purge')
|
||||
self._c_purge.argtypes = None
|
||||
self._c_purge.restype = None
|
||||
|
||||
def _init_c_output_bief(self):
|
||||
self._c_output_bief = getattr(self._bief_lib, 'c_output_bief')
|
||||
self._c_output_bief.argtypes = [c_char_p]
|
||||
self._c_output_bief.restype = None
|
||||
|
||||
#####################
|
||||
# Binding functions #
|
||||
#####################
|
||||
|
||||
def init_bief_from_geo_file(self, name, with_charriage, with_water):
|
||||
cname = create_string_buffer(name.encode())
|
||||
self._c_init_bief_from_geo_file(
|
||||
cname,
|
||||
byref(c_int(with_charriage)),
|
||||
byref(c_int(with_water))
|
||||
)
|
||||
|
||||
def get_nb_sections(self):
|
||||
nb_sections = c_int(0)
|
||||
self._c_get_nb_sections(byref(nb_sections))
|
||||
return nb_sections.value
|
||||
|
||||
def get_nb_points_section(self, section):
|
||||
nb_points = c_int(0)
|
||||
self._c_get_nb_points_section(
|
||||
byref(c_int(section)), byref(nb_points)
|
||||
)
|
||||
return nb_points.value
|
||||
|
||||
def set_bief_name(self, name):
|
||||
cname = create_string_buffer(name.encode())
|
||||
self._c_set_bief_name(cname)
|
||||
|
||||
def st_to_m_compl(self, npoints, tag1=' ', tag2=' '):
|
||||
cnpoints = c_int(npoints)
|
||||
ctag1 = create_string_buffer(tag1.encode())
|
||||
ctag2 = create_string_buffer(tag2.encode())
|
||||
|
||||
self._c_st_to_m_compl(byref(cnpoints), ctag1, ctag2)
|
||||
|
||||
def interpolate_profils_pas_transversal(self, limite1, limite2,
|
||||
directrice1, directrice2,
|
||||
pas, lplan=False,
|
||||
lm=3, lineaire=False):
|
||||
climite1 = c_int(limite1)
|
||||
climite2 = c_int(limite2)
|
||||
cpas = c_double(pas)
|
||||
clplan = c_bool(lplan)
|
||||
clm = c_int(lm)
|
||||
clineaire = c_bool(lineaire)
|
||||
cdirectrice1 = create_string_buffer(directrice1.encode())
|
||||
cdirectrice2 = create_string_buffer(directrice2.encode())
|
||||
|
||||
self._c_interpolate_profils_pas_transversal(
|
||||
byref(climite1), byref(climite2),
|
||||
cdirectrice1, cdirectrice2,
|
||||
byref(cpas), byref(clplan),
|
||||
byref(clm), byref(clineaire)
|
||||
)
|
||||
|
||||
def output_bief(self, name):
|
||||
cname = create_string_buffer(name.encode())
|
||||
self._c_output_bief(cname)
|
||||
|
||||
###########
|
||||
# Meshing #
|
||||
###########
|
||||
|
||||
def meshing(self, reach, step: float = 50):
|
||||
if reach is None or len(reach.profiles) == 0:
|
||||
return reach
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
st_file = self.export_reach_to_st(reach, tmp)
|
||||
m_file = st_file.rsplit(".ST", 1)[0] + ".M"
|
||||
|
||||
self.load_st_file(st_file)
|
||||
|
||||
ns, npts_max = self.get_reach_stat()
|
||||
|
||||
gl = reach.compute_guidelines()
|
||||
|
||||
# we make sure that the lines are in the left-to-right order
|
||||
guide_list = [
|
||||
x.name
|
||||
for x in reach.profiles[0].named_points()
|
||||
if x.name in gl[0]
|
||||
]
|
||||
|
||||
self.complete_cross_section(guide_list)
|
||||
self.interpolate_cross_section(ns, step)
|
||||
self.purge()
|
||||
|
||||
self.export_to_m(m_file)
|
||||
|
||||
self.import_m_file(reach, m_file)
|
||||
return reach
|
||||
|
||||
def export_reach_to_st(self, reach, tmp):
|
||||
tmp_st = os.path.join(tmp, "meshing.ST")
|
||||
|
||||
logger.debug(f"meshing: Export ST to {tmp_st}")
|
||||
|
||||
reach.export_reach(tmp_st)
|
||||
return tmp_st
|
||||
|
||||
def load_st_file(self, st):
|
||||
self.init_bief_from_geo_file(st, 0, 0)
|
||||
self.set_bief_name("tmp")
|
||||
|
||||
def get_reach_stat(self):
|
||||
ns = self.get_nb_sections()
|
||||
npts_max = max(
|
||||
map(
|
||||
lambda i: self.get_nb_points_section(i),
|
||||
range(1, ns)
|
||||
)
|
||||
)
|
||||
|
||||
return ns, npts_max
|
||||
|
||||
def complete_cross_section(self, gl=[]):
|
||||
gl1 = ["un"] + gl
|
||||
gl2 = gl + ["np"]
|
||||
|
||||
for gls in zip(gl1, gl2):
|
||||
self.st_to_m_compl(0, gls[0], gls[1])
|
||||
|
||||
def interpolate_cross_section(self, ns, step: float):
|
||||
self.interpolate_profils_pas_transversal(
|
||||
1, ns,
|
||||
'un', 'np',
|
||||
step
|
||||
)
|
||||
|
||||
def purge(self):
|
||||
self._c_purge()
|
||||
|
||||
def export_to_m(self, m):
|
||||
self.output_bief(m)
|
||||
|
||||
def import_m_file(self, reach, m):
|
||||
reach.purge()
|
||||
|
||||
logger.debug(f"meshing: Import geometry from {m}")
|
||||
reach.import_geometry(m)
|
||||
|
||||
|
||||
class MeshingWithMageMailleurTT(AMeshingTool):
|
||||
def __init__(self):
|
||||
super(MeshingWithMageMailleurTT, self).__init__()
|
||||
|
||||
@classmethod
|
||||
def _exe_path(cls):
|
||||
ext = "" if os.name == "posix" else ".exe"
|
||||
|
||||
return os.path.abspath(
|
||||
os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"..", "..", "..", "mage", f"mailleurTT{ext}"
|
||||
)
|
||||
)
|
||||
|
||||
###########
|
||||
# Meshing #
|
||||
###########
|
||||
|
||||
def meshing(self, reach, step: float = 50):
|
||||
if reach is None or len(reach.profiles) == 0:
|
||||
return reach
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
logger.debug(f"temp file: {tmp}")
|
||||
st_file = self.export_reach_to_st(reach, tmp)
|
||||
m_file = st_file.rsplit(".ST", 1)[0] + ".M"
|
||||
|
||||
proc = QProcess()
|
||||
proc.setWorkingDirectory(tmp)
|
||||
|
||||
logger.debug(f"! mailleurTT {st_file} {m_file} {str(step)}")
|
||||
proc.start(
|
||||
self._exe_path(), [st_file, m_file, str(step)]
|
||||
)
|
||||
proc.waitForFinished()
|
||||
|
||||
errors = proc.readAllStandardError()
|
||||
if len(errors) != 0:
|
||||
logger.error(
|
||||
f"{logger_color_red()}{errors}{logger_color_reset()}"
|
||||
)
|
||||
else:
|
||||
self.import_m_file(reach, m_file)
|
||||
return reach
|
||||
|
||||
def export_reach_to_st(self, reach, tmp):
|
||||
tmp_st = os.path.join(tmp, "meshing.ST")
|
||||
|
||||
logger.debug(f"meshing: Export ST to {tmp_st}")
|
||||
|
||||
reach.export_reach(tmp_st)
|
||||
return tmp_st
|
||||
|
||||
def import_m_file(self, reach, m):
|
||||
reach.purge()
|
||||
|
||||
logger.debug(f"meshing: Import geometry from {m}")
|
||||
reach.import_geometry(m)
|
||||
@@ -0,0 +1,17 @@
|
||||
# __init__.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
@@ -0,0 +1,37 @@
|
||||
# test_Model.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import warnings
|
||||
import tempfile
|
||||
|
||||
from Model.Saved import SavedStatus
|
||||
from Model.Study import Study
|
||||
from Model.River import River
|
||||
|
||||
from Meshing.Mage import MeshingWithMage
|
||||
|
||||
mage_mesher = os.path.exists(MeshingWithMage._lib_path())
|
||||
|
||||
|
||||
class MeshingTestCase(unittest.TestCase):
|
||||
@unittest.skipIf(not mage_mesher, "libbief is not available")
|
||||
def test_create_meshingtool_mage(self):
|
||||
mesher = MeshingWithMage()
|
||||
self.assertNotEqual(mesher, None)
|
||||
@@ -51,7 +51,7 @@ class BoundaryCondition(SQLSubModel):
|
||||
BoundaryCondition._id_cnt = max(BoundaryCondition._id_cnt + 1, self.id)
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE boundary_condition(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
@@ -77,7 +77,7 @@ class BoundaryCondition(SQLSubModel):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
@@ -102,7 +102,7 @@ class BoundaryCondition(SQLSubModel):
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
tab = data["tab"]
|
||||
|
||||
@@ -144,7 +144,7 @@ class BoundaryCondition(SQLSubModel):
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
tab = data["tab"]
|
||||
|
||||
execute(f"DELETE FROM boundary_condition WHERE id = {self.id}")
|
||||
@@ -158,16 +158,16 @@ class BoundaryCondition(SQLSubModel):
|
||||
"INSERT INTO " +
|
||||
"boundary_condition(id, name, type, tab, node) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, '{self._sql_format(self._name)}', " +
|
||||
f"'{self._sql_format(self._type)}', '{tab}', {node}" +
|
||||
f"{self.id}, '{self._db_format(self._name)}', " +
|
||||
f"'{self._db_format(self._type)}', '{tab}', {node}" +
|
||||
")"
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
ind = 0
|
||||
for d in self._data:
|
||||
data0 = self._sql_format(str(d[0]))
|
||||
data1 = self._sql_format(str(d[1]))
|
||||
data0 = self._db_format(str(d[0]))
|
||||
data1 = self._db_format(str(d[1]))
|
||||
|
||||
sql = (
|
||||
"INSERT INTO " +
|
||||
@@ -188,8 +188,13 @@ class BoundaryCondition(SQLSubModel):
|
||||
|
||||
@classmethod
|
||||
def time_convert(cls, data):
|
||||
if data is str and data.count(":") == 3:
|
||||
return old_pamhyr_date_to_timestamp(data)
|
||||
if type(data) is str:
|
||||
if data.count(":") == 3:
|
||||
return old_pamhyr_date_to_timestamp(data)
|
||||
if data.count(":") == 2:
|
||||
return old_pamhyr_date_to_timestamp("00:" + data)
|
||||
if data.count(".") == 1:
|
||||
return round(float(data))
|
||||
|
||||
return int(data)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class BoundaryConditionList(PamhyrModelListWithTab):
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = cls(status=data['status'])
|
||||
|
||||
if data is None:
|
||||
@@ -46,13 +46,13 @@ class BoundaryConditionList(PamhyrModelListWithTab):
|
||||
|
||||
for tab in new._tabs:
|
||||
data["tab"] = tab
|
||||
new._tabs[tab] = BoundaryCondition._sql_load(
|
||||
new._tabs[tab] = BoundaryCondition._db_load(
|
||||
execute, data
|
||||
)
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
execute("DELETE FROM boundary_condition")
|
||||
|
||||
if data is None:
|
||||
@@ -61,7 +61,7 @@ class BoundaryConditionList(PamhyrModelListWithTab):
|
||||
for tab in self._tabs:
|
||||
data["tab"] = tab
|
||||
for bc in self._tabs[tab]:
|
||||
bc._sql_save(execute, data=data)
|
||||
bc._db_save(execute, data=data)
|
||||
|
||||
return True
|
||||
|
||||
@@ -89,3 +89,16 @@ class BoundaryConditionList(PamhyrModelListWithTab):
|
||||
|
||||
def copy(self):
|
||||
return copy(self)
|
||||
|
||||
def get_assoc_to_node(self, tab, node):
|
||||
assoc = list(
|
||||
filter(
|
||||
lambda i: i.node is node,
|
||||
self._tabs[tab]
|
||||
)
|
||||
)
|
||||
|
||||
if len(assoc) > 0:
|
||||
return assoc[0]
|
||||
|
||||
return None
|
||||
@@ -179,3 +179,38 @@ class ClipboardFormatError(ExeceptionWithMessageBox):
|
||||
|
||||
def message(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class ExternFileMissingError(ExeceptionWithMessageBox):
|
||||
def __init__(self, module="mage", filename="libbief", path="??/libbief.so",
|
||||
src_except=None):
|
||||
super(ExternFileMissingError, self).__init__(
|
||||
title=_translate(
|
||||
"Exception", "External file dependence is missing"
|
||||
)
|
||||
)
|
||||
|
||||
self.msg = _translate(
|
||||
"Exception",
|
||||
"'@file' is missing for module @module:\n'@path'"
|
||||
)
|
||||
self.msg = self.msg.replace("@file", filename)
|
||||
self.msg = self.msg.replace("@module", module)
|
||||
self.msg = self.msg.replace("@path", path)
|
||||
|
||||
if src_except is not None:
|
||||
self.msg = self.msg + "\n\n" + f"Exception: {src_except}"
|
||||
|
||||
self.alert()
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
def header(self):
|
||||
return _translate("Exception", "External file dependence is missing")
|
||||
|
||||
def short_message(self):
|
||||
return _translate("Exception", "External file dependence is missing")
|
||||
|
||||
def message(self):
|
||||
return self.msg
|
||||
@@ -16,10 +16,14 @@
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class Friction(SQLSubModel):
|
||||
def __init__(self, name: str = "", status=None):
|
||||
@@ -35,16 +39,16 @@ class Friction(SQLSubModel):
|
||||
self._end_strickler = None
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE friction(
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
ind INTERGER NOT NULL,
|
||||
ind INTEGER NOT NULL,
|
||||
begin_kp REAL NOT NULL,
|
||||
end_kp REAL NOT NULL,
|
||||
reach INTEGER NOT NULL,
|
||||
begin_strickler INTERGER,
|
||||
end_strickler INTERGER,
|
||||
begin_strickler INTEGER NOT NULL,
|
||||
end_strickler INTEGER NOT NULL,
|
||||
FOREIGN KEY(reach) REFERENCES river_reach(id),
|
||||
FOREIGN KEY(begin_strickler) REFERENCES stricklers(id),
|
||||
FOREIGN KEY(end_strickler) REFERENCES stricklers(id)
|
||||
@@ -54,13 +58,14 @@ class Friction(SQLSubModel):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
reach = data["parent"] # Reach object
|
||||
|
||||
reach = data["reach"]
|
||||
status = data["status"]
|
||||
stricklers = data["stricklers"].stricklers
|
||||
|
||||
@@ -69,14 +74,18 @@ class Friction(SQLSubModel):
|
||||
f"FROM friction WHERE reach = {reach.id}"
|
||||
)
|
||||
|
||||
for _ in table:
|
||||
new.append(None)
|
||||
|
||||
for row in table:
|
||||
ind = row[0]
|
||||
# Get stricklers
|
||||
bs = next(filter(lambda s: s.id == row[3], stricklers))
|
||||
es = next(filter(lambda s: s.id == row[4], stricklers))
|
||||
if int(row[3]) == -1:
|
||||
bs = None
|
||||
else:
|
||||
bs = next(filter(lambda s: s.id == row[3], stricklers))
|
||||
|
||||
if int(row[4]) == -1:
|
||||
es = None
|
||||
else:
|
||||
es = next(filter(lambda s: s.id == row[4], stricklers))
|
||||
|
||||
# Create friction
|
||||
sec = cls(status=status)
|
||||
@@ -86,10 +95,21 @@ class Friction(SQLSubModel):
|
||||
sec.begin_strickler = bs
|
||||
sec.end_strickler = es
|
||||
|
||||
yield ind, sec
|
||||
new.append((ind, sec))
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
ind = data["ind"]
|
||||
|
||||
b_s_id = -1
|
||||
e_s_id = -1
|
||||
|
||||
if self._begin_strickler is not None:
|
||||
b_s_id = self._begin_strickler.id
|
||||
if self._end_strickler is not None:
|
||||
e_s_id = self._end_strickler.id
|
||||
|
||||
execute(
|
||||
"INSERT INTO " +
|
||||
"friction(ind, begin_kp, end_kp, " +
|
||||
@@ -97,7 +117,7 @@ class Friction(SQLSubModel):
|
||||
"VALUES (" +
|
||||
f"{ind}, {self._begin_kp}, {self._end_kp}, " +
|
||||
f"{self._edge.id}, " +
|
||||
f"{self._begin_strickler.id}, {self._end_strickler.id}" +
|
||||
f"{b_s_id}, {e_s_id}" +
|
||||
")"
|
||||
)
|
||||
|
||||
@@ -116,6 +136,10 @@ class Friction(SQLSubModel):
|
||||
def edge(self):
|
||||
return self._edge
|
||||
|
||||
@property
|
||||
def reach(self):
|
||||
return self._edge
|
||||
|
||||
@edge.setter
|
||||
def edge(self, edge):
|
||||
self._edge = edge
|
||||
@@ -129,6 +153,15 @@ class Friction(SQLSubModel):
|
||||
def has_edge(self):
|
||||
return self._edge is not None
|
||||
|
||||
def has_coefficient(self):
|
||||
return (
|
||||
self._begin_strickler is not None and
|
||||
self._end_strickler is not None
|
||||
)
|
||||
|
||||
def is_full_defined(self):
|
||||
return self.has_edge() and self.has_coefficient()
|
||||
|
||||
@property
|
||||
def begin_kp(self):
|
||||
return self._begin_kp
|
||||
|
||||
@@ -35,36 +35,40 @@ class FrictionList(PamhyrModelList):
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def _sql_update_0_0_1(cls, execute, version):
|
||||
def _db_update_0_0_1(cls, execute, version):
|
||||
execute("ALTER TABLE `section` RENAME TO `friction`")
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
if version == "0.0.0":
|
||||
logger.info(f"Update friction TABLE from {version}")
|
||||
cls._sql_update_0_0_1(execute, version)
|
||||
cls._db_update_0_0_1(execute, version)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = cls(status=data['status'])
|
||||
|
||||
new._lst = Friction._sql_load(
|
||||
ilst = Friction._db_load(
|
||||
execute, data
|
||||
)
|
||||
|
||||
new._lst = list(map(lambda x: x[1], sorted(ilst)))
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
frictions = self.lst
|
||||
|
||||
reach = data["reach"]
|
||||
execute(f"DELETE FROM friction WHERE reach = {reach.id}")
|
||||
|
||||
ok = True
|
||||
ind = 0
|
||||
for friction in self._lst:
|
||||
for friction in frictions:
|
||||
data["ind"] = ind
|
||||
ok &= friction._sql_save(execute, data=data)
|
||||
ok &= friction._db_save(execute, data=data)
|
||||
ind += 1
|
||||
|
||||
return ok
|
||||
|
||||
@@ -36,7 +36,7 @@ class PointXYZ(Point, SQLSubModel):
|
||||
self._z = float(z)
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE geometry_pointXYZ(
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -55,7 +55,7 @@ class PointXYZ(Point, SQLSubModel):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
cls._update_submodel(execute, version)
|
||||
|
||||
major, minor, release = version.strip().split(".")
|
||||
@@ -71,7 +71,7 @@ class PointXYZ(Point, SQLSubModel):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
status = data["status"]
|
||||
profile = data["profile"]
|
||||
|
||||
@@ -109,17 +109,17 @@ class PointXYZ(Point, SQLSubModel):
|
||||
|
||||
yield ind, new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
profile = data["profile"]
|
||||
ind = data["ind"]
|
||||
|
||||
sl = self._sl.id if self._sl is not None else -1
|
||||
|
||||
sql = (
|
||||
"INSERT OR REPLACE INTO " +
|
||||
"INSERT INTO " +
|
||||
"geometry_pointXYZ(ind, name, x, y, z, profile, sl) " +
|
||||
"VALUES (" +
|
||||
f"{ind}, '{self._sql_format(self._name)}', " +
|
||||
f"{ind}, '{self._db_format(self._name)}', " +
|
||||
f"{self.x}, {self.y}, {self.z}, " +
|
||||
f"{profile.id}, {sl}" +
|
||||
")"
|
||||
|
||||
@@ -214,31 +214,17 @@ class Profile(object):
|
||||
self.points.insert(index, point)
|
||||
self._status.modified()
|
||||
|
||||
def delete(self, indexes: int):
|
||||
"""Delete points at index
|
||||
|
||||
Args:
|
||||
indexes: List of index of points.
|
||||
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
points = set(
|
||||
def delete_i(self, indexes: list):
|
||||
self._points = list(
|
||||
map(
|
||||
lambda e: e[1],
|
||||
filter(
|
||||
lambda e: e[0] in indexes,
|
||||
lambda e: e[0] not in indexes,
|
||||
enumerate(self.points)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
self.points = list(
|
||||
filter(
|
||||
lambda p: p not in points,
|
||||
self.points
|
||||
)
|
||||
)
|
||||
self._status.modified()
|
||||
|
||||
def delete_points(self, points):
|
||||
@@ -250,7 +236,7 @@ class Profile(object):
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
self.points = list(
|
||||
self._points = list(
|
||||
filter(
|
||||
lambda p: p not in points,
|
||||
self.points
|
||||
@@ -286,7 +272,7 @@ class Profile(object):
|
||||
elif column == 'z':
|
||||
def predicate(p): return p.z
|
||||
|
||||
self.points = sorted(
|
||||
self._points = sorted(
|
||||
self.points,
|
||||
key=predicate,
|
||||
reverse=is_reversed
|
||||
@@ -298,7 +284,7 @@ class Profile(object):
|
||||
if len(self.points) != len(indexes):
|
||||
logger.critical("Indexes list do not correspond to point list")
|
||||
|
||||
self.points = list(
|
||||
self._points = list(
|
||||
map(
|
||||
lambda x: x[1],
|
||||
sorted(
|
||||
@@ -345,3 +331,13 @@ class Profile(object):
|
||||
# Abstract method, must be implemented for in non abstract class
|
||||
def get_station(self):
|
||||
raise NotImplementedMethodeError(self, self.get_station)
|
||||
|
||||
# Computation method
|
||||
|
||||
# Abstract method for width approximation
|
||||
def width_approximation(self):
|
||||
raise NotImplementedMethodeError(self, self.width_approximation)
|
||||
|
||||
# Abstract method for width approximation
|
||||
def get_water_limits(self, z):
|
||||
raise NotImplementedMethodeError(self, self.get_water_limits)
|
||||
@@ -19,6 +19,7 @@
|
||||
import logging
|
||||
import numpy as np
|
||||
from typing import List
|
||||
from functools import reduce
|
||||
|
||||
from tools import timer
|
||||
|
||||
@@ -69,7 +70,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE geometry_profileXYZ(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
@@ -89,7 +90,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
major, minor, release = version.strip().split(".")
|
||||
if major == minor == "0":
|
||||
if int(release) < 2:
|
||||
@@ -104,7 +105,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
return cls._update_submodel(execute, version)
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
profiles = []
|
||||
status = data["status"]
|
||||
reach = data["reach"]
|
||||
@@ -115,9 +116,6 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
f"WHERE reach = {reach.id}"
|
||||
)
|
||||
|
||||
for _ in table:
|
||||
profiles.append(None)
|
||||
|
||||
for row in table:
|
||||
id = row[0]
|
||||
ind = row[1]
|
||||
@@ -132,7 +130,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
id=id, num=num,
|
||||
name=name, kp=kp,
|
||||
code1=code1, code2=code2,
|
||||
reach=data["parent"],
|
||||
reach=reach,
|
||||
status=status
|
||||
)
|
||||
|
||||
@@ -147,15 +145,11 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
)
|
||||
|
||||
data["profile"] = new
|
||||
new._points = PointXYZ._sql_load(execute, data.copy())
|
||||
new._points = PointXYZ._db_load(execute, data.copy())
|
||||
|
||||
yield ind, new
|
||||
|
||||
# profiles[ind] = new
|
||||
|
||||
# return profiles
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
ok = True
|
||||
ind = data["ind"]
|
||||
|
||||
@@ -166,20 +160,22 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
"geometry_profileXYZ(id, ind, name, reach, " +
|
||||
"kp, num, code1, code2, sl) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, {ind}, '{self._sql_format(self._name)}', " +
|
||||
f"{self.id}, {ind}, '{self._db_format(self._name)}', " +
|
||||
f"{self.reach.id}, {self.kp}, {self.num}, " +
|
||||
f"{self.code1}, {self.code1}, {sl}" +
|
||||
")"
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
points = self.points
|
||||
|
||||
data["profile"] = self
|
||||
execute(f"DELETE FROM geometry_pointXYZ WHERE profile = {self.id}")
|
||||
|
||||
ind = 0
|
||||
for point in self.points:
|
||||
for point in points:
|
||||
data["ind"] = ind
|
||||
ok &= point._sql_save(execute, data)
|
||||
ok &= point._db_save(execute, data)
|
||||
ind += 1
|
||||
|
||||
return ok
|
||||
@@ -189,11 +185,20 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
profile = None
|
||||
try:
|
||||
if len(header) == 0:
|
||||
name = data[0]
|
||||
kp = data[1]
|
||||
reach = data[2]
|
||||
status = data[3]
|
||||
|
||||
profile = cls(
|
||||
*data
|
||||
id=-1,
|
||||
name=name,
|
||||
kp=kp,
|
||||
reach=reach,
|
||||
status=status
|
||||
)
|
||||
else:
|
||||
valid_header = {'name', 'reach', 'kp'}
|
||||
valid_header = {'name', 'reach', 'kp', 'status'}
|
||||
d = {}
|
||||
for i, v in enumerate(data):
|
||||
h = header[i].strip().lower().split(' ')[0]
|
||||
@@ -202,16 +207,27 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
|
||||
profile = cls(**d)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
raise ClipboardFormatError(header, data)
|
||||
|
||||
return profile
|
||||
|
||||
def point_from_data(self, header, data):
|
||||
def float_format(s: str):
|
||||
return float(
|
||||
s.replace(",", ".")
|
||||
)
|
||||
|
||||
point = None
|
||||
try:
|
||||
if len(header) == 0:
|
||||
x = float_format(data[0])
|
||||
y = float_format(data[1])
|
||||
z = float_format(data[2])
|
||||
name = data[3] if len(data) == 4 else ""
|
||||
|
||||
point = PointXYZ(
|
||||
*data, profile=self, status=self._status
|
||||
x, y, z, name, profile=self, status=self._status
|
||||
)
|
||||
else:
|
||||
valid_header = {'name', 'x', 'y', 'z'}
|
||||
@@ -285,6 +301,43 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
except IndexError:
|
||||
raise IndexError(f"Invalid point index: {index}")
|
||||
|
||||
def get_point_by_name(self, name: str) -> PointXYZ:
|
||||
"""Get point by name.
|
||||
|
||||
Args:
|
||||
name: Point name.
|
||||
|
||||
Returns:
|
||||
The point.
|
||||
"""
|
||||
try:
|
||||
n_name = name.lower().strip()
|
||||
return next(
|
||||
filter(
|
||||
lambda p: p.name.lower().strip() == n_name,
|
||||
self.points
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
logger.debug(f"{e}")
|
||||
raise IndexError(
|
||||
f"Invalid point name: {name} " +
|
||||
f"for profile ({self.id}) kp = {self.kp}"
|
||||
)
|
||||
|
||||
def has_standard_named_points(self):
|
||||
l, r = reduce(
|
||||
lambda acc, n: (
|
||||
(acc[0] | (n == "rg")),
|
||||
(acc[1] | (n == "rd"))
|
||||
),
|
||||
map(lambda p: p.name.lower().strip(),
|
||||
self.points),
|
||||
(False, False)
|
||||
)
|
||||
|
||||
return l & r
|
||||
|
||||
def add(self):
|
||||
"""Add a new PointXYZ to profile.
|
||||
|
||||
@@ -413,3 +466,69 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||
constant = station[index_profile_z_min[0]]
|
||||
|
||||
return list(map(lambda s: s - constant, station))
|
||||
|
||||
def width_approximation(self):
|
||||
if self.has_standard_named_points():
|
||||
rg = self.get_point_by_name("rg")
|
||||
rd = self.get_point_by_name("rd")
|
||||
else:
|
||||
rg = self.points[0]
|
||||
rd = self.points[-1]
|
||||
|
||||
return abs(rg.dist(rd))
|
||||
|
||||
def get_water_limits(self, z):
|
||||
# ====================================================================
|
||||
# détermination des points limites RG et RD pour un niveau
|
||||
# d'eau donné
|
||||
#
|
||||
# irg et ird sont les premiers indices en partant des rives
|
||||
# gauche et droite qui correspondent à des points sous la
|
||||
# surface de l'eau ptX et ptY sont les points interpolés où
|
||||
# le plan d'eau intersecte le profil known_level est le
|
||||
# niveau d'eau pour lequel on a obtenu irg, ird, ptX et ptY
|
||||
# ====================================================================
|
||||
|
||||
# initialisation
|
||||
irg = -1
|
||||
ird = -1
|
||||
|
||||
for i in range(self.number_points):
|
||||
if self.point(i).z <= z:
|
||||
irg = i
|
||||
|
||||
for i in reversed(range(self.number_points)):
|
||||
if self.point(i).z <= z:
|
||||
ird = i
|
||||
|
||||
# interpolation des points ptX et ptY
|
||||
if (irg < self.number_points - 1):
|
||||
x = np.interp(
|
||||
z,
|
||||
[self.point(irg).z, self.point(irg + 1).z],
|
||||
[self.point(irg).x, self.point(irg + 1).x]
|
||||
)
|
||||
y = np.interp(
|
||||
z,
|
||||
[self.point(irg).z, self.point(irg + 1).z],
|
||||
[self.point(irg).y, self.point(irg + 1).y]
|
||||
)
|
||||
ptX = PointXYZ(x, y, z)
|
||||
else:
|
||||
ptX = self.point(0)
|
||||
if (ird > 0):
|
||||
x = np.interp(
|
||||
z,
|
||||
[self.point(ird-1).z, self.point(ird).z],
|
||||
[self.point(ird-1).x, self.point(ird).x]
|
||||
)
|
||||
y = np.interp(
|
||||
z,
|
||||
[self.point(ird).z, self.point(ird - 1).z],
|
||||
[self.point(ird).y, self.point(ird - 1).y]
|
||||
)
|
||||
ptY = PointXYZ(x, y, z)
|
||||
else:
|
||||
ptY = self.point(self.number_points - 1)
|
||||
|
||||
return ptX, ptY
|
||||
@@ -25,7 +25,7 @@ from copy import deepcopy
|
||||
from operator import itemgetter
|
||||
from functools import reduce
|
||||
|
||||
from tools import flatten, timer, trace
|
||||
from tools import flatten, timer, trace, logger_exception
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
|
||||
@@ -52,36 +52,37 @@ class Reach(SQLSubModel):
|
||||
self._guidelines = {}
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
return cls._update_submodel(execute, version)
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
new = cls(status=data["status"], parent=data["parent"])
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = cls(status=data["status"], parent=data["reach"])
|
||||
|
||||
new._profiles = ProfileXYZ._sql_load(
|
||||
new._profiles = ProfileXYZ._db_load(
|
||||
execute,
|
||||
data=data
|
||||
)
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
profiles = self.profiles
|
||||
|
||||
# Delete old data
|
||||
execute(f"DELETE FROM geometry_profileXYZ WHERE reach = {self.id}")
|
||||
# execute(f"DELETE FROM geometry_pointXYZ")
|
||||
|
||||
if data is None:
|
||||
data = {}
|
||||
|
||||
ind = 0
|
||||
for profile in self.profiles:
|
||||
for profile in profiles:
|
||||
data["ind"] = ind
|
||||
profile._sql_save(execute, data)
|
||||
profile._db_save(execute, data)
|
||||
ind += 1
|
||||
|
||||
return True
|
||||
@@ -134,6 +135,10 @@ class Reach(SQLSubModel):
|
||||
|
||||
return self._profiles
|
||||
|
||||
@profiles.setter
|
||||
def profiles(self, profiles):
|
||||
self._profiles = profiles
|
||||
|
||||
def get_profiles_from_kp(self, kp):
|
||||
return list(
|
||||
filter(
|
||||
@@ -215,7 +220,7 @@ class Reach(SQLSubModel):
|
||||
)
|
||||
)
|
||||
|
||||
self.profiles = list(
|
||||
self._profiles = list(
|
||||
filter(
|
||||
lambda p: p not in profiles,
|
||||
self.profiles
|
||||
@@ -233,7 +238,7 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
self.profiles = list(
|
||||
self._profiles = list(
|
||||
filter(
|
||||
lambda p: p not in profiles,
|
||||
self.profiles
|
||||
@@ -242,6 +247,11 @@ class Reach(SQLSubModel):
|
||||
self._update_profile_numbers()
|
||||
self._status.modified()
|
||||
|
||||
def purge(self):
|
||||
self._profiles = []
|
||||
self._update_profile_numbers()
|
||||
self._status.modified()
|
||||
|
||||
def move_up_profile(self, index: int):
|
||||
if index < len(self.profiles):
|
||||
next = index - 1
|
||||
@@ -259,13 +269,37 @@ class Reach(SQLSubModel):
|
||||
self._status.modified()
|
||||
|
||||
def get_x(self):
|
||||
return [profile.x() for profile in self.profiles]
|
||||
return list(
|
||||
map(
|
||||
lambda profile: profile.x(),
|
||||
filter(
|
||||
lambda profile: len(profile) > 0,
|
||||
self.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def get_y(self):
|
||||
return [profile.y() for profile in self.profiles]
|
||||
return list(
|
||||
map(
|
||||
lambda profile: profile.y(),
|
||||
filter(
|
||||
lambda profile: len(profile) > 0,
|
||||
self.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def get_z(self):
|
||||
return [profile.z() for profile in self.profiles]
|
||||
return list(
|
||||
map(
|
||||
lambda profile: profile.z(),
|
||||
filter(
|
||||
lambda profile: len(profile) > 0,
|
||||
self.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def get_z_min(self):
|
||||
"""List of z min for each profile
|
||||
@@ -273,7 +307,15 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
List of z min for each profile
|
||||
"""
|
||||
return [profile.z_min() for profile in self.profiles]
|
||||
return list(
|
||||
map(
|
||||
lambda profile: profile.z_min(),
|
||||
filter(
|
||||
lambda profile: len(profile) > 0,
|
||||
self.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def get_z_max(self):
|
||||
"""List of z max for each profile
|
||||
@@ -281,7 +323,15 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
List of z max for each profile
|
||||
"""
|
||||
return [profile.z_max() for profile in self.profiles]
|
||||
return list(
|
||||
map(
|
||||
lambda profile: profile.z_max(),
|
||||
filter(
|
||||
lambda profile: len(profile) > 0,
|
||||
self.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def get_kp(self):
|
||||
"""List of profiles kp
|
||||
@@ -291,11 +341,28 @@ class Reach(SQLSubModel):
|
||||
"""
|
||||
return [profile.kp for profile in self.profiles]
|
||||
|
||||
def get_kp_complete_profiles(self):
|
||||
return list(
|
||||
map(
|
||||
lambda profile: profile.kp,
|
||||
filter(
|
||||
lambda profile: len(profile) > 0,
|
||||
self.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
def get_kp_min(self):
|
||||
return min(self.get_kp())
|
||||
if len(self.get_kp()) > 0:
|
||||
return min(self.get_kp())
|
||||
else:
|
||||
return 0.0
|
||||
|
||||
def get_kp_max(self):
|
||||
return max(self.get_kp())
|
||||
if len(self.get_kp()) > 0:
|
||||
return max(self.get_kp())
|
||||
else:
|
||||
return 0.0
|
||||
|
||||
# Sediment Layers
|
||||
|
||||
@@ -364,7 +431,7 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
Tuple of complete and incomplete guidelines name.
|
||||
"""
|
||||
# Get all point contains into a guideline
|
||||
# Get all point contained into a guideline
|
||||
named_points = [profile.named_points() for profile in self.profiles]
|
||||
points_name = list(
|
||||
map(
|
||||
@@ -477,8 +544,7 @@ class Reach(SQLSubModel):
|
||||
Returns:
|
||||
Nothing.
|
||||
"""
|
||||
list_profile = []
|
||||
list_header = []
|
||||
imported_profiles = []
|
||||
|
||||
try:
|
||||
list_profile, list_header = self.read_file_st(str(file_path_name))
|
||||
@@ -495,9 +561,8 @@ class Reach(SQLSubModel):
|
||||
**d, reach=self, status=self._status
|
||||
)
|
||||
prof.import_points(profile)
|
||||
self.profiles.append(prof)
|
||||
self._update_profile_numbers()
|
||||
|
||||
imported_profiles.append(prof)
|
||||
self._status.modified()
|
||||
except FileNotFoundError as e:
|
||||
logger.error(e)
|
||||
@@ -505,6 +570,11 @@ class Reach(SQLSubModel):
|
||||
except FileFormatError as e:
|
||||
logger.error(e)
|
||||
e.alert()
|
||||
finally:
|
||||
self.profiles = imported_profiles + self.profiles
|
||||
|
||||
self._update_profile_numbers()
|
||||
return imported_profiles
|
||||
|
||||
@timer
|
||||
def read_file_st(self, filename):
|
||||
@@ -520,6 +590,8 @@ class Reach(SQLSubModel):
|
||||
list_header = []
|
||||
stop_code = "999.999"
|
||||
|
||||
logger.debug(f"Import geometry from {filename}")
|
||||
|
||||
with open(filename, encoding="utf-8") as file_st:
|
||||
for line in file_st:
|
||||
if not (line.startswith("#") or line.startswith("*")):
|
||||
@@ -558,18 +630,132 @@ class Reach(SQLSubModel):
|
||||
|
||||
# TODO: Move this function to model reach
|
||||
def export_reach(self, filename):
|
||||
with open(f"{filename}", "w") as file_st:
|
||||
for index in range(len(self.profiles)):
|
||||
profile = self.profiles[index]
|
||||
with open(f"{filename}", "w") as st:
|
||||
cnt = 0
|
||||
for profile in self.profiles:
|
||||
num = f"{cnt:>6}"
|
||||
c1 = f"{profile.code1:>6}"
|
||||
c2 = f"{profile.code2:>6}"
|
||||
t = f"{len(profile.points):>6}"
|
||||
kp = f"{profile.kp:>12f}"[0:12]
|
||||
pname = profile.name
|
||||
if profile.name == "":
|
||||
pname = f"p{profile.id:>3}".replace(" ", "0")
|
||||
|
||||
for v in profile.header:
|
||||
file_st.write(f"{v:>6}")
|
||||
file_st.write("\n")
|
||||
st.write(f"{num}{c1}{c2}{t} {kp} {pname}\n")
|
||||
|
||||
for point in self._data.profile[index_pro].points:
|
||||
for i in [point.x, point.y, point.z, point.name]:
|
||||
file_st.write(f"{i:>13.4f}")
|
||||
file_st.write("\n")
|
||||
for point in profile.points:
|
||||
x = f"{point.x:<12.4f}"[0:12]
|
||||
y = f"{point.y:<12.4f}"[0:12]
|
||||
z = f"{point.z:<12.4f}"[0:12]
|
||||
n = f"{point.name:<3}"
|
||||
|
||||
file_st.write(" 999.9990 999.9990 999.9990")
|
||||
file_st.write("\n")
|
||||
st.write(f"{x} {y} {z} {n}\n")
|
||||
|
||||
st.write(" 999.9990 999.9990 999.9990")
|
||||
st.write("\n")
|
||||
cnt += 1
|
||||
|
||||
def get_incline(self):
|
||||
first = self.profile(0)
|
||||
last = self.profile(len(self) - 1)
|
||||
|
||||
z_first = first.z_min()
|
||||
kp_first = first.kp
|
||||
|
||||
z_last = last.z_min()
|
||||
kp_last = last.kp
|
||||
|
||||
return (
|
||||
(z_last - z_first)
|
||||
/
|
||||
(kp_last - kp_first)
|
||||
)
|
||||
|
||||
def get_incline_mean(self):
|
||||
profiles = self.profiles
|
||||
previous = profiles[0]
|
||||
|
||||
incline_acc = 0
|
||||
|
||||
for profile in profiles[1:]:
|
||||
z_first = previous.z_min()
|
||||
kp_first = previous.kp
|
||||
|
||||
z_last = profile.z_min()
|
||||
kp_last = profile.kp
|
||||
|
||||
incline_acc += (
|
||||
(z_last - z_first)
|
||||
/
|
||||
(kp_last - kp_first)
|
||||
)
|
||||
|
||||
previous = profile
|
||||
|
||||
return (incline_acc / (len(profiles) - 1))
|
||||
|
||||
def get_incline_median(self):
|
||||
profiles = self.profiles
|
||||
previous = profiles[0]
|
||||
|
||||
incline_acc = []
|
||||
|
||||
for profile in profiles[1:]:
|
||||
z_first = previous.z_min()
|
||||
kp_first = previous.kp
|
||||
|
||||
z_last = profile.z_min()
|
||||
kp_last = profile.kp
|
||||
|
||||
incline_acc += [
|
||||
(z_last - z_first)
|
||||
/
|
||||
(kp_last - kp_first)
|
||||
]
|
||||
|
||||
previous = profile
|
||||
|
||||
incline_acc.sort()
|
||||
return incline_acc[round(len(profiles)/2)]
|
||||
|
||||
def get_incline_median_mean(self):
|
||||
profiles = self.profiles
|
||||
previous = profiles[0]
|
||||
|
||||
incline_acc = []
|
||||
|
||||
for profile in profiles[1:]:
|
||||
z_first = previous.z_min()
|
||||
kp_first = previous.kp
|
||||
|
||||
z_last = profile.z_min()
|
||||
kp_last = profile.kp
|
||||
|
||||
incline_acc += [
|
||||
(z_last - z_first)
|
||||
/
|
||||
(kp_last - kp_first)
|
||||
]
|
||||
|
||||
previous = profile
|
||||
|
||||
incline_acc.sort()
|
||||
|
||||
marge = round(len(incline_acc) * 0.1)
|
||||
incline_set = incline_acc[marge:-marge]
|
||||
|
||||
logger.debug(f"+{incline_acc}")
|
||||
logger.debug(f"-{incline_set}")
|
||||
|
||||
try:
|
||||
return (
|
||||
reduce(
|
||||
lambda acc, x: acc + x,
|
||||
incline_set,
|
||||
0.0
|
||||
) / (len(incline_set))
|
||||
)
|
||||
except Exception as e:
|
||||
logger_exception(e)
|
||||
return 0
|
||||
@@ -0,0 +1,191 @@
|
||||
# HydraulicStructures.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
from Model.HydraulicStructures.Basic.Value import (
|
||||
BHSValue
|
||||
)
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class BasicHS(SQLSubModel):
|
||||
_sub_classes = [
|
||||
BHSValue,
|
||||
]
|
||||
_id_cnt = 0
|
||||
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(BasicHS, self).__init__()
|
||||
|
||||
self._status = status
|
||||
|
||||
if id == -1:
|
||||
self.id = BasicHS._id_cnt
|
||||
else:
|
||||
self.id = id
|
||||
|
||||
self._name = name
|
||||
self._type = ""
|
||||
self._enabled = True
|
||||
self._data = []
|
||||
|
||||
BasicHS._id_cnt = max(BasicHS._id_cnt + 1, self.id)
|
||||
|
||||
@classmethod
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE hydraulic_structures_basic(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
enabled BOOLEAN NOT NULL,
|
||||
hs INTEGER,
|
||||
FOREIGN KEY(hs) REFERENCES hydraulic_structures(id)
|
||||
)
|
||||
""")
|
||||
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version):
|
||||
major, minor, release = version.strip().split(".")
|
||||
if major == minor == "0":
|
||||
if int(release) < 6:
|
||||
cls._db_create(execute)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _get_ctor_from_type(cls, t):
|
||||
from Model.HydraulicStructures.Basic.Types import (
|
||||
BHS_types, NotDefined,
|
||||
)
|
||||
|
||||
res = NotDefined
|
||||
|
||||
if t in BHS_types.keys():
|
||||
res = BHS_types[t]
|
||||
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
|
||||
table = execute(
|
||||
"SELECT id, name, type, enabled, hs " +
|
||||
"FROM hydraulic_structures_basic " +
|
||||
f"WHERE hs = {data['hs_id']} "
|
||||
)
|
||||
|
||||
for row in table:
|
||||
bhs_id = row[0]
|
||||
name = row[1]
|
||||
type = row[2]
|
||||
enabled = (row[3] == 1)
|
||||
hs_id = row[4]
|
||||
|
||||
ctor = cls._get_ctor_from_type(type)
|
||||
bhs = ctor(
|
||||
id=bhs_id,
|
||||
name=name,
|
||||
status=data['status']
|
||||
)
|
||||
|
||||
bhs.enabled = enabled
|
||||
|
||||
data['bhs_id'] = bhs_id
|
||||
bhs._data = BHSValue._db_load(
|
||||
execute, data
|
||||
)
|
||||
|
||||
new.append(bhs)
|
||||
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
hs_id = data['hs_id']
|
||||
|
||||
sql = (
|
||||
"INSERT INTO " +
|
||||
"hydraulic_structures_basic(id, name, type, enabled, hs) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, " +
|
||||
f"'{self._db_format(self._name)}', " +
|
||||
f"'{self._db_format(self._type)}', " +
|
||||
f"{self._db_format(self.enabled)}, " +
|
||||
f"{hs_id} " +
|
||||
")"
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
data['bhs_id'] = self.id
|
||||
execute(
|
||||
"DELETE FROM hydraulic_structures_basic_value " +
|
||||
f"WHERE bhs = {self.id}"
|
||||
)
|
||||
|
||||
for values in self._data:
|
||||
values._db_save(execute, data)
|
||||
|
||||
return True
|
||||
|
||||
def __len__(self):
|
||||
return len(self._data)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
self._name = name
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
return self._type
|
||||
|
||||
@type.setter
|
||||
def type(self, type):
|
||||
self._type = type
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def enabled(self):
|
||||
return self._enabled
|
||||
|
||||
@enabled.setter
|
||||
def enabled(self, enabled):
|
||||
self._enabled = enabled
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def parameters(self):
|
||||
return self._data
|
||||
|
||||
def convert(self, new_type):
|
||||
return new_type(id=self.id, name=self.name, status=self._status)
|
||||
@@ -0,0 +1,249 @@
|
||||
# Types.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from Model.HydraulicStructures.Basic.HydraulicStructures import (
|
||||
BasicHS
|
||||
)
|
||||
|
||||
from Model.HydraulicStructures.Basic.Value import (
|
||||
BHSValue
|
||||
)
|
||||
|
||||
|
||||
class NotDefined(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(NotDefined, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "ND"
|
||||
self._data = []
|
||||
|
||||
|
||||
class DischargeWeir(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(DischargeWeir, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "S1"
|
||||
self._data = [
|
||||
BHSValue("width", float, 1.0, status=status),
|
||||
BHSValue("elevation", float, 1.0, status=status),
|
||||
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||
]
|
||||
|
||||
|
||||
class TrapezoidalWeir(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(TrapezoidalWeir, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "S2"
|
||||
self._data = [
|
||||
BHSValue("width", float, 1.0, status=status),
|
||||
BHSValue("elevation", float, 1.0, status=status),
|
||||
BHSValue("loading_elevation", float, 9999.999, status=status),
|
||||
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||
BHSValue("half-angle_tangent", float, 0.0, status=status),
|
||||
]
|
||||
|
||||
|
||||
class TriangularWeir(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(TriangularWeir, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "S3"
|
||||
self._data = [
|
||||
BHSValue("elevation", float, 1.0, status=status),
|
||||
BHSValue("loading_elevation", float, 9999.999, status=status),
|
||||
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||
BHSValue("half-angle_tangent", float, 0.0, status=status),
|
||||
]
|
||||
|
||||
|
||||
class RectangularOrifice(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(RectangularOrifice, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "OR"
|
||||
self._data = [
|
||||
BHSValue("width", float, 0.0, status=status),
|
||||
BHSValue("elevation", float, 0.0, status=status),
|
||||
BHSValue("loading_elevation", float, 9999.999,
|
||||
status=status),
|
||||
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||
BHSValue("maximal_loading_elevation", float, 9999.999,
|
||||
status=status),
|
||||
]
|
||||
|
||||
|
||||
class CircularOrifice(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(CircularOrifice, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "OC"
|
||||
self._data = [
|
||||
BHSValue("diameter", float, 0.0, status=status),
|
||||
BHSValue("elevation", float, 0.0, status=status),
|
||||
BHSValue("siltation_height", float, 0.0, status=status),
|
||||
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||
]
|
||||
|
||||
|
||||
class VaultedOrifice(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(VaultedOrifice, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "OV"
|
||||
self._data = [
|
||||
BHSValue("elevation", float, 1.0, status=status),
|
||||
BHSValue("width", float, 1.0, status=status),
|
||||
BHSValue("top_of_the_vault", float, 0.0, status=status),
|
||||
BHSValue("bottom_of_the_vault", float, 0.0, status=status),
|
||||
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||
]
|
||||
|
||||
|
||||
class RectangularGate(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(RectangularGate, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "V1"
|
||||
self._data = [
|
||||
BHSValue("width", float, 1.0, status=status),
|
||||
BHSValue("elevation", float, 0.0, status=status),
|
||||
BHSValue("discharge coefficient", float, 0.4, status=status),
|
||||
BHSValue("opening", float, 1.0, status=status),
|
||||
BHSValue("maximal_opening", float, 1.0, status=status),
|
||||
]
|
||||
|
||||
|
||||
class SimplifiedRectangularGate(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(SimplifiedRectangularGate, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "V2"
|
||||
self._data = [
|
||||
BHSValue("width", float, 1.0, status=status),
|
||||
BHSValue("elevation", float, 0.0, status=status),
|
||||
BHSValue("discharge coefficient", float, 0.4, status=status),
|
||||
BHSValue("opening", float, 1.0, status=status),
|
||||
BHSValue("maximal_opening", float, 1.0, status=status),
|
||||
]
|
||||
|
||||
|
||||
class Borda(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(Borda, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "BO"
|
||||
self._data = [
|
||||
BHSValue("step_space", float, 0.1, status=status),
|
||||
BHSValue("weir", float, 0.15, status=status),
|
||||
BHSValue("coefficient", float, 0.4, status=status),
|
||||
]
|
||||
|
||||
|
||||
class CheckValve(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(CheckValve, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "CV"
|
||||
self._data = [
|
||||
BHSValue("width", float, 0.0, status=status),
|
||||
BHSValue("elevation", float, 0.0, status=status),
|
||||
BHSValue("loading_elevation", float, 9999.999,
|
||||
status=status),
|
||||
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||
BHSValue("maximal_loading_elevation", float, 9999.999,
|
||||
status=status),
|
||||
]
|
||||
|
||||
|
||||
class UserDefined(BasicHS):
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(UserDefined, self).__init__(
|
||||
id=id, name=name,
|
||||
status=status
|
||||
)
|
||||
|
||||
self._type = "UD"
|
||||
self._data = [
|
||||
BHSValue("parameter_1", float, 0.0, status=status),
|
||||
BHSValue("parameter_2", float, 0.0, status=status),
|
||||
BHSValue("parameter_3", float, 0.0, status=status),
|
||||
BHSValue("parameter_4", float, 0.0, status=status),
|
||||
BHSValue("parameter_5", float, 0.0, status=status),
|
||||
]
|
||||
|
||||
|
||||
BHS_types = {
|
||||
"ND": NotDefined,
|
||||
"S1": DischargeWeir,
|
||||
"S2": TrapezoidalWeir,
|
||||
"S3": TriangularWeir,
|
||||
"OR": RectangularOrifice,
|
||||
"OC": CircularOrifice,
|
||||
# "OV": VaultedOrifice,
|
||||
"V1": RectangularGate,
|
||||
"V2": SimplifiedRectangularGate,
|
||||
"BO": Borda,
|
||||
"CV": CheckValve,
|
||||
"UD": UserDefined
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
# Value.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
|
||||
|
||||
class BHSValue(SQLSubModel):
|
||||
_sub_classes = []
|
||||
_id_cnt = 0
|
||||
|
||||
def __init__(self, name: str = "", type=float, value=0.0,
|
||||
status=None):
|
||||
super(BHSValue, self).__init__()
|
||||
|
||||
self._status = status
|
||||
|
||||
self._name = name
|
||||
self._type = type
|
||||
self._value = type(value)
|
||||
|
||||
@classmethod
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE hydraulic_structures_basic_value(
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
bhs INTEGER,
|
||||
FOREIGN KEY(bhs) REFERENCES hydraulic_structures_basic(id)
|
||||
)
|
||||
""")
|
||||
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version):
|
||||
major, minor, release = version.strip().split(".")
|
||||
if major == minor == "0":
|
||||
if int(release) < 6:
|
||||
cls._db_create(execute)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _str_to_type(cls, type):
|
||||
res = str
|
||||
|
||||
if type == "float":
|
||||
res = float
|
||||
elif type == "int":
|
||||
res = int
|
||||
elif type == "bool":
|
||||
res = bool
|
||||
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def _type_to_str(cls, type):
|
||||
res = "str"
|
||||
|
||||
if type == float:
|
||||
res = "float"
|
||||
elif type == int:
|
||||
res = "int"
|
||||
elif type == bool:
|
||||
res = "bool"
|
||||
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
bhs_id = data["bhs_id"]
|
||||
|
||||
table = execute(
|
||||
"SELECT name, type, value " +
|
||||
"FROM hydraulic_structures_basic_value " +
|
||||
f"WHERE bhs = '{bhs_id}'"
|
||||
)
|
||||
|
||||
for row in table:
|
||||
name = row[0]
|
||||
type = cls._str_to_type(row[1])
|
||||
value = row[2]
|
||||
|
||||
val = cls(
|
||||
name=name,
|
||||
type=type,
|
||||
value=value,
|
||||
status=data['status']
|
||||
)
|
||||
|
||||
new.append(val)
|
||||
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
bhs_id = data["bhs_id"]
|
||||
|
||||
sql = (
|
||||
"INSERT INTO " +
|
||||
"hydraulic_structures_basic_value(name, type, value, bhs) " +
|
||||
"VALUES (" +
|
||||
f"'{self._db_format(self._name)}', " +
|
||||
f"'{self._db_format(self._type_to_str(self._type))}', " +
|
||||
f"'{self._db_format(self._value)}', " +
|
||||
f"{bhs_id}" +
|
||||
")"
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
return True
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return self._value
|
||||
|
||||
@value.setter
|
||||
def value(self, value):
|
||||
self._value = self._type(value)
|
||||
self._status.modified()
|
||||
@@ -0,0 +1,288 @@
|
||||
# HydraulicStructures.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
from functools import reduce
|
||||
|
||||
from tools import trace, timer, old_pamhyr_date_to_timestamp
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
from Model.HydraulicStructures.Basic.HydraulicStructures import BasicHS
|
||||
from Model.HydraulicStructures.Basic.Types import (
|
||||
NotDefined,
|
||||
)
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class HydraulicStructure(SQLSubModel):
|
||||
_sub_classes = [
|
||||
BasicHS,
|
||||
]
|
||||
_id_cnt = 0
|
||||
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(HydraulicStructure, self).__init__()
|
||||
|
||||
self._status = status
|
||||
|
||||
if id == -1:
|
||||
self.id = HydraulicStructure._id_cnt
|
||||
else:
|
||||
self.id = id
|
||||
|
||||
self._name = name
|
||||
self._input_kp = None
|
||||
self._output_kp = None
|
||||
self._input_reach = None
|
||||
self._output_reach = None
|
||||
self._enabled = True
|
||||
self._data = []
|
||||
|
||||
HydraulicStructure._id_cnt = max(
|
||||
HydraulicStructure._id_cnt + 1,
|
||||
self.id
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE hydraulic_structures(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
enabled BOOLEAN NOT NULL,
|
||||
input_kp REAL NOT NULL,
|
||||
output_kp REAL NOT NULL,
|
||||
input_reach INTEGER,
|
||||
output_reach INTEGER,
|
||||
FOREIGN KEY(input_reach) REFERENCES river_reach(id),
|
||||
FOREIGN KEY(output_reach) REFERENCES river_reach(id)
|
||||
)
|
||||
""")
|
||||
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _db_update(cls, execute, version):
|
||||
major, minor, release = version.strip().split(".")
|
||||
if major == minor == "0":
|
||||
if int(release) < 6:
|
||||
cls._db_create(execute)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
|
||||
table = execute(
|
||||
"SELECT id, name, enabled, " +
|
||||
"input_kp, output_kp, " +
|
||||
"input_reach, output_reach " +
|
||||
"FROM hydraulic_structures "
|
||||
)
|
||||
|
||||
for row in table:
|
||||
it = iter(row)
|
||||
|
||||
hs_id = next(it)
|
||||
name = next(it)
|
||||
enabled = (next(it) == 1)
|
||||
input_kp = next(it)
|
||||
output_kp = next(it)
|
||||
input_reach_id = next(it)
|
||||
output_reach_id = next(it)
|
||||
|
||||
hs = cls(
|
||||
id=hs_id,
|
||||
name=name,
|
||||
status=data['status']
|
||||
)
|
||||
|
||||
hs.enabled = enabled
|
||||
hs.input_kp = input_kp if input_kp != -1 else None
|
||||
hs.output_kp = output_kp if output_kp != -1 else None
|
||||
|
||||
hs.input_reach, hs.output_reach = reduce(
|
||||
lambda acc, n: (
|
||||
n if n.id == input_reach_id else acc[0],
|
||||
n if n.id == output_reach_id else acc[1]
|
||||
),
|
||||
data["edges"],
|
||||
[None, None]
|
||||
)
|
||||
|
||||
data['hs_id'] = hs_id
|
||||
hs._data = BasicHS._db_load(execute, data)
|
||||
|
||||
new.append(hs)
|
||||
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
execute(f"DELETE FROM hydraulic_structures WHERE id = {self.id}")
|
||||
|
||||
input_reach_id = -1
|
||||
if self._input_reach is not None:
|
||||
input_reach_id = self._input_reach.id
|
||||
|
||||
output_reach_id = -1
|
||||
if self._output_reach is not None:
|
||||
output_reach_id = self._output_reach.id
|
||||
|
||||
input_kp = -1
|
||||
if self.input_kp is not None:
|
||||
input_kp = self.input_kp
|
||||
|
||||
output_kp = -1
|
||||
if self.output_kp is not None:
|
||||
output_kp = self.output_kp
|
||||
|
||||
sql = (
|
||||
"INSERT INTO " +
|
||||
"hydraulic_structures(" +
|
||||
" id, name, enabled, input_kp, output_kp, " +
|
||||
" input_reach, output_reach" +
|
||||
") " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, '{self._db_format(self._name)}', " +
|
||||
f"{self._db_format(self.enabled)}, " +
|
||||
f"{input_kp}, {output_kp}, " +
|
||||
f"{input_reach_id}, {output_reach_id}" +
|
||||
")"
|
||||
)
|
||||
execute(sql)
|
||||
|
||||
data['hs_id'] = self.id
|
||||
execute(
|
||||
"DELETE FROM hydraulic_structures_basic " +
|
||||
f"WHERE hs = {self.id}"
|
||||
)
|
||||
|
||||
for basic in self._data:
|
||||
basic._db_save(execute, data)
|
||||
|
||||
return True
|
||||
|
||||
def __len__(self):
|
||||
return len(self._data)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
self._name = name
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def input_kp(self):
|
||||
return self._input_kp
|
||||
|
||||
@input_kp.setter
|
||||
def input_kp(self, input_kp):
|
||||
if input_kp is not None:
|
||||
input_kp = float(input_kp)
|
||||
|
||||
self._input_kp = input_kp
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def output_kp(self):
|
||||
return self._output_kp
|
||||
|
||||
@output_kp.setter
|
||||
def output_kp(self, output_kp):
|
||||
self._output_kp = output_kp
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def enabled(self):
|
||||
return self._enabled
|
||||
|
||||
@enabled.setter
|
||||
def enabled(self, enabled):
|
||||
self._enabled = enabled
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def input_reach(self):
|
||||
return self._input_reach
|
||||
|
||||
@input_reach.setter
|
||||
def input_reach(self, input_reach):
|
||||
self._input_reach = input_reach
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def output_reach(self):
|
||||
return self._output_reach
|
||||
|
||||
@output_reach.setter
|
||||
def output_reach(self, output_reach):
|
||||
self._output_reach = output_reach
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def basic_structures(self):
|
||||
return self._data.copy()
|
||||
|
||||
def basic_structure(self, index: int):
|
||||
return self._data[index]
|
||||
|
||||
def add(self, index: int):
|
||||
value = NotDefined(status=self._status)
|
||||
self._data.insert(index, value)
|
||||
self._status.modified()
|
||||
return value
|
||||
|
||||
def insert(self, index: int, value: BasicHS):
|
||||
self._data.insert(index, value)
|
||||
self._status.modified()
|
||||
|
||||
def delete_i(self, indexes):
|
||||
self._data = list(
|
||||
map(
|
||||
lambda e: e[1],
|
||||
filter(
|
||||
lambda e: e[0] not in indexes,
|
||||
enumerate(self._data)
|
||||
)
|
||||
)
|
||||
)
|
||||
self._status.modified()
|
||||
|
||||
def delete(self, els):
|
||||
self._data = list(
|
||||
filter(
|
||||
lambda e: e not in els,
|
||||
self._data
|
||||
)
|
||||
)
|
||||
self._status.modified()
|
||||
|
||||
def sort(self, _reverse=False, key=None):
|
||||
if key is None:
|
||||
self._data.sort(reverse=_reverse)
|
||||
else:
|
||||
self._data.sort(reverse=_reverse, key=key)
|
||||
self._status.modified()
|
||||
@@ -0,0 +1,78 @@
|
||||
# HydraulicStructuresList.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from copy import copy
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.Tools.PamhyrList import PamhyrModelList
|
||||
from Model.HydraulicStructures.HydraulicStructures import HydraulicStructure
|
||||
|
||||
|
||||
class HydraulicStructureList(PamhyrModelList):
|
||||
_sub_classes = [
|
||||
HydraulicStructure,
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = cls(status=data['status'])
|
||||
|
||||
if data is None:
|
||||
data = {}
|
||||
|
||||
new._lst = HydraulicStructure._db_load(
|
||||
execute, data
|
||||
)
|
||||
|
||||
return new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
execute("DELETE FROM hydraulic_structures")
|
||||
|
||||
if data is None:
|
||||
data = {}
|
||||
|
||||
for hs in self._lst:
|
||||
hs._db_save(execute, data=data)
|
||||
|
||||
return True
|
||||
|
||||
def new(self, lst, index):
|
||||
n = HydraulicStructure(status=self._status)
|
||||
self._lst.insert(index, n)
|
||||
self._status.modified()
|
||||
return n
|
||||
|
||||
def __copy__(self):
|
||||
new = HydraulicStructureList()
|
||||
|
||||
for lst in self._tabs:
|
||||
new.tabs[lst] = self._tabs[lst].copy()
|
||||
|
||||
return new
|
||||
|
||||
def __deepcopy__(self):
|
||||
new = HydraulicStructureList()
|
||||
|
||||
for lst in self._tabs:
|
||||
new.tabs[lst] = self._tabs[lst].deepcopy()
|
||||
|
||||
return new
|
||||
|
||||
def copy(self):
|
||||
return copy(self)
|
||||
@@ -16,12 +16,16 @@
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
|
||||
from copy import copy, deepcopy
|
||||
from tools import trace, timer
|
||||
from functools import reduce
|
||||
|
||||
from Model.Tools.PamhyrDB import SQLSubModel
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class Data(SQLSubModel):
|
||||
def __init__(self, name: str = "",
|
||||
@@ -52,7 +56,7 @@ class Data(SQLSubModel):
|
||||
self._update_from_discharge()
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE initial_conditions(
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
@@ -70,11 +74,11 @@ class Data(SQLSubModel):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
return cls._update_submodel(execute, version)
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
id = data["reach"].id
|
||||
table = execute(
|
||||
"SELECT ind, name, comment, kp, discharge, height " +
|
||||
@@ -109,7 +113,7 @@ class Data(SQLSubModel):
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
ind = data["ind"]
|
||||
|
||||
execute(
|
||||
@@ -117,8 +121,8 @@ class Data(SQLSubModel):
|
||||
"initial_conditions(ind, name, comment, kp, " +
|
||||
"discharge, height, reach) " +
|
||||
"VALUES (" +
|
||||
f"{ind}, '{self._sql_format(self.name)}', " +
|
||||
f"'{self._sql_format(self._comment)}', " +
|
||||
f"{ind}, '{self._db_format(self.name)}', " +
|
||||
f"'{self._db_format(self._comment)}', " +
|
||||
f"{self._kp}, {self._discharge}, {self._height}, " +
|
||||
f"{self._reach.id}" +
|
||||
")"
|
||||
@@ -226,35 +230,35 @@ class InitialConditions(SQLSubModel):
|
||||
self._data = []
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
return cls._update_submodel(execute, version)
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = cls(
|
||||
reach=data["reach"],
|
||||
status=data["status"]
|
||||
)
|
||||
|
||||
new._data = Data._sql_load(
|
||||
new._data = Data._db_load(
|
||||
execute,
|
||||
data=data
|
||||
)
|
||||
|
||||
if new._data is not None:
|
||||
yield new
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
ok = True
|
||||
|
||||
ind = 0
|
||||
for d in self._data:
|
||||
data["ind"] = ind
|
||||
ok &= d._sql_save(execute, data)
|
||||
ok &= d._db_save(execute, data)
|
||||
ind += 1
|
||||
|
||||
return ok
|
||||
@@ -355,25 +359,90 @@ class InitialConditions(SQLSubModel):
|
||||
def generate_growing_constante_height(self, height: float):
|
||||
self._data = []
|
||||
|
||||
profiles = self._reach.reach.profiles
|
||||
profiles = self._reach.reach.profiles.copy()
|
||||
self._sort_by_z_and_kp(profiles)
|
||||
|
||||
prev = None
|
||||
incline = self._reach.reach.get_incline_median_mean()
|
||||
logger.debug(f"incline = {incline}")
|
||||
|
||||
previous_elevation = -99999.99
|
||||
for profile in profiles:
|
||||
width = profile.width_approximation()
|
||||
strickler = 25
|
||||
discharge = (
|
||||
((width * 0.8)
|
||||
* strickler
|
||||
* (height ** (5/3))
|
||||
* (abs(incline) ** (0.5)))
|
||||
)
|
||||
|
||||
elevation = max(
|
||||
profile.z_min() + height,
|
||||
previous_elevation
|
||||
)
|
||||
|
||||
logger.debug(f"({profile.kp}):")
|
||||
logger.debug(f" width = {width}")
|
||||
logger.debug(f" strickler = {strickler}")
|
||||
logger.debug(f" discharge = {discharge}")
|
||||
|
||||
new = Data(reach=self._reach, status=self._status)
|
||||
new["kp"] = profile.kp
|
||||
new["discharge"] = discharge
|
||||
|
||||
if prev is None:
|
||||
new["elevation"] = profile.z_min() + height
|
||||
else:
|
||||
new["elevation"] = max(
|
||||
profile.z_min() + height,
|
||||
prev["elevation"]
|
||||
)
|
||||
new["elevation"] = elevation
|
||||
|
||||
self._data.append(new)
|
||||
prev = new
|
||||
previous_elevation = elevation
|
||||
|
||||
self._generate_resort_data(profiles)
|
||||
|
||||
def generate_discharge(self, discharge: float):
|
||||
self._data = []
|
||||
|
||||
self._generate_height_estimation_from_discharge(
|
||||
discharge
|
||||
)
|
||||
|
||||
def _generate_height_estimation_from_discharge(self, discharge: float):
|
||||
profiles = self._reach.reach.profiles.copy()
|
||||
self._sort_by_z_and_kp(profiles)
|
||||
|
||||
previous_elevation = -99999.99
|
||||
|
||||
incline = self._reach.reach.get_incline_median_mean()
|
||||
logger.debug(f"incline = {incline}")
|
||||
|
||||
for profile in profiles:
|
||||
width = profile.width_approximation()
|
||||
strickler = 25
|
||||
height = (
|
||||
discharge
|
||||
/
|
||||
((width * 0.8) * strickler * (abs(incline) ** (0.5)))
|
||||
) ** (0.6)
|
||||
|
||||
elevation = max(
|
||||
profile.z_min() + height,
|
||||
previous_elevation
|
||||
)
|
||||
|
||||
logger.debug(f"({profile.kp}):")
|
||||
logger.debug(f" width = {width}")
|
||||
logger.debug(f" strickler = {strickler}")
|
||||
logger.debug(f" hieght = {height}")
|
||||
|
||||
new = Data(reach=self._reach, status=self._status)
|
||||
new["kp"] = profile.kp
|
||||
new["discharge"] = discharge
|
||||
new["elevation"] = elevation
|
||||
|
||||
previous_elevation = elevation
|
||||
self._data.append(new)
|
||||
|
||||
self._generate_resort_data(profiles)
|
||||
|
||||
def _generate_resort_data(self, profiles):
|
||||
is_reverse = False
|
||||
if profiles[0].kp > profiles[-1].kp:
|
||||
is_reverse = True
|
||||
@@ -382,13 +451,3 @@ class InitialConditions(SQLSubModel):
|
||||
reverse=not is_reverse,
|
||||
key=lambda d: d['kp']
|
||||
)
|
||||
|
||||
def generate_discharge(self, discharge: float):
|
||||
self._new = []
|
||||
|
||||
for d in self._data:
|
||||
n = d.copy()
|
||||
n['discharge'] = discharge
|
||||
self._new.append(n)
|
||||
|
||||
self._data = self._new
|
||||
@@ -17,12 +17,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import types
|
||||
import logging
|
||||
|
||||
from copy import copy
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.Tools.PamhyrDict import PamhyrModelDict
|
||||
from Model.InitialConditions.InitialConditions import InitialConditions
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class InitialConditionsDict(PamhyrModelDict):
|
||||
_sub_classes = [
|
||||
@@ -30,13 +34,13 @@ class InitialConditionsDict(PamhyrModelDict):
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = cls(status=data["status"])
|
||||
|
||||
for reach in data["edges"]:
|
||||
data["reach"] = reach
|
||||
|
||||
ic = InitialConditions._sql_load(
|
||||
ic = InitialConditions._db_load(
|
||||
execute,
|
||||
data=data
|
||||
)
|
||||
@@ -46,16 +50,24 @@ class InitialConditionsDict(PamhyrModelDict):
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
ok = True
|
||||
if data is None:
|
||||
data = {}
|
||||
|
||||
execute("DELETE FROM initial_conditions")
|
||||
|
||||
for reach in self._dict:
|
||||
ics = self._dict
|
||||
for reach in ics:
|
||||
data["reach"] = reach
|
||||
ok &= self._dict[reach]._sql_save(execute, data)
|
||||
v = self._dict[reach]
|
||||
if isinstance(v, types.GeneratorType):
|
||||
self._dict[reach] = list(v)[0]
|
||||
|
||||
execute(
|
||||
"DELETE FROM initial_conditions " +
|
||||
f"WHERE reach = '{reach.id}'"
|
||||
)
|
||||
|
||||
ok &= self._dict[reach]._db_save(execute, data)
|
||||
|
||||
return ok
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class LateralContribution(SQLSubModel):
|
||||
LateralContribution._id_cnt + 1, self.id)
|
||||
|
||||
@classmethod
|
||||
def _sql_create(cls, execute):
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE lateral_contribution(
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
@@ -81,7 +81,7 @@ class LateralContribution(SQLSubModel):
|
||||
return cls._create_submodel(execute)
|
||||
|
||||
@classmethod
|
||||
def _sql_update(cls, execute, version):
|
||||
def _db_update(cls, execute, version):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
@@ -100,7 +100,7 @@ class LateralContribution(SQLSubModel):
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def _sql_load(cls, execute, data=None):
|
||||
def _db_load(cls, execute, data=None):
|
||||
new = []
|
||||
tab = data["tab"]
|
||||
|
||||
@@ -142,7 +142,7 @@ class LateralContribution(SQLSubModel):
|
||||
|
||||
return new
|
||||
|
||||
def _sql_save(self, execute, data=None):
|
||||
def _db_save(self, execute, data=None):
|
||||
tab = data["tab"]
|
||||
|
||||
execute(f"DELETE FROM lateral_contribution WHERE id = {self.id}")
|
||||
@@ -157,8 +157,8 @@ class LateralContribution(SQLSubModel):
|
||||
"lateral_contribution(id, name, type, tab, " +
|
||||
"edge, begin_kp, end_kp) " +
|
||||
"VALUES (" +
|
||||
f"{self.id}, '{self._sql_format(self._name)}', " +
|
||||
f"'{self._sql_format(self._type)}', '{tab}', {edge}, " +
|
||||
f"{self.id}, '{self._db_format(self._name)}', " +
|
||||
f"'{self._db_format(self._type)}', '{tab}', {edge}, " +
|
||||
f"{self._begin_kp}, {self._end_kp}" +
|
||||
")"
|
||||
)
|
||||
@@ -166,8 +166,8 @@ class LateralContribution(SQLSubModel):
|
||||
|
||||
ind = 0
|
||||
for d in self._data:
|
||||
data0 = self._sql_format(str(d[0]))
|
||||
data1 = self._sql_format(str(d[1]))
|
||||
data0 = self._db_format(str(d[0]))
|
||||
data1 = self._db_format(str(d[1]))
|
||||
|
||||
sql = (
|
||||
"INSERT INTO " +
|
||||
@@ -188,8 +188,13 @@ class LateralContribution(SQLSubModel):
|
||||
|
||||
@classmethod
|
||||
def time_convert(cls, data):
|
||||
if data is str and data.count(":") == 3:
|
||||
return old_pamhyr_date_to_timestamp(data)
|
||||
if type(data) is str:
|
||||
if data.count(":") == 3:
|
||||
return old_pamhyr_date_to_timestamp(data)
|
||||
if data.count(":") == 2:
|
||||
return old_pamhyr_date_to_timestamp("00:" + data)
|
||||
if data.count(".") == 1:
|
||||
return round(float(data))
|
||||
|
||||
return int(data)
|
||||
|
||||
|
||||