p835 0.1.0__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.
- p835-0.1.0/LICENSE +21 -0
- p835-0.1.0/NOTICE +26 -0
- p835-0.1.0/PKG-INFO +70 -0
- p835-0.1.0/README.md +54 -0
- p835-0.1.0/pyproject.toml +28 -0
- p835-0.1.0/setup.cfg +4 -0
- p835-0.1.0/src/p835/__init__.py +87 -0
- p835-0.1.0/src/p835/common/__init__.py +7 -0
- p835-0.1.0/src/p835/common/constants.py +172 -0
- p835-0.1.0/src/p835/common/exceptions.py +40 -0
- p835-0.1.0/src/p835/conversions.py +106 -0
- p835-0.1.0/src/p835/reference_atmosphere.py +328 -0
- p835-0.1.0/src/p835/seasonal_atmosphere.py +499 -0
- p835-0.1.0/src/p835.egg-info/PKG-INFO +70 -0
- p835-0.1.0/src/p835.egg-info/SOURCES.txt +17 -0
- p835-0.1.0/src/p835.egg-info/dependency_links.txt +1 -0
- p835-0.1.0/src/p835.egg-info/requires.txt +3 -0
- p835-0.1.0/src/p835.egg-info/top_level.txt +1 -0
- p835-0.1.0/tests/test_p835.py +362 -0
p835-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
p835-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
ATTRIBUTION AND SOURCES
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
This software (PyP835) is a Python implementation of the mathematical
|
|
5
|
+
model described in:
|
|
6
|
+
|
|
7
|
+
ITU-R P.835-7 — "Reference standard atmospheres"
|
|
8
|
+
International Telecommunication Union, Radiocommunication Sector (ITU-R)
|
|
9
|
+
Geneva, Switzerland
|
|
10
|
+
|
|
11
|
+
The ITU-R Recommendations are publicly available at:
|
|
12
|
+
https://www.itu.int/rec/R-REC-P.835-7/en
|
|
13
|
+
|
|
14
|
+
The original reference implementation in C++ was published by the
|
|
15
|
+
U.S. National Telecommunications and Information Administration (NTIA)
|
|
16
|
+
and is available at:
|
|
17
|
+
https://github.com/NTIA/p835-7
|
|
18
|
+
|
|
19
|
+
The Python port was created by:
|
|
20
|
+
Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>, 2026
|
|
21
|
+
|
|
22
|
+
This software is provided under the MIT License (see LICENSE).
|
|
23
|
+
|
|
24
|
+
The author of this port is not affiliated with ITU or NTIA. All
|
|
25
|
+
formulas and algorithms are taken from the publicly available
|
|
26
|
+
ITU-R Recommendations.
|
p835-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: p835
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: ITU-R P.835-7 reference standard atmospheres
|
|
5
|
+
Author-email: Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Provides-Extra: test
|
|
14
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# p835
|
|
18
|
+
|
|
19
|
+
Python-реализация **ITU-R P.835-7** — «Reference standard
|
|
20
|
+
atmospheres».
|
|
21
|
+
|
|
22
|
+
## Установка
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install -e .
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Использование
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from p835 import global_temperature, global_pressure
|
|
32
|
+
|
|
33
|
+
T = global_temperature(10.0) # K
|
|
34
|
+
P = global_pressure(10.0) # гПа
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Тесты
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pytest tests/ -v
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Attribution
|
|
44
|
+
|
|
45
|
+
ATTRIBUTION AND SOURCES
|
|
46
|
+
========================
|
|
47
|
+
|
|
48
|
+
This software (PyP835) is a Python implementation of the mathematical
|
|
49
|
+
model described in:
|
|
50
|
+
|
|
51
|
+
ITU-R P.835-7 — "Reference standard atmospheres"
|
|
52
|
+
International Telecommunication Union, Radiocommunication Sector (ITU-R)
|
|
53
|
+
Geneva, Switzerland
|
|
54
|
+
|
|
55
|
+
The ITU-R Recommendations are publicly available at:
|
|
56
|
+
https://www.itu.int/rec/R-REC-P.835-7/en
|
|
57
|
+
|
|
58
|
+
The original reference implementation in C++ was published by the
|
|
59
|
+
U.S. National Telecommunications and Information Administration (NTIA)
|
|
60
|
+
and is available at:
|
|
61
|
+
https://github.com/NTIA/p835-7
|
|
62
|
+
|
|
63
|
+
The Python port was created by:
|
|
64
|
+
Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>, 2026
|
|
65
|
+
|
|
66
|
+
This software is provided under the MIT License (see LICENSE).
|
|
67
|
+
|
|
68
|
+
The author of this port is not affiliated with ITU or NTIA. All
|
|
69
|
+
formulas and algorithms are taken from the publicly available
|
|
70
|
+
ITU-R Recommendations.
|
p835-0.1.0/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# p835
|
|
2
|
+
|
|
3
|
+
Python-реализация **ITU-R P.835-7** — «Reference standard
|
|
4
|
+
atmospheres».
|
|
5
|
+
|
|
6
|
+
## Установка
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install -e .
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Использование
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from p835 import global_temperature, global_pressure
|
|
16
|
+
|
|
17
|
+
T = global_temperature(10.0) # K
|
|
18
|
+
P = global_pressure(10.0) # гПа
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Тесты
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pytest tests/ -v
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Attribution
|
|
28
|
+
|
|
29
|
+
ATTRIBUTION AND SOURCES
|
|
30
|
+
========================
|
|
31
|
+
|
|
32
|
+
This software (PyP835) is a Python implementation of the mathematical
|
|
33
|
+
model described in:
|
|
34
|
+
|
|
35
|
+
ITU-R P.835-7 — "Reference standard atmospheres"
|
|
36
|
+
International Telecommunication Union, Radiocommunication Sector (ITU-R)
|
|
37
|
+
Geneva, Switzerland
|
|
38
|
+
|
|
39
|
+
The ITU-R Recommendations are publicly available at:
|
|
40
|
+
https://www.itu.int/rec/R-REC-P.835-7/en
|
|
41
|
+
|
|
42
|
+
The original reference implementation in C++ was published by the
|
|
43
|
+
U.S. National Telecommunications and Information Administration (NTIA)
|
|
44
|
+
and is available at:
|
|
45
|
+
https://github.com/NTIA/p835-7
|
|
46
|
+
|
|
47
|
+
The Python port was created by:
|
|
48
|
+
Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>, 2026
|
|
49
|
+
|
|
50
|
+
This software is provided under the MIT License (see LICENSE).
|
|
51
|
+
|
|
52
|
+
The author of this port is not affiliated with ITU or NTIA. All
|
|
53
|
+
formulas and algorithms are taken from the publicly available
|
|
54
|
+
ITU-R Recommendations.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "p835"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "ITU-R P.835-7 reference standard atmospheres"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
dependencies = []
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
license = { text = "MIT" }
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Evgeny Gennadievich Prutkov", email = "sviazist.pr@gmail.com" },
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
test = ["pytest>=7"]
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.packages.find]
|
|
25
|
+
where = ["src"]
|
|
26
|
+
|
|
27
|
+
[tool.pytest.ini_options]
|
|
28
|
+
testpaths = ["tests"]
|
p835-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Copyright (c) 2026 Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
# Python implementation of ITU-R P.835-7.
|
|
5
|
+
# See README.md and NOTICE for attribution.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
p835 — ITU-R P.835-7 (Reference standard atmospheres).
|
|
9
|
+
|
|
10
|
+
Использование:
|
|
11
|
+
from p835 import global_temperature, global_pressure
|
|
12
|
+
|
|
13
|
+
T = global_temperature(10.0) # K
|
|
14
|
+
P = global_pressure(10.0) # гПа
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .reference_atmosphere import (
|
|
18
|
+
global_temperature,
|
|
19
|
+
global_pressure,
|
|
20
|
+
global_water_vapour_density,
|
|
21
|
+
global_wet_pressure,
|
|
22
|
+
MODEL_NAME,
|
|
23
|
+
)
|
|
24
|
+
from .seasonal_atmosphere import (
|
|
25
|
+
AtmosphereRegion,
|
|
26
|
+
Season,
|
|
27
|
+
interpolated_temperature,
|
|
28
|
+
interpolated_pressure,
|
|
29
|
+
interpolated_water_vapour,
|
|
30
|
+
get_region_for_latitude,
|
|
31
|
+
regional_temperature,
|
|
32
|
+
regional_pressure,
|
|
33
|
+
regional_water_vapour,
|
|
34
|
+
low_latitude_annual_temperature,
|
|
35
|
+
low_latitude_annual_pressure,
|
|
36
|
+
low_latitude_annual_water_vapour,
|
|
37
|
+
mid_latitude_summer_temperature,
|
|
38
|
+
mid_latitude_summer_pressure,
|
|
39
|
+
mid_latitude_summer_water_vapour,
|
|
40
|
+
mid_latitude_winter_temperature,
|
|
41
|
+
mid_latitude_winter_pressure,
|
|
42
|
+
mid_latitude_winter_water_vapour,
|
|
43
|
+
high_latitude_summer_temperature,
|
|
44
|
+
high_latitude_summer_pressure,
|
|
45
|
+
high_latitude_summer_water_vapour,
|
|
46
|
+
high_latitude_winter_temperature,
|
|
47
|
+
high_latitude_winter_pressure,
|
|
48
|
+
high_latitude_winter_water_vapour,
|
|
49
|
+
)
|
|
50
|
+
from .conversions import (
|
|
51
|
+
convert_to_geopotential_height,
|
|
52
|
+
convert_to_geometric_height,
|
|
53
|
+
water_vapour_density_to_pressure,
|
|
54
|
+
water_vapour_pressure_to_density,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
__version__ = "0.1.0"
|
|
58
|
+
|
|
59
|
+
__all__ = [
|
|
60
|
+
"global_temperature", "global_pressure",
|
|
61
|
+
"global_water_vapour_density", "global_wet_pressure",
|
|
62
|
+
"MODEL_NAME",
|
|
63
|
+
"AtmosphereRegion", "Season",
|
|
64
|
+
"interpolated_temperature", "interpolated_pressure",
|
|
65
|
+
"interpolated_water_vapour", "get_region_for_latitude",
|
|
66
|
+
"regional_temperature", "regional_pressure",
|
|
67
|
+
"regional_water_vapour",
|
|
68
|
+
"low_latitude_annual_temperature",
|
|
69
|
+
"low_latitude_annual_pressure",
|
|
70
|
+
"low_latitude_annual_water_vapour",
|
|
71
|
+
"mid_latitude_summer_temperature",
|
|
72
|
+
"mid_latitude_summer_pressure",
|
|
73
|
+
"mid_latitude_summer_water_vapour",
|
|
74
|
+
"mid_latitude_winter_temperature",
|
|
75
|
+
"mid_latitude_winter_pressure",
|
|
76
|
+
"mid_latitude_winter_water_vapour",
|
|
77
|
+
"high_latitude_summer_temperature",
|
|
78
|
+
"high_latitude_summer_pressure",
|
|
79
|
+
"high_latitude_summer_water_vapour",
|
|
80
|
+
"high_latitude_winter_temperature",
|
|
81
|
+
"high_latitude_winter_pressure",
|
|
82
|
+
"high_latitude_winter_water_vapour",
|
|
83
|
+
"convert_to_geopotential_height",
|
|
84
|
+
"convert_to_geometric_height",
|
|
85
|
+
"water_vapour_density_to_pressure",
|
|
86
|
+
"water_vapour_pressure_to_density",
|
|
87
|
+
]
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Copyright (c) 2026 Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
# Python implementation of ITU-R P.835-7.
|
|
5
|
+
# See README.md and NOTICE for attribution.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
core/itu/common/constants.py — Физические и математические константы,
|
|
9
|
+
используемые во всех моделях ITU-R.
|
|
10
|
+
|
|
11
|
+
Источник: Рекомендации ITU-R P-серии, U.S. Standard Atmosphere 1976.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import math
|
|
15
|
+
|
|
16
|
+
# =====================================================================
|
|
17
|
+
# ГЕОМЕТРИЧЕСКИЕ И ГРАВИТАЦИОННЫЕ КОНСТАНТЫ
|
|
18
|
+
# =====================================================================
|
|
19
|
+
|
|
20
|
+
# Радиус Земли (средний), км — ITU-R P.452, P.526, P.530, P.1812
|
|
21
|
+
EARTH_RADIUS_KM = 6371.0
|
|
22
|
+
|
|
23
|
+
# Радиус Земли по U.S. Standard Atmosphere 1976, км — P.835 (1a/1b)
|
|
24
|
+
# ВАЖНО: в P.835 используется именно это значение (6 356.766 км),
|
|
25
|
+
# а не 6371. Не путать!
|
|
26
|
+
EARTH_RADIUS_P835_KM = 6356.766
|
|
27
|
+
|
|
28
|
+
# Ускорение свободного падения на поверхности Земли, м/с²
|
|
29
|
+
G0 = 9.80665
|
|
30
|
+
|
|
31
|
+
# =====================================================================
|
|
32
|
+
# АТМОСФЕРНЫЕ КОНСТАНТЫ (стандартные, на уровне моря)
|
|
33
|
+
# =====================================================================
|
|
34
|
+
|
|
35
|
+
# Стандартные условия U.S. Standard Atmosphere 1976 / ITU-R P.835
|
|
36
|
+
T0_K = 288.15 # температура, K
|
|
37
|
+
P0_HPA = 1013.25 # давление, гПа
|
|
38
|
+
RHO0_WATER_G_M3 = 7.5 # плотность водяного пара, г/м³
|
|
39
|
+
|
|
40
|
+
# Универсальная газовая постоянная, Дж/(моль·К)
|
|
41
|
+
R_UNIVERSAL = 8.314462618
|
|
42
|
+
|
|
43
|
+
# Газовая постоянная сухого воздуха, Дж/(кг·К)
|
|
44
|
+
R_DRY = 287.053
|
|
45
|
+
|
|
46
|
+
# Газовая постоянная водяного пара, Дж/(кг·К)
|
|
47
|
+
R_H2O = 461.495
|
|
48
|
+
|
|
49
|
+
# Молярные массы (кг/моль)
|
|
50
|
+
M_DRY_AIR = 28.9644e-3
|
|
51
|
+
M_H2O = 18.0153e-3
|
|
52
|
+
|
|
53
|
+
# Молекулярные массы (относительные, для P.676)
|
|
54
|
+
# M_d = 28.966, M_w = 18.01528
|
|
55
|
+
M_DRY_AIR_P676 = 28.966
|
|
56
|
+
M_H2O_P676 = 18.01528
|
|
57
|
+
|
|
58
|
+
# =====================================================================
|
|
59
|
+
# МАТЕМАТИЧЕСКИЕ КОНСТАНТЫ
|
|
60
|
+
# =====================================================================
|
|
61
|
+
|
|
62
|
+
# Скорость света в вакууме, м/с
|
|
63
|
+
SPEED_OF_LIGHT = 299792458.0
|
|
64
|
+
|
|
65
|
+
# Скорость света, приближённая, км/с — для удобства формул (c ≈ 300 000)
|
|
66
|
+
SPEED_OF_LIGHT_KM_S = 300000.0
|
|
67
|
+
|
|
68
|
+
# Постоянная Больцмана, Дж/К
|
|
69
|
+
K_BOLTZMANN = 1.380649e-23
|
|
70
|
+
|
|
71
|
+
# Температура стандартного шума, K (ITU-R P.372)
|
|
72
|
+
T_NOISE_K = 290.0
|
|
73
|
+
|
|
74
|
+
# Постоянная Эйлера-Маскерони (не путать с числом e!)
|
|
75
|
+
EULER_GAMMA = 0.5772156649015329
|
|
76
|
+
|
|
77
|
+
# Число e
|
|
78
|
+
E = math.e
|
|
79
|
+
|
|
80
|
+
# π
|
|
81
|
+
PI = math.pi
|
|
82
|
+
|
|
83
|
+
# =====================================================================
|
|
84
|
+
# ПРЕДЕЛЫ ПРИМЕНИМОСТИ МОДЕЛЕЙ ITU-R
|
|
85
|
+
# (для валидации входных параметров)
|
|
86
|
+
# =====================================================================
|
|
87
|
+
|
|
88
|
+
# P.835: диапазон высот
|
|
89
|
+
P835_Z_MIN_KM = 0.0
|
|
90
|
+
P835_Z_MAX_KM = 100.0
|
|
91
|
+
P835_Z_REGIME1_MAX_KM = 86.0 # переход на regime 2
|
|
92
|
+
P835_H_REGIME1_MAX_KM = 84.852 # геопотенциальная граница
|
|
93
|
+
|
|
94
|
+
# P.676: диапазон частот
|
|
95
|
+
P676_F_MIN_GHZ = 1.0
|
|
96
|
+
P676_F_MAX_GHZ = 1000.0
|
|
97
|
+
|
|
98
|
+
# P.528: диапазон частот, расстояний, высот
|
|
99
|
+
P528_F_MIN_MHZ = 100.0
|
|
100
|
+
P528_F_MAX_MHZ = 30000.0
|
|
101
|
+
P528_H_MIN_M = 1.5
|
|
102
|
+
P528_H_MAX_M = 20000.0
|
|
103
|
+
P528_D_MAX_KM = 1800.0
|
|
104
|
+
|
|
105
|
+
# P.530: диапазон частот, расстояний
|
|
106
|
+
P530_F_MIN_GHZ = 0.45
|
|
107
|
+
P530_F_MAX_GHZ = 45.0
|
|
108
|
+
P530_D_MIN_KM = 7.5
|
|
109
|
+
P530_D_MAX_KM = 300.0
|
|
110
|
+
|
|
111
|
+
# P.452: диапазон частот, расстояний
|
|
112
|
+
P452_F_MIN_GHZ = 0.1
|
|
113
|
+
P452_F_MAX_GHZ = 50.0
|
|
114
|
+
P452_D_MAX_KM = 10000.0
|
|
115
|
+
|
|
116
|
+
# P.1812: диапазон частот, расстояний
|
|
117
|
+
P1812_F_MIN_MHZ = 30.0
|
|
118
|
+
P1812_F_MAX_MHZ = 6000.0
|
|
119
|
+
P1812_D_MIN_KM = 0.25
|
|
120
|
+
P1812_D_MAX_KM = 3000.0
|
|
121
|
+
|
|
122
|
+
# P.2108: диапазон частот
|
|
123
|
+
P2108_F_MIN_GHZ = 0.03
|
|
124
|
+
P2108_F_MAX_GHZ = 100.0
|
|
125
|
+
|
|
126
|
+
# P.533: диапазон частот
|
|
127
|
+
P533_F_MIN_MHZ = 2.0
|
|
128
|
+
P533_F_MAX_MHZ = 30.0
|
|
129
|
+
|
|
130
|
+
# =====================================================================
|
|
131
|
+
# ЗНАЧЕНИЯ ПО УМОЛЧАНИЮ
|
|
132
|
+
# =====================================================================
|
|
133
|
+
|
|
134
|
+
DEFAULT_TEMPERATURE_C = 15.0
|
|
135
|
+
DEFAULT_PRESSURE_HPA = 1013.25
|
|
136
|
+
DEFAULT_HUMIDITY_PERCENT = 50.0
|
|
137
|
+
DEFAULT_WATER_VAPOUR_DENSITY_G_M3 = 7.5
|
|
138
|
+
DEFAULT_POLARIZATION = 'V'
|
|
139
|
+
|
|
140
|
+
# __all__ — публичный API модуля
|
|
141
|
+
__all__ = [
|
|
142
|
+
# Геометрия и гравитация
|
|
143
|
+
'EARTH_RADIUS_KM',
|
|
144
|
+
'EARTH_RADIUS_P835_KM',
|
|
145
|
+
'G0',
|
|
146
|
+
# Атмосфера
|
|
147
|
+
'T0_K', 'P0_HPA', 'RHO0_WATER_G_M3',
|
|
148
|
+
'R_UNIVERSAL', 'R_DRY', 'R_H2O',
|
|
149
|
+
'M_DRY_AIR', 'M_H2O',
|
|
150
|
+
'M_DRY_AIR_P676', 'M_H2O_P676',
|
|
151
|
+
# Математика
|
|
152
|
+
'SPEED_OF_LIGHT', 'SPEED_OF_LIGHT_KM_S',
|
|
153
|
+
'K_BOLTZMANN', 'T_NOISE_K',
|
|
154
|
+
'EULER_GAMMA', 'E', 'PI',
|
|
155
|
+
# Пределы
|
|
156
|
+
'P835_Z_MIN_KM', 'P835_Z_MAX_KM',
|
|
157
|
+
'P835_Z_REGIME1_MAX_KM', 'P835_H_REGIME1_MAX_KM',
|
|
158
|
+
'P676_F_MIN_GHZ', 'P676_F_MAX_GHZ',
|
|
159
|
+
'P528_F_MIN_MHZ', 'P528_F_MAX_MHZ',
|
|
160
|
+
'P528_H_MIN_M', 'P528_H_MAX_M', 'P528_D_MAX_KM',
|
|
161
|
+
'P530_F_MIN_GHZ', 'P530_F_MAX_GHZ',
|
|
162
|
+
'P530_D_MIN_KM', 'P530_D_MAX_KM',
|
|
163
|
+
'P452_F_MIN_GHZ', 'P452_F_MAX_GHZ', 'P452_D_MAX_KM',
|
|
164
|
+
'P1812_F_MIN_MHZ', 'P1812_F_MAX_MHZ',
|
|
165
|
+
'P1812_D_MIN_KM', 'P1812_D_MAX_KM',
|
|
166
|
+
'P2108_F_MIN_GHZ', 'P2108_F_MAX_GHZ',
|
|
167
|
+
'P533_F_MIN_MHZ', 'P533_F_MAX_MHZ',
|
|
168
|
+
# Умолчания
|
|
169
|
+
'DEFAULT_TEMPERATURE_C', 'DEFAULT_PRESSURE_HPA',
|
|
170
|
+
'DEFAULT_HUMIDITY_PERCENT', 'DEFAULT_WATER_VAPOUR_DENSITY_G_M3',
|
|
171
|
+
'DEFAULT_POLARIZATION',
|
|
172
|
+
]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Copyright (c) 2026 Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
# Python implementation of ITU-R P.835-7.
|
|
5
|
+
# See README.md and NOTICE for attribution.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
core/itu/common/exceptions.py — Исключения для моделей ITU-R.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ITUError(Exception):
|
|
13
|
+
"""Базовый класс для всех ошибок моделей ITU-R."""
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ITUValidationError(ITUError):
|
|
18
|
+
"""
|
|
19
|
+
Ошибка валидации входных параметров.
|
|
20
|
+
|
|
21
|
+
Поднимается, когда параметр критически вне диапазона применимости
|
|
22
|
+
модели, и клиент запросил строгий режим (strict=True).
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, model: str, param: str, value, expected: str):
|
|
26
|
+
self.model = model
|
|
27
|
+
self.param = param
|
|
28
|
+
self.value = value
|
|
29
|
+
self.expected = expected
|
|
30
|
+
super().__init__(
|
|
31
|
+
f"[{model}] Параметр '{param}' = {value} вне диапазона: {expected}"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ITUComputationError(ITUError):
|
|
36
|
+
"""Ошибка в процессе вычисления (NaN, деление на ноль и т.п.)."""
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
__all__ = ['ITUError', 'ITUValidationError', 'ITUComputationError']
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Copyright (c) 2026 Evgeny Gennadievich Prutkov <sviazist.pr@gmail.com>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
#
|
|
4
|
+
# Python implementation of ITU-R P.835-7.
|
|
5
|
+
# See README.md and NOTICE for attribution.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
core/itu/p835/conversions.py — Преобразования высот и давлений
|
|
9
|
+
по ITU-R P.835-7 (Annex 1).
|
|
10
|
+
|
|
11
|
+
Формулы:
|
|
12
|
+
(1a): H = 6356.766·Z / (6356.766 + Z)
|
|
13
|
+
(1b): Z = 6356.766·H / (6356.766 − H)
|
|
14
|
+
(7): e = ρ·T / 216.7
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .common.constants import EARTH_RADIUS_P835_KM
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def convert_to_geopotential_height(z_km: float) -> float:
|
|
21
|
+
"""
|
|
22
|
+
Геометрическая высота Z (км) → геопотенциальная H (км).
|
|
23
|
+
|
|
24
|
+
P.835-7, ур. (1a):
|
|
25
|
+
H = 6356.766·Z / (6356.766 + Z)
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
z_km: геометрическая высота, км (0..100).
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
Геопотенциальная высота, км.
|
|
32
|
+
"""
|
|
33
|
+
r = EARTH_RADIUS_P835_KM
|
|
34
|
+
return (r * z_km) / (r + z_km)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def convert_to_geometric_height(h_km: float) -> float:
|
|
38
|
+
"""
|
|
39
|
+
Геопотенциальная высота H (км) → геометрическая Z (км).
|
|
40
|
+
|
|
41
|
+
P.835-7, ур. (1b):
|
|
42
|
+
Z = 6356.766·H / (6356.766 − H)
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
h_km: геопотенциальная высота, км (0..84.852).
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
Геометрическая высота, км.
|
|
49
|
+
|
|
50
|
+
Raises:
|
|
51
|
+
ValueError: если h_km >= 6356.766 (вырожденный случай).
|
|
52
|
+
"""
|
|
53
|
+
r = EARTH_RADIUS_P835_KM
|
|
54
|
+
if h_km >= r:
|
|
55
|
+
raise ValueError(
|
|
56
|
+
f"convert_to_geometric_height: H={h_km} км ≥ {r} км"
|
|
57
|
+
)
|
|
58
|
+
return (r * h_km) / (r - h_km)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def water_vapour_density_to_pressure(
|
|
62
|
+
rho_g_m3: float, temperature_k: float
|
|
63
|
+
) -> float:
|
|
64
|
+
"""
|
|
65
|
+
Плотность водяного пара ρ (г/м³) → парциальное давление e (гПа).
|
|
66
|
+
|
|
67
|
+
P.835-7, ур. (7):
|
|
68
|
+
e = ρ·T / 216.7
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
rho_g_m3: плотность водяного пара, г/м³.
|
|
72
|
+
temperature_k: температура, K.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Парциальное давление водяного пара, гПа.
|
|
76
|
+
"""
|
|
77
|
+
return rho_g_m3 * temperature_k / 216.7
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def water_vapour_pressure_to_density(
|
|
81
|
+
e_hpa: float, temperature_k: float
|
|
82
|
+
) -> float:
|
|
83
|
+
"""
|
|
84
|
+
Парциальное давление e (гПа) → плотность ρ (г/м³).
|
|
85
|
+
|
|
86
|
+
Обратная к (7):
|
|
87
|
+
ρ = e·216.7 / T
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
e_hpa: парциальное давление, гПа.
|
|
91
|
+
temperature_k: температура, K.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Плотность водяного пара, г/м³.
|
|
95
|
+
"""
|
|
96
|
+
if temperature_k <= 0:
|
|
97
|
+
return 0.0
|
|
98
|
+
return e_hpa * 216.7 / temperature_k
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
__all__ = [
|
|
102
|
+
'convert_to_geopotential_height',
|
|
103
|
+
'convert_to_geometric_height',
|
|
104
|
+
'water_vapour_density_to_pressure',
|
|
105
|
+
'water_vapour_pressure_to_density',
|
|
106
|
+
]
|