abja-utils 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- abja_utils-0.0.2/LICENSE +19 -0
- abja_utils-0.0.2/PKG-INFO +38 -0
- abja_utils-0.0.2/README.md +4 -0
- abja_utils-0.0.2/pyproject.toml +24 -0
- abja_utils-0.0.2/setup.cfg +4 -0
- abja_utils-0.0.2/src/abja_utils/__init__.py +4 -0
- abja_utils-0.0.2/src/abja_utils/subplots.py +119 -0
- abja_utils-0.0.2/src/abja_utils/utils.py +13 -0
- abja_utils-0.0.2/src/abja_utils.egg-info/PKG-INFO +38 -0
- abja_utils-0.0.2/src/abja_utils.egg-info/SOURCES.txt +11 -0
- abja_utils-0.0.2/src/abja_utils.egg-info/dependency_links.txt +1 -0
- abja_utils-0.0.2/src/abja_utils.egg-info/requires.txt +3 -0
- abja_utils-0.0.2/src/abja_utils.egg-info/top_level.txt +1 -0
abja_utils-0.0.2/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2025 DHI Water and Environment Inc
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: abja_utils
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A useful set of utilities
|
|
5
|
+
Author-email: Abbas Jazaeri <abja@dhigroup.com>
|
|
6
|
+
License: Copyright (c) 2025 DHI Water and Environment Inc
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: numpy
|
|
31
|
+
Requires-Dist: matplotlib
|
|
32
|
+
Requires-Dist: cycler
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# Installation
|
|
36
|
+
```cmd
|
|
37
|
+
pip install abja_mpl
|
|
38
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "abja_utils"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Abbas Jazaeri", email="abja@dhigroup.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "A useful set of utilities"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
license = {file = "LICENSE"}
|
|
19
|
+
dependencies = [
|
|
20
|
+
"numpy",
|
|
21
|
+
"matplotlib",
|
|
22
|
+
"cycler",
|
|
23
|
+
]
|
|
24
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import cycler
|
|
2
|
+
import matplotlib as mpl
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
class Colors:
|
|
7
|
+
# --- Blues (cool & clean) ---
|
|
8
|
+
blue1 = '#0a3d62' # deep navy
|
|
9
|
+
blue2 = '#3c6382' # muted ocean blue
|
|
10
|
+
blue3 = '#60a3bc' # light teal-blue
|
|
11
|
+
blue4 = '#c8dce3' # pale blue-gray
|
|
12
|
+
|
|
13
|
+
# --- Greens (fresh & natural) ---
|
|
14
|
+
green1 = '#2e7d32' # deep forest green
|
|
15
|
+
green2 = '#43a047' # balanced natural green
|
|
16
|
+
green3 = '#66bb6a' # medium soft green
|
|
17
|
+
green4 = '#a5d6a7' # pale mint green
|
|
18
|
+
|
|
19
|
+
# --- Grays (neutral and balanced) ---
|
|
20
|
+
gray1 = '#424242' # extra dark gray
|
|
21
|
+
gray2 = '#616161' # dark slate gray
|
|
22
|
+
gray3 = '#9e9e9e' # medium gray
|
|
23
|
+
gray4 = '#e0e0e0' # light neutral gray
|
|
24
|
+
|
|
25
|
+
# --- Reds (rich & elegant) ---
|
|
26
|
+
red1 = '#b71c1c' # strong crimson
|
|
27
|
+
red2 = '#d32f2f' # vibrant red
|
|
28
|
+
red3 = '#ef5350' # soft coral red
|
|
29
|
+
red4 = '#ffcdd2' # pale rose red
|
|
30
|
+
|
|
31
|
+
# --- Yellows (warm & subtle) ---
|
|
32
|
+
yellow1 = '#f9a825' # amber yellow
|
|
33
|
+
yellow2 = '#fbc02d' # golden yellow
|
|
34
|
+
yellow3 = '#fdd835' # bright lemon yellow
|
|
35
|
+
yellow4 = '#fff176' # pastel yellow
|
|
36
|
+
|
|
37
|
+
# --- Oranges (warm gradient) ---
|
|
38
|
+
orange1 = '#ef6c00' # deep orange
|
|
39
|
+
orange2 = '#fb8c00' # medium orange
|
|
40
|
+
orange3 = '#ffb74d' # light orange
|
|
41
|
+
orange4 = '#ffe0b2' # soft peach
|
|
42
|
+
|
|
43
|
+
# --- Purples (modern & rich) ---
|
|
44
|
+
purple1 = '#4a148c' # deep violet
|
|
45
|
+
purple2 = '#7b1fa2' # rich purple
|
|
46
|
+
purple3 = '#ba68c8' # soft lavender
|
|
47
|
+
purple4 = '#e1bee7' # pale violet
|
|
48
|
+
|
|
49
|
+
# --- Teals (balanced between blue & green) ---
|
|
50
|
+
teal1 = '#00695c' # deep teal
|
|
51
|
+
teal2 = '#00897b' # medium teal
|
|
52
|
+
teal3 = '#26a69a' # light teal
|
|
53
|
+
teal4 = '#80cbc4' # pale aqua
|
|
54
|
+
|
|
55
|
+
# --- Browns (earth tones) ---
|
|
56
|
+
brown1 = '#4e342e' # dark brown
|
|
57
|
+
brown2 = '#6d4c41' # medium brown
|
|
58
|
+
brown3 = '#8d6e63' # light brown
|
|
59
|
+
brown4 = '#d7ccc8' # beige tone
|
|
60
|
+
|
|
61
|
+
# --- Pinks (vibrant & modern) ---
|
|
62
|
+
pink1 = '#880e4f' # rich magenta
|
|
63
|
+
pink2 = '#c2185b' # bold pink
|
|
64
|
+
pink3 = '#f06292' # light rose
|
|
65
|
+
pink4 = '#f8bbd0' # pale blush
|
|
66
|
+
|
|
67
|
+
# --- Cyans (clean & refreshing) ---
|
|
68
|
+
cyan1 = '#006064' # dark cyan
|
|
69
|
+
cyan2 = '#00838f' # medium cyan
|
|
70
|
+
cyan3 = '#26c6da' # bright cyan
|
|
71
|
+
cyan4 = '#b2ebf2' # soft cyan tint
|
|
72
|
+
|
|
73
|
+
plt.rcParams['font.family'] = 'Times New Roman'
|
|
74
|
+
plt.rcParams['mathtext.fontset'] = 'stix'
|
|
75
|
+
colors = [Colors.blue3, Colors.red2, Colors.green2, Colors.yellow1, Colors.purple2, Colors.teal1, Colors.pink3, Colors.brown2, Colors.cyan3]
|
|
76
|
+
cyl = cycler.cycler('color', colors)
|
|
77
|
+
plt.rcParams['axes.prop_cycle'] = cyl
|
|
78
|
+
|
|
79
|
+
mpl.rcParams['font.size'] = 9
|
|
80
|
+
mpl.rcParams['lines.linewidth'] = 2
|
|
81
|
+
mpl.rcParams['lines.color'] = 'black'
|
|
82
|
+
mpl.rcParams['patch.edgecolor'] = 'white'
|
|
83
|
+
mpl.rcParams['axes.grid.which'] = 'major'
|
|
84
|
+
mpl.rcParams['lines.markersize'] = 1.6
|
|
85
|
+
mpl.rcParams['ytick.labelsize'] = 8
|
|
86
|
+
mpl.rcParams['xtick.labelsize'] = 8
|
|
87
|
+
mpl.rcParams['ytick.labelright'] = False
|
|
88
|
+
mpl.rcParams['xtick.labeltop'] = False
|
|
89
|
+
mpl.rcParams['ytick.right'] = True
|
|
90
|
+
mpl.rcParams['xtick.top'] = True
|
|
91
|
+
mpl.rcParams['ytick.major.right'] = True
|
|
92
|
+
mpl.rcParams['xtick.major.top'] = True
|
|
93
|
+
mpl.rcParams['axes.labelweight'] = 'normal'
|
|
94
|
+
mpl.rcParams['legend.fontsize'] = 8
|
|
95
|
+
mpl.rcParams['legend.framealpha']= 0.5
|
|
96
|
+
mpl.rcParams['axes.titlesize'] = 12
|
|
97
|
+
mpl.rcParams['axes.titleweight'] ='normal'
|
|
98
|
+
mpl.rcParams['font.family'] ='TImes New Roman'
|
|
99
|
+
mpl.rcParams['axes.labelsize'] = 10
|
|
100
|
+
mpl.rcParams['axes.linewidth'] = 1.25
|
|
101
|
+
mpl.rcParams['xtick.major.size'] = 5.0
|
|
102
|
+
mpl.rcParams['xtick.minor.size'] = 3.0
|
|
103
|
+
mpl.rcParams['ytick.major.size'] = 5.0
|
|
104
|
+
mpl.rcParams['ytick.minor.size'] = 3.0
|
|
105
|
+
|
|
106
|
+
alpha = 0.7
|
|
107
|
+
to_rgba = mpl.colors.ColorConverter().to_rgba
|
|
108
|
+
mpl.rcParams['xtick.direction'] = 'in'
|
|
109
|
+
mpl.rcParams['ytick.direction'] = 'in'
|
|
110
|
+
|
|
111
|
+
def subplots(figwidth=14, figheight=10, nrows=1, ncols=1, sharex=False, sharey=False):
|
|
112
|
+
figwidth = figwidth / 2.54 # convert cm to inches
|
|
113
|
+
figheight = figheight / 2.54 # convert cm to inches
|
|
114
|
+
|
|
115
|
+
fig, ax = plt.subplots(figsize=(figwidth,figheight), nrows=nrows, ncols=ncols, sharex=sharex, sharey=sharey)
|
|
116
|
+
axs = [ax] if nrows*ncols==1 else ax
|
|
117
|
+
for a in axs:
|
|
118
|
+
a.grid(alpha=0.25)
|
|
119
|
+
return fig, ax
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def uz2u10(Uz, z, mode, z0=0.001, power=0.1):
|
|
5
|
+
if mode == "log":
|
|
6
|
+
kappa = 0.4 # von Karman constant
|
|
7
|
+
Uf = Uz * kappa / np.log(z / z0)
|
|
8
|
+
U10 = Uf * (1 / kappa) * np.log(10 / z0)
|
|
9
|
+
elif mode == "power":
|
|
10
|
+
U10 = Uz * (10 / z) ** power
|
|
11
|
+
else:
|
|
12
|
+
raise ValueError("Mode must be 'log' or 'power'")
|
|
13
|
+
return U10
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: abja_utils
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A useful set of utilities
|
|
5
|
+
Author-email: Abbas Jazaeri <abja@dhigroup.com>
|
|
6
|
+
License: Copyright (c) 2025 DHI Water and Environment Inc
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Operating System :: OS Independent
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: numpy
|
|
31
|
+
Requires-Dist: matplotlib
|
|
32
|
+
Requires-Dist: cycler
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# Installation
|
|
36
|
+
```cmd
|
|
37
|
+
pip install abja_mpl
|
|
38
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/abja_utils/__init__.py
|
|
5
|
+
src/abja_utils/subplots.py
|
|
6
|
+
src/abja_utils/utils.py
|
|
7
|
+
src/abja_utils.egg-info/PKG-INFO
|
|
8
|
+
src/abja_utils.egg-info/SOURCES.txt
|
|
9
|
+
src/abja_utils.egg-info/dependency_links.txt
|
|
10
|
+
src/abja_utils.egg-info/requires.txt
|
|
11
|
+
src/abja_utils.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
abja_utils
|