Skip to content

Commit facd5e5

Browse files
Implement ITU-R P.676-13 gaseous attenuation recommendation (#102)
* Implement ITU-R P.676-13 (08/2022) gaseous attenuation recommendation Adds full support for P.676-13, the current revision of the gaseous attenuation recommendation, superseding P.676-12. Closes #69. Key changes from P.676-12: - Annex 1: Eq. 18a (arccos) replaced by Eq. 18b (arcsin) for the ray-bending angle in the layer-by-layer slant-path integration. - Annex 2: completely restructured. Oxygen equivalent height h0 is now computed from a Part 1 coefficient table (Eq. 31: h0 = a0 + b0*T + c0*Ps + d0*rho), and water-vapour equivalent height hw uses a new analytical formula (Eq. 37, Table 4 coefficients). Implementation details: - itur/data/676/v13_lines_oxygen.txt, v13_lines_water_vapour.txt: spectroscopic line data (Tables 1 & 2, identical to P.676-12). - itur/data/676/v13_h0_coefficients.txt: Part 1 oxygen equivalent-height coefficient file (700 frequencies, 1–350 GHz), downloaded from the ITU document server. - itur/models/itu676.py: new _ITU676_13_ class; default version bumped to 13. Validation (all against CG-3M3J-13-ValEx-Rev8.3.0.xlsx): - test/test_itu676_13.py: 21 dedicated unit tests. - test/ITU_validation_test.py: ITUR676_13TestCase added (16 assertions covering SpAtt, exact slant path Annex 1, and Annex 2 approx). - test/ITU_validation_report_test.py: ITUR676_13TestCase added with CSV- driven tests for gamma0, gammaw, gamma, and gaseous_attenuation_slant_path. - test/test_data/676/ITURP676-13_gamma.csv, test/test_data/676/ITURP676-13_A_gas.csv: new validation data files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Remove standalone test_itu676_13.py Tests are covered by ITU_validation_test.py (ITUR676_13TestCase) and ITU_validation_report_test.py (ITUR676_13TestCase). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add P.676-13 validation tables (350-row SpAtt + 10-row A_Gas_A2) Generate HTML validation tables for ITU-R P.676-13 equivalent to the existing P.676-12 tables, without modifying any pre-existing HTML files. Changes: - test/test_data/676/ITURP676-13_gamma.csv: expanded from 5 to 350 rows, covering f = 1–350 GHz at standard conditions (P=1013.25 hPa, T=288.15 K, rho=7.5 g/m³), values taken directly from the 'P.676-13 SpAtt' sheet of CG-3M3J-13-ValEx-Rev8.3.0.xlsx. - test/ITU_validation_report_test.py: ITUR676_13TestCase now passes prefixed test_name strings ('itur676_13_*') to __run__() so the generated HTML files are uniquely named and do not overwrite the P.676-12 tables. - docs/validation/itur676_13.rst: regenerated to reference the new prefixed HTML files. - docs/validation/itur676_13_gamma0_table.html (new, 350 rows) - docs/validation/itur676_13_gammaw_table.html (new, 350 rows) - docs/validation/itur676_13_gamma_table.html (new, 350 rows) - docs/validation/itur676_13_attenuation_gas_table.html (new, 10 rows) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent eb02971 commit facd5e5

13 files changed

Lines changed: 13626 additions & 3 deletions

docs/validation/itur676_13.rst

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
Validation results ITU-R P.676-13
2+
=================================
3+
4+
This page contains the validation examples for Recommendation ITU-R P.676-13: Attenuation by atmospheric gases and related effects.
5+
6+
All test cases were extracted from the
7+
`ITU Validation examples file (rev 5.1) <https://www.itu.int/en/ITU-R/study-groups/rsg3/ionotropospheric/CG-3M3J-13-ValEx-Rev5_1.xlsx>`_.
8+
9+
.. contents:: Functions tested
10+
:depth: 2
11+
12+
13+
Function gamma0_exact
14+
---------------------
15+
16+
The table below contains the results of testing function ``gamma0_exact``.
17+
The test cases were extracted from spreadsheet ``ITURP676-13_gamma.csv`` from the
18+
`ITU Validation examples file (rev 5.1) <https://www.itu.int/en/ITU-R/study-groups/rsg3/ionotropospheric/CG-3M3J-13-ValEx-Rev5_1.xlsx>`_.
19+
In addition to the input-arguments, expected result (``ITU Validation``), and
20+
ITU-Rpy computed result (``ITUR-py Result``), the absolute and relative errors
21+
are shown. Each test case is color-coded depending on the magnitude of the
22+
errors (green = pass, errors are negligible, red = fail, relative error is
23+
above 0.01%).
24+
25+
In addition, the code snippet below shows an example of how to generate the
26+
first row of the results in the table:
27+
28+
.. code-block:: python
29+
30+
import itur
31+
32+
# Define input attributes
33+
f = 1.0 # (GHz)
34+
P = 1013.25 # (hPA)
35+
rho = 7.5 # (g/cm3)
36+
T = 288.15 # (K)
37+
38+
# Make call to test-function gamma0_exact
39+
itur_val = itur.models.itu676.gamma0_exact(f=f, P=P, rho=rho, T=T)
40+
41+
# Compute error with respect to value in ITU example file
42+
ITU_example_val = 0.0053886581679065 # (dB/km)
43+
error = ITU_example_val - itur_val.value
44+
error_rel = error / ITU_example_val * 100 # (%)
45+
46+
47+
.. raw:: html
48+
:file: itur676_13_gamma0_table.html
49+
50+
51+
Function gammaw_exact
52+
---------------------
53+
54+
The table below contains the results of testing function ``gammaw_exact``.
55+
The test cases were extracted from spreadsheet ``ITURP676-13_gamma.csv`` from the
56+
`ITU Validation examples file (rev 5.1) <https://www.itu.int/en/ITU-R/study-groups/rsg3/ionotropospheric/CG-3M3J-13-ValEx-Rev5_1.xlsx>`_.
57+
In addition to the input-arguments, expected result (``ITU Validation``), and
58+
ITU-Rpy computed result (``ITUR-py Result``), the absolute and relative errors
59+
are shown. Each test case is color-coded depending on the magnitude of the
60+
errors (green = pass, errors are negligible, red = fail, relative error is
61+
above 0.01%).
62+
63+
In addition, the code snippet below shows an example of how to generate the
64+
first row of the results in the table:
65+
66+
.. code-block:: python
67+
68+
import itur
69+
70+
# Define input attributes
71+
f = 1.0 # (GHz)
72+
P = 1013.25 # (hPA)
73+
rho = 7.5 # (g/cm3)
74+
T = 288.15 # (K)
75+
76+
# Make call to test-function gammaw_exact
77+
itur_val = itur.models.itu676.gammaw_exact(f=f, P=P, rho=rho, T=T)
78+
79+
# Compute error with respect to value in ITU example file
80+
ITU_example_val = 5.09046173249644e-05 # (dB/km)
81+
error = ITU_example_val - itur_val.value
82+
error_rel = error / ITU_example_val * 100 # (%)
83+
84+
85+
.. raw:: html
86+
:file: itur676_13_gammaw_table.html
87+
88+
89+
Function gamma_exact
90+
--------------------
91+
92+
The table below contains the results of testing function ``gamma_exact``.
93+
The test cases were extracted from spreadsheet ``ITURP676-13_gamma.csv`` from the
94+
`ITU Validation examples file (rev 5.1) <https://www.itu.int/en/ITU-R/study-groups/rsg3/ionotropospheric/CG-3M3J-13-ValEx-Rev5_1.xlsx>`_.
95+
In addition to the input-arguments, expected result (``ITU Validation``), and
96+
ITU-Rpy computed result (``ITUR-py Result``), the absolute and relative errors
97+
are shown. Each test case is color-coded depending on the magnitude of the
98+
errors (green = pass, errors are negligible, red = fail, relative error is
99+
above 0.01%).
100+
101+
In addition, the code snippet below shows an example of how to generate the
102+
first row of the results in the table:
103+
104+
.. code-block:: python
105+
106+
import itur
107+
108+
# Define input attributes
109+
f = 1.0 # (GHz)
110+
P = 1013.25 # (hPA)
111+
rho = 7.5 # (g/cm3)
112+
T = 288.15 # (K)
113+
114+
# Make call to test-function gamma_exact
115+
itur_val = itur.models.itu676.gamma_exact(f=f, P=P, rho=rho, T=T)
116+
117+
# Compute error with respect to value in ITU example file
118+
ITU_example_val = 0.0054395627852315 # (dB/km)
119+
error = ITU_example_val - itur_val.value
120+
error_rel = error / ITU_example_val * 100 # (%)
121+
122+
123+
.. raw:: html
124+
:file: itur676_13_gamma_table.html
125+
126+
127+
Function gaseous_attenuation_slant_path
128+
---------------------------------------
129+
130+
The table below contains the results of testing function ``gaseous_attenuation_slant_path``.
131+
The test cases were extracted from spreadsheet ``ITURP676-13_A_gas.csv`` from the
132+
`ITU Validation examples file (rev 5.1) <https://www.itu.int/en/ITU-R/study-groups/rsg3/ionotropospheric/CG-3M3J-13-ValEx-Rev5_1.xlsx>`_.
133+
In addition to the input-arguments, expected result (``ITU Validation``), and
134+
ITU-Rpy computed result (``ITUR-py Result``), the absolute and relative errors
135+
are shown. Each test case is color-coded depending on the magnitude of the
136+
errors (green = pass, errors are negligible, red = fail, relative error is
137+
above 0.01%).
138+
139+
In addition, the code snippet below shows an example of how to generate the
140+
first row of the results in the table:
141+
142+
.. code-block:: python
143+
144+
import itur
145+
146+
# Define input attributes
147+
f = 38.5 # (GHz)
148+
el = 45.0 # (deg)
149+
rho = 13.998103358274586 # (g/m3)
150+
P = 988.3342860812425 # (hPA)
151+
T = 295.15 # (K)
152+
153+
# Make call to test-function gaseous_attenuation_slant_path
154+
itur_val = itur.models.itu676.gaseous_attenuation_slant_path(f=f, el=el, rho=rho, P=P, T=T)
155+
156+
# Compute error with respect to value in ITU example file
157+
ITU_example_val = 0.6724061393008622 # (dB)
158+
error = ITU_example_val - itur_val.value
159+
error_rel = error / ITU_example_val * 100 # (%)
160+
161+
162+
.. raw:: html
163+
:file: itur676_13_attenuation_gas_table.html
164+
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
2+
<html>
3+
<head>
4+
<title>Validation results models.itu676.gaseous_attenuation_slant_path</title>
5+
<style>
6+
table {
7+
border-collapse: collapse;
8+
font-size: 10px;
9+
width: 100%;
10+
padding: 2px;
11+
}
12+
13+
th {
14+
background-color: black;
15+
color: white;
16+
}
17+
18+
th, td {
19+
text-align: center;
20+
padding: 2px;
21+
width: 1%;
22+
font-family: Arial, Helvetica, sans-serif;
23+
white-space: nowrap;
24+
}
25+
26+
tr:nth-child(even) {background-color: #f2f2f2;}
27+
tr:hover {background-color: khaki;}
28+
29+
</style>
30+
</head>
31+
<body>
32+
<table border="1" class="dataframe" id="itur676_13_attenuation_gas">
33+
<thead>
34+
<tr style="text-align: center;">
35+
<th>ITU-Rpy Function</th>
36+
<th>f (GHz)</th>
37+
<th>el (deg)</th>
38+
<th>rho (g/m3)</th>
39+
<th>P (hPA)</th>
40+
<th>T (K)</th>
41+
<th>ITU Validation (dB)</th>
42+
<th>ITU-Rpy Result (dB)</th>
43+
<th>Absolute Error</th>
44+
<th>Relative Error</th>
45+
</tr>
46+
</thead>
47+
<tbody>
48+
<tr>
49+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
50+
<td>38.5</td>
51+
<td>45.0</td>
52+
<td>13.998103</td>
53+
<td>988.334286</td>
54+
<td>295.15</td>
55+
<td>0.672406</td>
56+
<td><span style="color: darkgreen">0.672406</span></td>
57+
<td bgcolor="lightgreen">1.11e-16</td>
58+
<td bgcolor="lightgreen">0.000</td>
59+
</tr>
60+
<tr>
61+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
62+
<td>38.5</td>
63+
<td>45.0</td>
64+
<td>14.042291</td>
65+
<td>988.819462</td>
66+
<td>294.45</td>
67+
<td>0.678324</td>
68+
<td><span style="color: darkgreen">0.678324</span></td>
69+
<td bgcolor="lightgreen">6.82e-11</td>
70+
<td bgcolor="lightgreen">0.000</td>
71+
</tr>
72+
<tr>
73+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
74+
<td>38.5</td>
75+
<td>45.0</td>
76+
<td>14.205905</td>
77+
<td>989.484034</td>
78+
<td>294.65</td>
79+
<td>0.683383</td>
80+
<td><span style="color: darkgreen">0.683383</span></td>
81+
<td bgcolor="lightgreen">-3.02e-11</td>
82+
<td bgcolor="lightgreen">-0.000</td>
83+
</tr>
84+
<tr>
85+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
86+
<td>38.5</td>
87+
<td>45.0</td>
88+
<td>14.295216</td>
89+
<td>989.497677</td>
90+
<td>297.15</td>
91+
<td>0.672125</td>
92+
<td><span style="color: darkgreen">0.672125</span></td>
93+
<td bgcolor="lightgreen">5.51e-11</td>
94+
<td bgcolor="lightgreen">0.000</td>
95+
</tr>
96+
<tr>
97+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
98+
<td>38.5</td>
99+
<td>45.0</td>
100+
<td>13.172371</td>
101+
<td>990.712469</td>
102+
<td>300.85</td>
103+
<td>0.617153</td>
104+
<td><span style="color: darkgreen">0.617153</span></td>
105+
<td bgcolor="lightgreen">7.64e-12</td>
106+
<td bgcolor="lightgreen">0.000</td>
107+
</tr>
108+
<tr>
109+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
110+
<td>38.5</td>
111+
<td>45.0</td>
112+
<td>12.932953</td>
113+
<td>990.601624</td>
114+
<td>303.25</td>
115+
<td>0.598111</td>
116+
<td><span style="color: darkgreen">0.598111</span></td>
117+
<td bgcolor="lightgreen">9.54e-12</td>
118+
<td bgcolor="lightgreen">0.000</td>
119+
</tr>
120+
<tr>
121+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
122+
<td>38.5</td>
123+
<td>45.0</td>
124+
<td>13.503194</td>
125+
<td>989.353779</td>
126+
<td>304.05</td>
127+
<td>0.610497</td>
128+
<td><span style="color: darkgreen">0.610497</span></td>
129+
<td bgcolor="lightgreen">-5.02e-11</td>
130+
<td bgcolor="lightgreen">-0.000</td>
131+
</tr>
132+
<tr>
133+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
134+
<td>38.5</td>
135+
<td>45.0</td>
136+
<td>14.832851</td>
137+
<td>987.983976</td>
138+
<td>302.65</td>
139+
<td>0.657929</td>
140+
<td><span style="color: darkgreen">0.657929</span></td>
141+
<td bgcolor="lightgreen">8.56e-11</td>
142+
<td bgcolor="lightgreen">0.000</td>
143+
</tr>
144+
<tr>
145+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
146+
<td>38.5</td>
147+
<td>45.0</td>
148+
<td>14.534491</td>
149+
<td>989.387869</td>
150+
<td>301.35</td>
151+
<td>0.656609</td>
152+
<td><span style="color: darkgreen">0.656609</span></td>
153+
<td bgcolor="lightgreen">-3.67e-11</td>
154+
<td bgcolor="lightgreen">-0.000</td>
155+
</tr>
156+
<tr>
157+
<td style="text-align:left">models.itu676.gaseous_attenuation_slant_path</td>
158+
<td>39.5</td>
159+
<td>45.0</td>
160+
<td>15.942512</td>
161+
<td>988.902037</td>
162+
<td>297.65</td>
163+
<td>0.770771</td>
164+
<td><span style="color: darkgreen">0.770771</span></td>
165+
<td bgcolor="lightgreen">-2.78e-11</td>
166+
<td bgcolor="lightgreen">-0.000</td>
167+
</tr>
168+
</tbody>
169+
</table>
170+
<br><br>
171+
</body>
172+
</html>
173+

0 commit comments

Comments
 (0)