tilupy 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,876 @@
1
+ Metadata-Version: 2.4
2
+ Name: tilupy
3
+ Version: 2.0.0
4
+ Summary: Thin-layer models unified processing tool
5
+ Author-email: Marc Peruzzetto <m.peruzzetto@brgm.fr>
6
+ License: CeCILL-C FREE SOFTWARE LICENSE AGREEMENT
7
+
8
+
9
+ Notice
10
+
11
+ This Agreement is a Free Software license agreement that is the result
12
+ of discussions between its authors in order to ensure compliance with
13
+ the two main principles guiding its drafting:
14
+
15
+ * firstly, compliance with the principles governing the distribution
16
+ of Free Software: access to source code, broad rights granted to
17
+ users,
18
+ * secondly, the election of a governing law, French law, with which
19
+ it is conformant, both as regards the law of torts and
20
+ intellectual property law, and the protection that it offers to
21
+ both authors and holders of the economic rights over software.
22
+
23
+ The authors of the CeCILL-C (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])
24
+ license are:
25
+
26
+ Commissariat à l'Energie Atomique - CEA, a public scientific, technical
27
+ and industrial research establishment, having its principal place of
28
+ business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.
29
+
30
+ Centre National de la Recherche Scientifique - CNRS, a public scientific
31
+ and technological establishment, having its principal place of business
32
+ at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
33
+
34
+ Institut National de Recherche en Informatique et en Automatique -
35
+ INRIA, a public scientific and technological establishment, having its
36
+ principal place of business at Domaine de Voluceau, Rocquencourt, BP
37
+ 105, 78153 Le Chesnay cedex, France.
38
+
39
+
40
+ Preamble
41
+
42
+ The purpose of this Free Software license agreement is to grant users
43
+ the right to modify and re-use the software governed by this license.
44
+
45
+ The exercising of this right is conditional upon the obligation to make
46
+ available to the community the modifications made to the source code of
47
+ the software so as to contribute to its evolution.
48
+
49
+ In consideration of access to the source code and the rights to copy,
50
+ modify and redistribute granted by the license, users are provided only
51
+ with a limited warranty and the software's author, the holder of the
52
+ economic rights, and the successive licensors only have limited liability.
53
+
54
+ In this respect, the risks associated with loading, using, modifying
55
+ and/or developing or reproducing the software by the user are brought to
56
+ the user's attention, given its Free Software status, which may make it
57
+ complicated to use, with the result that its use is reserved for
58
+ developers and experienced professionals having in-depth computer
59
+ knowledge. Users are therefore encouraged to load and test the
60
+ suitability of the software as regards their requirements in conditions
61
+ enabling the security of their systems and/or data to be ensured and,
62
+ more generally, to use and operate it in the same conditions of
63
+ security. This Agreement may be freely reproduced and published,
64
+ provided it is not altered, and that no provisions are either added or
65
+ removed herefrom.
66
+
67
+ This Agreement may apply to any or all software for which the holder of
68
+ the economic rights decides to submit the use thereof to its provisions.
69
+
70
+
71
+ Article 1 - DEFINITIONS
72
+
73
+ For the purpose of this Agreement, when the following expressions
74
+ commence with a capital letter, they shall have the following meaning:
75
+
76
+ Agreement: means this license agreement, and its possible subsequent
77
+ versions and annexes.
78
+
79
+ Software: means the software in its Object Code and/or Source Code form
80
+ and, where applicable, its documentation, "as is" when the Licensee
81
+ accepts the Agreement.
82
+
83
+ Initial Software: means the Software in its Source Code and possibly its
84
+ Object Code form and, where applicable, its documentation, "as is" when
85
+ it is first distributed under the terms and conditions of the Agreement.
86
+
87
+ Modified Software: means the Software modified by at least one
88
+ Integrated Contribution.
89
+
90
+ Source Code: means all the Software's instructions and program lines to
91
+ which access is required so as to modify the Software.
92
+
93
+ Object Code: means the binary files originating from the compilation of
94
+ the Source Code.
95
+
96
+ Holder: means the holder(s) of the economic rights over the Initial
97
+ Software.
98
+
99
+ Licensee: means the Software user(s) having accepted the Agreement.
100
+
101
+ Contributor: means a Licensee having made at least one Integrated
102
+ Contribution.
103
+
104
+ Licensor: means the Holder, or any other individual or legal entity, who
105
+ distributes the Software under the Agreement.
106
+
107
+ Integrated Contribution: means any or all modifications, corrections,
108
+ translations, adaptations and/or new functions integrated into the
109
+ Source Code by any or all Contributors.
110
+
111
+ Related Module: means a set of sources files including their
112
+ documentation that, without modification to the Source Code, enables
113
+ supplementary functions or services in addition to those offered by the
114
+ Software.
115
+
116
+ Derivative Software: means any combination of the Software, modified or
117
+ not, and of a Related Module.
118
+
119
+ Parties: mean both the Licensee and the Licensor.
120
+
121
+ These expressions may be used both in singular and plural form.
122
+
123
+
124
+ Article 2 - PURPOSE
125
+
126
+ The purpose of the Agreement is the grant by the Licensor to the
127
+ Licensee of a non-exclusive, transferable and worldwide license for the
128
+ Software as set forth in Article 5 hereinafter for the whole term of the
129
+ protection granted by the rights over said Software.
130
+
131
+
132
+ Article 3 - ACCEPTANCE
133
+
134
+ 3.1 The Licensee shall be deemed as having accepted the terms and
135
+ conditions of this Agreement upon the occurrence of the first of the
136
+ following events:
137
+
138
+ * (i) loading the Software by any or all means, notably, by
139
+ downloading from a remote server, or by loading from a physical
140
+ medium;
141
+ * (ii) the first time the Licensee exercises any of the rights
142
+ granted hereunder.
143
+
144
+ 3.2 One copy of the Agreement, containing a notice relating to the
145
+ characteristics of the Software, to the limited warranty, and to the
146
+ fact that its use is restricted to experienced users has been provided
147
+ to the Licensee prior to its acceptance as set forth in Article 3.1
148
+ hereinabove, and the Licensee hereby acknowledges that it has read and
149
+ understood it.
150
+
151
+
152
+ Article 4 - EFFECTIVE DATE AND TERM
153
+
154
+
155
+ 4.1 EFFECTIVE DATE
156
+
157
+ The Agreement shall become effective on the date when it is accepted by
158
+ the Licensee as set forth in Article 3.1.
159
+
160
+
161
+ 4.2 TERM
162
+
163
+ The Agreement shall remain in force for the entire legal term of
164
+ protection of the economic rights over the Software.
165
+
166
+
167
+ Article 5 - SCOPE OF RIGHTS GRANTED
168
+
169
+ The Licensor hereby grants to the Licensee, who accepts, the following
170
+ rights over the Software for any or all use, and for the term of the
171
+ Agreement, on the basis of the terms and conditions set forth hereinafter.
172
+
173
+ Besides, if the Licensor owns or comes to own one or more patents
174
+ protecting all or part of the functions of the Software or of its
175
+ components, the Licensor undertakes not to enforce the rights granted by
176
+ these patents against successive Licensees using, exploiting or
177
+ modifying the Software. If these patents are transferred, the Licensor
178
+ undertakes to have the transferees subscribe to the obligations set
179
+ forth in this paragraph.
180
+
181
+
182
+ 5.1 RIGHT OF USE
183
+
184
+ The Licensee is authorized to use the Software, without any limitation
185
+ as to its fields of application, with it being hereinafter specified
186
+ that this comprises:
187
+
188
+ 1. permanent or temporary reproduction of all or part of the Software
189
+ by any or all means and in any or all form.
190
+
191
+ 2. loading, displaying, running, or storing the Software on any or
192
+ all medium.
193
+
194
+ 3. entitlement to observe, study or test its operation so as to
195
+ determine the ideas and principles behind any or all constituent
196
+ elements of said Software. This shall apply when the Licensee
197
+ carries out any or all loading, displaying, running, transmission
198
+ or storage operation as regards the Software, that it is entitled
199
+ to carry out hereunder.
200
+
201
+
202
+ 5.2 RIGHT OF MODIFICATION
203
+
204
+ The right of modification includes the right to translate, adapt,
205
+ arrange, or make any or all modifications to the Software, and the right
206
+ to reproduce the resulting software. It includes, in particular, the
207
+ right to create a Derivative Software.
208
+
209
+ The Licensee is authorized to make any or all modification to the
210
+ Software provided that it includes an explicit notice that it is the
211
+ author of said modification and indicates the date of the creation thereof.
212
+
213
+
214
+ 5.3 RIGHT OF DISTRIBUTION
215
+
216
+ In particular, the right of distribution includes the right to publish,
217
+ transmit and communicate the Software to the general public on any or
218
+ all medium, and by any or all means, and the right to market, either in
219
+ consideration of a fee, or free of charge, one or more copies of the
220
+ Software by any means.
221
+
222
+ The Licensee is further authorized to distribute copies of the modified
223
+ or unmodified Software to third parties according to the terms and
224
+ conditions set forth hereinafter.
225
+
226
+
227
+ 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
228
+
229
+ The Licensee is authorized to distribute true copies of the Software in
230
+ Source Code or Object Code form, provided that said distribution
231
+ complies with all the provisions of the Agreement and is accompanied by:
232
+
233
+ 1. a copy of the Agreement,
234
+
235
+ 2. a notice relating to the limitation of both the Licensor's
236
+ warranty and liability as set forth in Articles 8 and 9,
237
+
238
+ and that, in the event that only the Object Code of the Software is
239
+ redistributed, the Licensee allows effective access to the full Source
240
+ Code of the Software at a minimum during the entire period of its
241
+ distribution of the Software, it being understood that the additional
242
+ cost of acquiring the Source Code shall not exceed the cost of
243
+ transferring the data.
244
+
245
+
246
+ 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
247
+
248
+ When the Licensee makes an Integrated Contribution to the Software, the
249
+ terms and conditions for the distribution of the resulting Modified
250
+ Software become subject to all the provisions of this Agreement.
251
+
252
+ The Licensee is authorized to distribute the Modified Software, in
253
+ source code or object code form, provided that said distribution
254
+ complies with all the provisions of the Agreement and is accompanied by:
255
+
256
+ 1. a copy of the Agreement,
257
+
258
+ 2. a notice relating to the limitation of both the Licensor's
259
+ warranty and liability as set forth in Articles 8 and 9,
260
+
261
+ and that, in the event that only the object code of the Modified
262
+ Software is redistributed, the Licensee allows effective access to the
263
+ full source code of the Modified Software at a minimum during the entire
264
+ period of its distribution of the Modified Software, it being understood
265
+ that the additional cost of acquiring the source code shall not exceed
266
+ the cost of transferring the data.
267
+
268
+
269
+ 5.3.3 DISTRIBUTION OF DERIVATIVE SOFTWARE
270
+
271
+ When the Licensee creates Derivative Software, this Derivative Software
272
+ may be distributed under a license agreement other than this Agreement,
273
+ subject to compliance with the requirement to include a notice
274
+ concerning the rights over the Software as defined in Article 6.4.
275
+ In the event the creation of the Derivative Software required modification
276
+ of the Source Code, the Licensee undertakes that:
277
+
278
+ 1. the resulting Modified Software will be governed by this Agreement,
279
+ 2. the Integrated Contributions in the resulting Modified Software
280
+ will be clearly identified and documented,
281
+ 3. the Licensee will allow effective access to the source code of the
282
+ Modified Software, at a minimum during the entire period of
283
+ distribution of the Derivative Software, such that such
284
+ modifications may be carried over in a subsequent version of the
285
+ Software; it being understood that the additional cost of
286
+ purchasing the source code of the Modified Software shall not
287
+ exceed the cost of transferring the data.
288
+
289
+
290
+ 5.3.4 COMPATIBILITY WITH THE CeCILL LICENSE
291
+
292
+ When a Modified Software contains an Integrated Contribution subject to
293
+ the CeCILL license agreement, or when a Derivative Software contains a
294
+ Related Module subject to the CeCILL license agreement, the provisions
295
+ set forth in the third item of Article 6.4 are optional.
296
+
297
+
298
+ Article 6 - INTELLECTUAL PROPERTY
299
+
300
+
301
+ 6.1 OVER THE INITIAL SOFTWARE
302
+
303
+ The Holder owns the economic rights over the Initial Software. Any or
304
+ all use of the Initial Software is subject to compliance with the terms
305
+ and conditions under which the Holder has elected to distribute its work
306
+ and no one shall be entitled to modify the terms and conditions for the
307
+ distribution of said Initial Software.
308
+
309
+ The Holder undertakes that the Initial Software will remain ruled at
310
+ least by this Agreement, for the duration set forth in Article 4.2.
311
+
312
+
313
+ 6.2 OVER THE INTEGRATED CONTRIBUTIONS
314
+
315
+ The Licensee who develops an Integrated Contribution is the owner of the
316
+ intellectual property rights over this Contribution as defined by
317
+ applicable law.
318
+
319
+
320
+ 6.3 OVER THE RELATED MODULES
321
+
322
+ The Licensee who develops a Related Module is the owner of the
323
+ intellectual property rights over this Related Module as defined by
324
+ applicable law and is free to choose the type of agreement that shall
325
+ govern its distribution under the conditions defined in Article 5.3.3.
326
+
327
+
328
+ 6.4 NOTICE OF RIGHTS
329
+
330
+ The Licensee expressly undertakes:
331
+
332
+ 1. not to remove, or modify, in any manner, the intellectual property
333
+ notices attached to the Software;
334
+
335
+ 2. to reproduce said notices, in an identical manner, in the copies
336
+ of the Software modified or not;
337
+
338
+ 3. to ensure that use of the Software, its intellectual property
339
+ notices and the fact that it is governed by the Agreement is
340
+ indicated in a text that is easily accessible, specifically from
341
+ the interface of any Derivative Software.
342
+
343
+ The Licensee undertakes not to directly or indirectly infringe the
344
+ intellectual property rights of the Holder and/or Contributors on the
345
+ Software and to take, where applicable, vis-à-vis its staff, any and all
346
+ measures required to ensure respect of said intellectual property rights
347
+ of the Holder and/or Contributors.
348
+
349
+
350
+ Article 7 - RELATED SERVICES
351
+
352
+ 7.1 Under no circumstances shall the Agreement oblige the Licensor to
353
+ provide technical assistance or maintenance services for the Software.
354
+
355
+ However, the Licensor is entitled to offer this type of services. The
356
+ terms and conditions of such technical assistance, and/or such
357
+ maintenance, shall be set forth in a separate instrument. Only the
358
+ Licensor offering said maintenance and/or technical assistance services
359
+ shall incur liability therefor.
360
+
361
+ 7.2 Similarly, any Licensor is entitled to offer to its licensees, under
362
+ its sole responsibility, a warranty, that shall only be binding upon
363
+ itself, for the redistribution of the Software and/or the Modified
364
+ Software, under terms and conditions that it is free to decide. Said
365
+ warranty, and the financial terms and conditions of its application,
366
+ shall be subject of a separate instrument executed between the Licensor
367
+ and the Licensee.
368
+
369
+
370
+ Article 8 - LIABILITY
371
+
372
+ 8.1 Subject to the provisions of Article 8.2, the Licensee shall be
373
+ entitled to claim compensation for any direct loss it may have suffered
374
+ from the Software as a result of a fault on the part of the relevant
375
+ Licensor, subject to providing evidence thereof.
376
+
377
+ 8.2 The Licensor's liability is limited to the commitments made under
378
+ this Agreement and shall not be incurred as a result of in particular:
379
+ (i) loss due the Licensee's total or partial failure to fulfill its
380
+ obligations, (ii) direct or consequential loss that is suffered by the
381
+ Licensee due to the use or performance of the Software, and (iii) more
382
+ generally, any consequential loss. In particular the Parties expressly
383
+ agree that any or all pecuniary or business loss (i.e. loss of data,
384
+ loss of profits, operating loss, loss of customers or orders,
385
+ opportunity cost, any disturbance to business activities) or any or all
386
+ legal proceedings instituted against the Licensee by a third party,
387
+ shall constitute consequential loss and shall not provide entitlement to
388
+ any or all compensation from the Licensor.
389
+
390
+
391
+ Article 9 - WARRANTY
392
+
393
+ 9.1 The Licensee acknowledges that the scientific and technical
394
+ state-of-the-art when the Software was distributed did not enable all
395
+ possible uses to be tested and verified, nor for the presence of
396
+ possible defects to be detected. In this respect, the Licensee's
397
+ attention has been drawn to the risks associated with loading, using,
398
+ modifying and/or developing and reproducing the Software which are
399
+ reserved for experienced users.
400
+
401
+ The Licensee shall be responsible for verifying, by any or all means,
402
+ the suitability of the product for its requirements, its good working
403
+ order, and for ensuring that it shall not cause damage to either persons
404
+ or properties.
405
+
406
+ 9.2 The Licensor hereby represents, in good faith, that it is entitled
407
+ to grant all the rights over the Software (including in particular the
408
+ rights set forth in Article 5).
409
+
410
+ 9.3 The Licensee acknowledges that the Software is supplied "as is" by
411
+ the Licensor without any other express or tacit warranty, other than
412
+ that provided for in Article 9.2 and, in particular, without any warranty
413
+ as to its commercial value, its secured, safe, innovative or relevant
414
+ nature.
415
+
416
+ Specifically, the Licensor does not warrant that the Software is free
417
+ from any error, that it will operate without interruption, that it will
418
+ be compatible with the Licensee's own equipment and software
419
+ configuration, nor that it will meet the Licensee's requirements.
420
+
421
+ 9.4 The Licensor does not either expressly or tacitly warrant that the
422
+ Software does not infringe any third party intellectual property right
423
+ relating to a patent, software or any other property right. Therefore,
424
+ the Licensor disclaims any and all liability towards the Licensee
425
+ arising out of any or all proceedings for infringement that may be
426
+ instituted in respect of the use, modification and redistribution of the
427
+ Software. Nevertheless, should such proceedings be instituted against
428
+ the Licensee, the Licensor shall provide it with technical and legal
429
+ assistance for its defense. Such technical and legal assistance shall be
430
+ decided on a case-by-case basis between the relevant Licensor and the
431
+ Licensee pursuant to a memorandum of understanding. The Licensor
432
+ disclaims any and all liability as regards the Licensee's use of the
433
+ name of the Software. No warranty is given as regards the existence of
434
+ prior rights over the name of the Software or as regards the existence
435
+ of a trademark.
436
+
437
+
438
+ Article 10 - TERMINATION
439
+
440
+ 10.1 In the event of a breach by the Licensee of its obligations
441
+ hereunder, the Licensor may automatically terminate this Agreement
442
+ thirty (30) days after notice has been sent to the Licensee and has
443
+ remained ineffective.
444
+
445
+ 10.2 A Licensee whose Agreement is terminated shall no longer be
446
+ authorized to use, modify or distribute the Software. However, any
447
+ licenses that it may have granted prior to termination of the Agreement
448
+ shall remain valid subject to their having been granted in compliance
449
+ with the terms and conditions hereof.
450
+
451
+
452
+ Article 11 - MISCELLANEOUS
453
+
454
+
455
+ 11.1 EXCUSABLE EVENTS
456
+
457
+ Neither Party shall be liable for any or all delay, or failure to
458
+ perform the Agreement, that may be attributable to an event of force
459
+ majeure, an act of God or an outside cause, such as defective
460
+ functioning or interruptions of the electricity or telecommunications
461
+ networks, network paralysis following a virus attack, intervention by
462
+ government authorities, natural disasters, water damage, earthquakes,
463
+ fire, explosions, strikes and labor unrest, war, etc.
464
+
465
+ 11.2 Any failure by either Party, on one or more occasions, to invoke
466
+ one or more of the provisions hereof, shall under no circumstances be
467
+ interpreted as being a waiver by the interested Party of its right to
468
+ invoke said provision(s) subsequently.
469
+
470
+ 11.3 The Agreement cancels and replaces any or all previous agreements,
471
+ whether written or oral, between the Parties and having the same
472
+ purpose, and constitutes the entirety of the agreement between said
473
+ Parties concerning said purpose. No supplement or modification to the
474
+ terms and conditions hereof shall be effective as between the Parties
475
+ unless it is made in writing and signed by their duly authorized
476
+ representatives.
477
+
478
+ 11.4 In the event that one or more of the provisions hereof were to
479
+ conflict with a current or future applicable act or legislative text,
480
+ said act or legislative text shall prevail, and the Parties shall make
481
+ the necessary amendments so as to comply with said act or legislative
482
+ text. All other provisions shall remain effective. Similarly, invalidity
483
+ of a provision of the Agreement, for any reason whatsoever, shall not
484
+ cause the Agreement as a whole to be invalid.
485
+
486
+
487
+ 11.5 LANGUAGE
488
+
489
+ The Agreement is drafted in both French and English and both versions
490
+ are deemed authentic.
491
+
492
+
493
+ Article 12 - NEW VERSIONS OF THE AGREEMENT
494
+
495
+ 12.1 Any person is authorized to duplicate and distribute copies of this
496
+ Agreement.
497
+
498
+ 12.2 So as to ensure coherence, the wording of this Agreement is
499
+ protected and may only be modified by the authors of the License, who
500
+ reserve the right to periodically publish updates or new versions of the
501
+ Agreement, each with a separate number. These subsequent versions may
502
+ address new issues encountered by Free Software.
503
+
504
+ 12.3 Any Software distributed under a given version of the Agreement may
505
+ only be subsequently distributed under the same version of the Agreement
506
+ or a subsequent version.
507
+
508
+
509
+ Article 13 - GOVERNING LAW AND JURISDICTION
510
+
511
+ 13.1 The Agreement is governed by French law. The Parties agree to
512
+ endeavor to seek an amicable solution to any disagreements or disputes
513
+ that may arise during the performance of the Agreement.
514
+
515
+ 13.2 Failing an amicable solution within two (2) months as from their
516
+ occurrence, and unless emergency proceedings are necessary, the
517
+ disagreements or disputes shall be referred to the Paris Courts having
518
+ jurisdiction, by the more diligent Party.
519
+
520
+
521
+ Version 1.0 dated 2006-09-05.
522
+ Project-URL: Homepage, https://github.com/marcperuz/tilupy
523
+ Keywords: thin-layer,shallow-water,display,simulation,model,processing,benchmark
524
+ Classifier: License :: CeCILL-C Free Software License Agreement (CECILL-C)
525
+ Classifier: Programming Language :: Python
526
+ Classifier: Programming Language :: Python :: 3
527
+ Requires-Python: >=3.10
528
+ Description-Content-Type: text/markdown
529
+ License-File: LICENSE
530
+ Requires-Dist: seaborn
531
+ Requires-Dist: requests
532
+ Requires-Dist: scipy
533
+ Requires-Dist: pytopomap
534
+ Provides-Extra: test
535
+ Requires-Dist: pytest; extra == "test"
536
+ Provides-Extra: dev
537
+ Requires-Dist: pipreqs; extra == "dev"
538
+ Provides-Extra: gis
539
+ Requires-Dist: rasterio; extra == "gis"
540
+ Requires-Dist: shapely; extra == "gis"
541
+ Dynamic: license-file
542
+
543
+ # tilupy
544
+
545
+ [![Anaconda-Server Badge](https://anaconda.org/conda-forge/tilupy/badges/version.svg)](https://anaconda.org/conda-forge/tilupy) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/tilupy/badges/downloads.svg)](https://anaconda.org/conda-forge/tilupy)
546
+
547
+ - [Description](#description)
548
+ - [Installation with pip](#installation-pip)
549
+ - [Installation with anaconda](#installation-conda)
550
+ - [Quick start](#quick-start)
551
+ - [Prepare simulations](#prepare-simus)
552
+ - [Get simulation results](#simu-results)
553
+ - [Process simulation results in python script](#process-simus-python)
554
+ - [Process simulation results in command line](#process-simus-cmd)
555
+ - [Models references](#models-refs)
556
+ - [Shaltop](#ref-shaltop)
557
+ - [r.avaflow](#ref-ravaflow)
558
+
559
+
560
+ ## Description <a name="description"></a>
561
+
562
+ `tilupy` (ThIn-Layer Unified Processing in pYthon) package is meant as a top-level tool for processing inputs and outputs of thin-layer geophysical
563
+ flow simulations on general topographies.
564
+ It contains one submodule per thin-layer model for writing and reading raw inputs and outputs of the model.
565
+ Outputs are then easily compared between different simulations / models. The models themselves are not part of this package and must
566
+ be installed separately.
567
+
568
+ Note that `tilupy` is still under development, thus only minimal documentation is available at the moment, and testing is underway.
569
+ Contributions are feedback are most welcome. Reading and writing is available for the `SHALTOP` model (most commonly used by the author) and `r.avaflow`
570
+ (only partly maintained).
571
+
572
+ ## Installation with pip <a name="installation-pip"></a>
573
+
574
+ To install `tilupy` from GitHub or PyPi, you'll need to have `pip` installed on your computer.
575
+
576
+ It is strongly recommended to install `tilupy` in a virtual environnement dedicated to this package. This can be done with `virtualenv`
577
+ (see the documentation e.g. [here](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)).
578
+ Create the environnement with :
579
+
580
+ ```bash
581
+ python -m venv /path/to/myenv
582
+ ```
583
+
584
+ and activate it, on Linux:
585
+
586
+ ```bash
587
+ source /path/to/myenv/bin/activate
588
+ ```
589
+
590
+ and on Windows:
591
+
592
+ ```cmd.exe
593
+ \path\to\myenv\Scripts\activate
594
+ ```
595
+
596
+ Alternatively, if you are more used to Anaconda :
597
+
598
+ ```bash
599
+ conda create -n tilupy pip
600
+ conda activate tilupy
601
+ ```
602
+
603
+ or equivalently with Mamba :
604
+
605
+ ```bash
606
+ mamba create -n tilupy pip
607
+ mamba activate tilupy
608
+ ```
609
+
610
+ Before installing with `pip`, make sure `pip`, `steuptools` and `wheel` are up to date
611
+
612
+ ```
613
+ python -m pip install --upgrade pip setuptools wheel
614
+ ```
615
+
616
+ ### Latest stable realease from PyPi <a name="pypi-install"></a>
617
+
618
+ ```
619
+ python -m pip install tilupy
620
+ ```
621
+
622
+ ### Development version on from GitHub <a name="source-install"></a>
623
+
624
+ Download the GithHub repository [here](https://github.com/marcperuz/tilupy), or clone it with
625
+
626
+ ```
627
+ git clone https://github.com/marcperuz/tilupy.git
628
+ ```
629
+
630
+ Open a terminal in the created folder and type:
631
+
632
+ ```
633
+ python -m pip install .
634
+ ```
635
+
636
+ ## Installation with from conda-forge <a name="installation-conda"></a>
637
+
638
+ The latest stable version of `tilupy` on PyPi is also (supposedly) distributed on `conda-forge`. It can be intalled with Anaconda (or any equivalent) with
639
+
640
+ ```
641
+ conda install conda-forge::tilupy
642
+ ```
643
+
644
+ ## Quick start <a name="quick-start"></a>
645
+
646
+ We give here a simple example to prepare simulations for SHALTOP, and process the results. The corresponding scripts can be found in `examples/frankslide`
647
+
648
+ ### Prepare simulations <a name="prepare-simus"></a>
649
+
650
+ Import the different required modules :
651
+
652
+ ```python
653
+ import os
654
+
655
+ # Read an write rasters
656
+ import tilupy.raster
657
+ # Functions to download examples of elevation and initial mass rasters
658
+ import tilupy.download_data
659
+ #Submodule used to prepare Shaltop simulations
660
+ import tilupy.models.shaltop.initsimus as shinit
661
+ ```
662
+
663
+ Define the folder where input data will be downloaded and simulations carried out :
664
+
665
+ ```python
666
+ FOLDER_BASE = '/path/to/myfolder'
667
+ ```
668
+
669
+ Import data from GitHub, and create subfolder for simulation results
670
+
671
+ ```python
672
+ folder_data = os.path.join(FOLDER_BASE, 'rasters')
673
+ os.makedirs(folder_data, exist_ok=True)
674
+ #raster_topo and raster_mass are the paths to the topography and initial mass rasters
675
+ raster_topo = tilupy.download_data.import_frankslide_dem(folder_out=folder_data)
676
+ raster_mass = tilupy.download_data.import_frankslide_pile(folder_out=folder_data)
677
+ # Create folder for shaltop simulations
678
+ folder_simus = os.path.join(FOLDER_BASE, 'shaltop')
679
+ os.makedirs(folder_simus, exist_ok=True)
680
+ ```
681
+
682
+ Convert downloaded rasters to Shaltop input file type, and store the properties of the resulting grid
683
+
684
+ ```python
685
+ shinit.raster_to_shaltop_txtfile(raster_topo,
686
+ os.path.join(folder_simus, 'topography.d'))
687
+ axes_props = shinit.raster_to_shaltop_txtfile(raster_mass,
688
+ os.path.join(folder_simus, 'init_mass.d'))
689
+ ```
690
+
691
+ Initiate simulations parameters. See the SHALTOP documentation for details.
692
+
693
+ ```python
694
+ params = dict(nx=axes_props['nx'], ny=axes_props['ny'],
695
+ per=axes_props['nx']*axes_props['dx'],
696
+ pery=axes_props['ny']*axes_props['dy'],
697
+ tmax=100, # Simulation maximum time in seconds (not comutation time)
698
+ dt_im=10, # Time interval (s) between snapshots recordings
699
+ file_z_init = 'topography.d', # Name of topography input file
700
+ file_m_init = 'init_mass.d',# name of init mass input file
701
+ initz=0, # Topography is read from file
702
+ ipr=0, # Initial mass is read from file
703
+ hinit_vert=1, # Initial is given as vertical thicknesses and
704
+ # must be converted to thicknesses normal to topography
705
+ eps0=1e-13, #Minimum value for thicknesses and velocities
706
+ icomp=1, # choice of rheology (Coulomb with constant basal friction)
707
+ x0=1000, # Min x value (used for plots after simulation is over)
708
+ y0=2000) # Min y value (used for plots after simulation is over)
709
+ ```
710
+
711
+ Finally, prepare simulations for a set of given rheological parameters (here, three basal friction coefficients)
712
+
713
+ ```python
714
+ deltas = [15, 20, 25]
715
+ for delta in deltas:
716
+ params_txt = 'delta_{:05.2f}'.format(delta).replace('.', 'p')
717
+ params['folder_output'] = params_txt # Specify folder where outputs are stored
718
+ params['delta1'] = delta # Specify the friction coefficient
719
+ #Write parameter file
720
+ shinit.write_params_file(params, directory=folder_simus,
721
+ file_name=params_txt + '.txt')
722
+ #Create folder for results (not done by shlatop!)
723
+ os.makedirs(os.path.join(folder_simus, params_txt), exist_ok=True)
724
+ ```
725
+
726
+ You must then run the simulations (see Shaltop documentation)
727
+
728
+ ### Get simulation results <a name="simu-results"></a>
729
+
730
+ Simulation results are read from a `Results` class. Main functions are defined in the parent class `tilupy.read.Results`, and each model has its own inheretied class `tilupy.models.[model_name].read.Results`. A class instance for a given model can be initiated with
731
+
732
+ ```python
733
+ res = tilupy.read.get_results([model_name], **kwargs)
734
+ ```
735
+
736
+ where `kwargs must be adapted to the considered model. For instance with Shaltop and the example above, the results of the simulation with a friction angle of 25 must be initiated as :
737
+
738
+ ```python
739
+ res = tilupy.read.get_results('shaltop', folder=folder_simus, file_params='delta_25p00.txt)
740
+ ```
741
+
742
+ The topography and axes can then directly be read from `res` :
743
+
744
+ ```python
745
+ x, y, z = res.x, res.y, res.z
746
+ import matplotlib.pyplot as plt
747
+ plt.imshow(z)
748
+ ```
749
+
750
+ `z[i, j]` is the altitude at `flip(y[i])` and `x[j]`. Thus `z[0, 0]` corresponds to the North-West corner of the topography.
751
+
752
+ Specific simulation outputs can be extracted with
753
+
754
+ ```python
755
+ h_res = res.get_output(res_name)
756
+ ```
757
+
758
+ where `res_name` must chosen among
759
+
760
+ - `h` : Flow thickness in the direction perpendicular to the topography
761
+ - `hvert` : Flow thickness in the vertical direction
762
+ - `ux` and `uy` : Flow velocity in the X and Y direction (check whether it is in the cartesian reference frame or not)
763
+ - `u` : Norm of the flow velocity
764
+ - `hu` : Momentum (thickness * flow velocity)
765
+ - `hu2` : Kinetic energy (thickness * square flow velocity)
766
+
767
+ It is also possible to extract 2D spatial static characteritics of the flow by using any of the previous states with `_[operation]`, where
768
+ `[operation]` is chosen among, `max`, `mean`, `std`, `sum`, `min`, `final`, `initial`. For instance `h_max` is a 2D array with the
769
+ maximum simulated thickness at each point of the grid. `h_final` is the simulated thickness at the end of the simulation.
770
+ `tilupy` will load these characteristics directly from the simulation output when possible (e.g. Shaltop records a maximum thickness array),
771
+ or compute then from the available data. For instance, if the simulation results contains a file whith the maximum thickness, `h_max` will be
772
+ read from this file. Otherwise, `h_max` is computed from the simulation recorded temporal snapshots (which is supposedly less precise).
773
+
774
+ For instance, to load the recorded thicknesses in the current example :
775
+
776
+ ```python
777
+ res_name = 'h'
778
+ h_res = res.get_output(res_name) # Thicknesses recorded at different times
779
+ # h_res.d is a 3D numpy array of dimension (len(x) x len(y) x len(h_res.t))
780
+ plt.imshow(h_res.d[:, :, -1]) # Plot final thickness.
781
+ t = h_res.t # Get times of simulation outputs.
782
+ ```
783
+
784
+ And to load the maximum thickness array :
785
+
786
+ ```python
787
+ res_name = 'h_max'
788
+ h_max_res = res.get_output(res_name) #h_max_res is read directly from simulation
789
+ # results when possible, and is deduced from res.get_output('h') otherwise
790
+ # h_max_res.d is a 2D numpy array of dimension (len(x) x len(y))
791
+ plt.imshow(h_max_res.d)
792
+ ```
793
+
794
+ ### Process simulation results in python script <a name="process-simus-python"></a>
795
+
796
+ `tilupy`can be used to plot the results as images, where the flow state (thickness, velocity, ...)
797
+ is shown with a colorscale on the underlying topography. Plots can be thouroughly customized (documentation not available yet).
798
+
799
+ For instance, the following code plots the flow thickness at each recorded time step, with a constant colorscale vraying from 0.1 to
800
+ 100 m. The topography is represented as a shaded relief with thin contour lines every 10 m, and bold contour_lines every 100 m. Plots are saved
801
+ in a folder created in `folder_out`, but not displayed in the terminal (if you work in a developping environnement such as `spyder`).
802
+
803
+ ```python
804
+ topo_kwargs = dict(contour_step=10, step_contour_bold=100) # give interval between thin and bold contour lines
805
+ params_files = 'delta_*.txt'
806
+ tilupy.cmd.plot_results('shaltop', 'h', params_files, folder_simus,
807
+ save=True, display_plot=False, figsize=(15/2.54, 15/2.54),
808
+ vmin=0.1, vmax=100, fmt='png',
809
+ topo_kwargs=topo_kwargs)
810
+ ```
811
+
812
+ The following code acts similarly, but plots the maximum thickness instead, and used a segmented colormap given by `cmap_intervals`.
813
+
814
+ ```python
815
+ tilupy.cmd.plot_results('shaltop', 'h_max', params_files, folder_simus,
816
+ save=True, display_plot=False, figsize=(15/2.54, 15/2.54),
817
+ cmap_intervals=[0.1, 5, 10, 25, 50, 100],
818
+ topo_kwargs=topo_kwargs)
819
+ ```
820
+
821
+ It is also possible to save outputs back to rasters. The following code save all recorded thicknesses snapshots as tif files in a new folder
822
+ created in `folder_out`.
823
+
824
+ ```python
825
+ tilupy.cmd.to_raster('shaltop', 'h_max', params_files,
826
+ folder_simus, fmt='tif')
827
+ ```
828
+
829
+ ### Process simulation results in command line <a name="process-simus-cmd"></a>
830
+
831
+ `tilupy` comes with command line scripts to allow for quick processing of results. They work similarly as the functions `tilupy.cmd.plot_results` and `tilupy.cmd.to_raster`,
832
+ although there are less options.
833
+
834
+ `tilupy_plot` will automatically plot and save results in a new folder `plot` located in the simulation output folder specified in the parameter file :
835
+
836
+ ```
837
+ tilupy_plot [-h] [-n RES_NAME] [-p PARAM_FILES] [-f FOLDER] [--fmt FMT] [--vmin VMIN] [--vmax VMAX]
838
+ [--minval_abs MINVAL_ABS]
839
+ [model]
840
+ ```
841
+
842
+ `RES_NAME` can be any of the strings listed in the previous section. For instance, to plot all thicknesses snaphsots from shaltop simulations in the current folder, type `tilupy_plot shaltop -n h`. If parameters files are located in `another/folder`, type, `tilupy shaltop -n h -f another/folder`. Similarly, to save thicknesses snapshots as ascii rasters, use `tilupy_to_raster shaltop -n h --fmt asc`.
843
+
844
+ ```
845
+ tilupy_to_raster [-h] [-n RES_NAME] [-p PARAM_FILES] [-f FOLDER] [--fmt {tif,tiff,txt,asc,ascii}] model
846
+ ```
847
+
848
+ With both commands you can use the `-h` option do print help.
849
+
850
+ ## Models references <a name="models-refs"></a>
851
+
852
+ We provide here a basic descriptions of models compatible with `tilupy`. The list of references is not exhaustive.
853
+
854
+ ### Shaltop <a name="ref-shaltop"></a>
855
+
856
+ `shaltop` models gravitational flow models over general topographies with small slope variation (small curvature) and friction. The equations are expressed in a horizontal/vertical reference frame and the shallow approximation is imposed in the direction normal to the slope. `shaltop` is not yet freely available. If you are interested, contact [m.peruzzetto@brgm.fr](mailto:m.peruzzetto@brgm.fr) or [mangeney@ipgp.fr](mailto:mangeney@ipgp.fr).
857
+
858
+ - Bouchut, F., Mangeney-Castelnau, A., Perthame, B., Vilotte, J.-P., 2003. A new model of Saint Venant and Savage–Hutter type for gravity driven shallow water flows. Comptes Rendus Mathématique 336, 531–536. [https://doi.org/10.1016/S1631-073X(03)00117-1](https://doi.org/10.1016/S1631-073X(03)00117-1)
859
+ - Bouchut, F., Westdickenberg, M., 2004. Gravity driven shallow water models for arbitrary topography. Communications in Mathematical Sciences 2, 359–389. [https://doi.org/10.4310/CMS.2004.v2.n3.a2](https://doi.org/10.4310/CMS.2004.v2.n3.a2)
860
+ - Mangeney-Castelnau, A., Bouchut, F., Vilotte, J.P., Lajeunesse, E., Aubertin, A., Pirulli, M., 2005. On the use of Saint Venant equations to simulate the spreading of a granular mass: numerical simulation of granular spreading. Journal of Geophysical Research: Solid Earth 110, B09103. [https://doi.org/10.1029/2004JB003161](https://doi.org/10.1029/2004JB003161)
861
+ - Mangeney, A., Bouchut, F., Thomas, N., Vilotte, J.P., Bristeau, M.O., 2007. Numerical modeling of self-channeling granular flows and of their levee-channel deposits. Journal of Geophysical Research 112, F02017. [https://doi.org/10.1029/2006JF000469](https://doi.org/10.1029/2006JF000469)
862
+
863
+
864
+ ### r.avaflow <a name="ref-ravaflow"></a>
865
+
866
+ `r.avaflow` is a GIS-supported open source software tool for the simulation of complex, cascading mass flows over arbitrary topography. It can be downloaded, along with the associated documentation, on the officiel [website](https://www.landslidemodels.org/r.avaflow/). Note that the integration of `r.avaflow` in `tilupy` is partial and potentially not adapted to new releases of `r.avaflow`.
867
+
868
+ - Mergili, M., Fischer, J.-T., Krenn, J., Pudasaini, S.P., 2017. r.avaflow v1, an advanced open source computational framework for the propagation and interaction of two-phase mass flows. Geoscientific Model Development Discussions 10, 553–569. [https://doi.org/10.5194/gmd-10-553-2017](https://doi.org/10.5194/gmd-10-553-2017)
869
+ - Pudasaini, S.P., Mergili, M., 2019. A Multi-Phase Mass Flow Model. Journal of Geophysical Research: Earth Surface 124, 2920–2942. [https://doi.org/10.1029/2019JF005204](https://doi.org/10.1029/2019JF005204)
870
+
871
+ ### Lave2D <a name="ref-Lave2D"></a>
872
+
873
+ `Lave2D` is a software developped by the INRAE for the modeling of debris flows with the Herschel-Bulkley rheology.
874
+
875
+ - Laigle, D., Hector, A.-F., Hübl, J., Rickenmann, D., 2006. Confrontation de la simulation numérique de l’étalement de laves torrentielles boueuses à des observations d’événements réels. La Houille Blanche 92, 105–112. https://doi.org/10.1051/lhb:2006108
876
+ - Rickenmann, D., Laigle, D., McArdell, B.W., Hübl, J., 2006. Comparison of 2D debris-flow simulation models with field events. Computational Geosciences 10, 241–264. https://doi.org/10.1007/s10596-005-9021-3