SW1Dto2D 0.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.
- sw1dto2d/__init__.py +35 -0
- sw1dto2d/cartesian.py +32 -0
- sw1dto2d/sw1dto2d.py +753 -0
- sw1dto2d-0.0.0.dist-info/METADATA +560 -0
- sw1dto2d-0.0.0.dist-info/RECORD +13 -0
- sw1dto2d-0.0.0.dist-info/WHEEL +5 -0
- sw1dto2d-0.0.0.dist-info/licenses/AUTHORS +9 -0
- sw1dto2d-0.0.0.dist-info/licenses/LICENSE +516 -0
- sw1dto2d-0.0.0.dist-info/top_level.txt +2 -0
- tests/__init__.py +30 -0
- tests/test_basic_processes.py +132 -0
- tests/test_brahmaputra.py +144 -0
- tests/test_garonne.py +129 -0
sw1dto2d/__init__.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2019-2022 CS GROUP - France, University of Toulouse (France)
|
|
4
|
+
#
|
|
5
|
+
# This file is part of the sw1dto2d Package. sw1dto2d is a package to convert
|
|
6
|
+
# 1D Shallow water results to 2D. It is designed to compute 2D geographic
|
|
7
|
+
# representation of the results of 1D shallow water models.
|
|
8
|
+
#
|
|
9
|
+
# This software is governed by the CeCILL license under French law and abiding
|
|
10
|
+
# by the rules of distribution of free software. You can use, modify and/or
|
|
11
|
+
# redistribute the software under the terms of the CeCILL license as circulated
|
|
12
|
+
# by CEA, CNRS and INRIA at the following URL: "http://www.cecill.info".
|
|
13
|
+
#
|
|
14
|
+
# As a counterpart to the access to the source code and rights to copy, modify
|
|
15
|
+
# and redistribute granted by the license, users are provided only with a
|
|
16
|
+
# limited warranty and the software's author, the holder of the economic
|
|
17
|
+
# rights, and the successive licensors have only limited liability.
|
|
18
|
+
#
|
|
19
|
+
# In this respect, the user's attention is drawn to the risks associated with
|
|
20
|
+
# loading, using, modifying and/or developing or reproducing the software by
|
|
21
|
+
# the user in light of its specific status of free software, that may mean that
|
|
22
|
+
# it is complicated to manipulate, and that also therefore means that it is
|
|
23
|
+
# reserved for developers and experienced professionals having in-depth
|
|
24
|
+
# computer knowledge. Users are therefore encouraged to load and test the
|
|
25
|
+
# software's suitability as regards their requirements in conditions enabling
|
|
26
|
+
# the security of their systems and/or data to be ensured and, more generally,
|
|
27
|
+
# to use and operate it in the same conditions as regards security.
|
|
28
|
+
#
|
|
29
|
+
# The fact that you are presently reading this means that you have had
|
|
30
|
+
# knowledge of the CeCILL license and that you accept its terms.
|
|
31
|
+
|
|
32
|
+
from .sw1dto2d import SW1Dto2D
|
|
33
|
+
|
|
34
|
+
__version__ = "0.0.7"
|
|
35
|
+
|
sw1dto2d/cartesian.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from shapely.geometry import Point
|
|
3
|
+
|
|
4
|
+
class Distance:
|
|
5
|
+
|
|
6
|
+
def __init__(self, meters):
|
|
7
|
+
self._distance = meters
|
|
8
|
+
|
|
9
|
+
def destination(self, center, bearing):
|
|
10
|
+
"""
|
|
11
|
+
Compute the destination from center and direction angle (bearing)
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
center : (y,x) tuple. Coordinates are y,x to ensure harmonisation with geopy functions where coordinates are expressed in (lat,lon)
|
|
16
|
+
bearing : direction angle in degrees
|
|
17
|
+
|
|
18
|
+
Return
|
|
19
|
+
------
|
|
20
|
+
point : destination point
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
angle = bearing * np.pi / 180.0
|
|
24
|
+
nx = np.sin(angle)
|
|
25
|
+
ny = np.cos(angle)
|
|
26
|
+
|
|
27
|
+
dest_x = center[1] + nx * self._distance
|
|
28
|
+
dest_y = center[0] + ny * self._distance
|
|
29
|
+
|
|
30
|
+
return Point(dest_x, dest_y)
|
|
31
|
+
|
|
32
|
+
distance = Distance
|