gnsswire-ionex 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.
- gnsswire_ionex-0.1.0/.gitignore +13 -0
- gnsswire_ionex-0.1.0/LICENSE +21 -0
- gnsswire_ionex-0.1.0/PKG-INFO +206 -0
- gnsswire_ionex-0.1.0/README.md +180 -0
- gnsswire_ionex-0.1.0/pyproject.toml +38 -0
- gnsswire_ionex-0.1.0/src/gnsswire/ionex/__init__.py +69 -0
- gnsswire_ionex-0.1.0/src/gnsswire/ionex/_file.py +634 -0
- gnsswire_ionex-0.1.0/src/gnsswire/ionex/_records.py +397 -0
- gnsswire_ionex-0.1.0/src/gnsswire/ionex/py.typed +0 -0
- gnsswire_ionex-0.1.0/tests/THIRD_PARTY_NOTICES.md +58 -0
- gnsswire_ionex-0.1.0/tests/data/IGS0OPSFIN_20262800000_01D_02H_GIM.INX.gz +0 -0
- gnsswire_ionex-0.1.0/tests/test_ionex.py +579 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Trace Navigation LLC
|
|
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.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: gnsswire-ionex
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: IONEX 1.0 ionosphere map files (TEC, RMS and height maps, differential code biases), read and written losslessly as fixed-column text fields.
|
|
5
|
+
Project-URL: Homepage, https://github.com/tracenav/gnsswire
|
|
6
|
+
Project-URL: Source, https://github.com/tracenav/gnsswire/tree/main/packages/ionex
|
|
7
|
+
Project-URL: Changelog, https://github.com/tracenav/gnsswire/blob/main/RELEASES.md
|
|
8
|
+
Project-URL: Issues, https://github.com/tracenav/gnsswire/issues
|
|
9
|
+
Author: Trace Navigation
|
|
10
|
+
Maintainer-email: Jacob Armstrong <hi@jacobarm.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# gnsswire-ionex
|
|
28
|
+
|
|
29
|
+
IONEX ionosphere map files for Python
|
|
30
|
+
|
|
31
|
+
[](https://github.com/tracenav/gnsswire/actions/workflows/test.yml)
|
|
32
|
+
[](https://pypi.org/project/gnsswire-ionex/)
|
|
33
|
+
|
|
34
|
+
gnsswire-ionex reads and writes IONEX 1.0 files, the text format in which
|
|
35
|
+
global and regional maps of the ionosphere's total electron content are
|
|
36
|
+
exchanged (the IGS final maps `IGS0OPSFIN_..._GIM.INX`, for example). It
|
|
37
|
+
gives you:
|
|
38
|
+
|
|
39
|
+
- the header records, the TEC, RMS and HEIGHT maps with their data
|
|
40
|
+
blocks, and the auxiliary data blocks (differential code biases) record
|
|
41
|
+
by record;
|
|
42
|
+
- a lossless round trip: `write(read(text)) == text` for every file `read`
|
|
43
|
+
accepts;
|
|
44
|
+
- every field as the text in its columns, and numbers as exact integers on
|
|
45
|
+
request, without floating point;
|
|
46
|
+
- each data block as integers with its map's epoch, its grid and the
|
|
47
|
+
exponent in effect (`layers`).
|
|
48
|
+
|
|
49
|
+
It is part of [gnsswire](https://pypi.org/project/gnsswire/), codecs for
|
|
50
|
+
GNSS wire formats.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
$ pip install gnsswire-ionex
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
gnsswire-ionex requires Python 3.11+ and has no dependencies. `pip install
|
|
59
|
+
gnsswire` installs it with every other format.
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
### Read a file
|
|
64
|
+
|
|
65
|
+
`read(text)` gives an `IonexFile`: the header, then the maps. The text is
|
|
66
|
+
the file's, decoded (IONEX files are ASCII); a `.gz` file is opened with
|
|
67
|
+
`gzip.open(path, "rt", encoding="ascii", newline="")`:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from gnsswire import ionex
|
|
71
|
+
|
|
72
|
+
text = (
|
|
73
|
+
" 1.0 IONOSPHERE MAPS GPS IONEX VERSION / TYPE\n"
|
|
74
|
+
"example example 22-nov-26 12:00 PGM / RUN BY / DATE \n"
|
|
75
|
+
" 2026 10 7 0 0 0 EPOCH OF FIRST MAP \n"
|
|
76
|
+
" 2026 10 7 0 0 0 EPOCH OF LAST MAP \n"
|
|
77
|
+
" 7200 INTERVAL \n"
|
|
78
|
+
" 1 # OF MAPS IN FILE \n"
|
|
79
|
+
" COSZ MAPPING FUNCTION \n"
|
|
80
|
+
" 10.0 ELEVATION CUTOFF \n"
|
|
81
|
+
" OBSERVABLES USED \n"
|
|
82
|
+
" 6371.0 BASE RADIUS \n"
|
|
83
|
+
" 2 MAP DIMENSION \n"
|
|
84
|
+
" 450.0 450.0 0.0 HGT1 / HGT2 / DHGT \n"
|
|
85
|
+
" 50.0 45.0 -5.0 LAT1 / LAT2 / DLAT \n"
|
|
86
|
+
" 0.0 10.0 5.0 LON1 / LON2 / DLON \n"
|
|
87
|
+
" -1 EXPONENT \n"
|
|
88
|
+
" END OF HEADER \n"
|
|
89
|
+
" 1 START OF TEC MAP \n"
|
|
90
|
+
" 2026 10 7 0 0 0 EPOCH OF CURRENT MAP\n"
|
|
91
|
+
" 50.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
92
|
+
" 123 131 140\n"
|
|
93
|
+
" 45.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
94
|
+
" 150 157 9999\n"
|
|
95
|
+
" 1 END OF TEC MAP \n"
|
|
96
|
+
" 1 START OF RMS MAP \n"
|
|
97
|
+
" 50.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
98
|
+
" 20 21 22\n"
|
|
99
|
+
" 45.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
100
|
+
" 23 24 9999\n"
|
|
101
|
+
" 1 END OF RMS MAP \n"
|
|
102
|
+
" END OF FILE \n"
|
|
103
|
+
)
|
|
104
|
+
file = ionex.read(text)
|
|
105
|
+
print(file.version, file.system) # 1.0 GPS
|
|
106
|
+
print([(m.kind, m.number) for m in file.maps]) # [('TEC', 1), ('RMS', 1)]
|
|
107
|
+
print(file.maps[0].epoch.hour) # 0
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### The values of a map
|
|
111
|
+
|
|
112
|
+
A map is a block of values per latitude (and height): the
|
|
113
|
+
LAT/LON1/LON2/DLON/H record, then (LON2-LON1)/DLON+1 values, 16 to a
|
|
114
|
+
line. `layers(file)` gives each block with what is needed to place it:
|
|
115
|
+
the kind and number of its map, the map's epoch (an RMS or HEIGHT map
|
|
116
|
+
without one takes that of the TEC map of its number), the latitude,
|
|
117
|
+
longitudes and height in units of 0.1 degree and 0.1 km, the EXPONENT in
|
|
118
|
+
effect, and the values as integers:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
for layer in ionex.layers(file):
|
|
122
|
+
print(layer.kind, layer.epoch, layer.lat, layer.lon1, layer.lon2, layer.dlon,
|
|
123
|
+
layer.exponent, layer.values)
|
|
124
|
+
# TEC (2026, 10, 7, 0, 0, 0) 500 0 100 50 -1 (123, 131, 140)
|
|
125
|
+
# TEC (2026, 10, 7, 0, 0, 0) 450 0 100 50 -1 (150, 157, 9999)
|
|
126
|
+
# RMS (2026, 10, 7, 0, 0, 0) 500 0 100 50 -1 (20, 21, 22)
|
|
127
|
+
# RMS (2026, 10, 7, 0, 0, 0) 450 0 100 50 -1 (23, 24, 9999)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
A value is in units of 10**exponent TECU (EXPONENT -1: 123 is 12.3 TECU);
|
|
131
|
+
9999 means "no value available" and is given as it is. Nothing is
|
|
132
|
+
interpolated or scaled here.
|
|
133
|
+
|
|
134
|
+
### Exact numbers
|
|
135
|
+
|
|
136
|
+
Every field is the text in the record's columns, blanks included, so
|
|
137
|
+
nothing is lost. `fields(record)` gives a record's content as the
|
|
138
|
+
dataclass of its columns, and `number(field, decimals)` a numeric field as
|
|
139
|
+
the integer of its digits:
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
grid = ionex.fields(file.record("LAT1 / LAT2 / DLAT"))
|
|
143
|
+
print(grid.first, grid.last, grid.step) # 50.0 45.0 -5.0
|
|
144
|
+
print(ionex.number(grid.step, 1)) # -50, in 0.1 degree
|
|
145
|
+
block = file.maps[0].blocks[0]
|
|
146
|
+
print(block.fields.lat, block.values) # 50.0 (' 123', ' 131', ' 140')
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Differential code biases are in `file.aux`: each auxiliary data block
|
|
150
|
+
with its records, `PRN / BIAS / RMS` read by `fields` as `SatelliteBias`.
|
|
151
|
+
|
|
152
|
+
### Write it back
|
|
153
|
+
|
|
154
|
+
`write(file)` gives the text back, exactly as read:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
print(ionex.write(file) == text) # True
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Every labelled line is a `Record` (its 60 columns of content and its
|
|
161
|
+
label); `record(label, fields)` builds one from the dataclass of its
|
|
162
|
+
columns, for a file made or changed in Python. `write` reads its own
|
|
163
|
+
output back and refuses what would not read the same.
|
|
164
|
+
|
|
165
|
+
A file of another format version raises `Unsupported`; text that does not
|
|
166
|
+
follow the format (a missing header record, a block with the wrong count
|
|
167
|
+
of values, a map not closed) raises `Invalid`. Both derive from
|
|
168
|
+
`ionex.Error`, a `ValueError`.
|
|
169
|
+
|
|
170
|
+
## Records
|
|
171
|
+
|
|
172
|
+
Every record of Appendix A, Table 1 and Appendix B, Table 1 of "IONEX: The
|
|
173
|
+
IONosphere Map EXchange Format Version 1" (Schaer, Gurtner and Feltens,
|
|
174
|
+
1998) is in `TABLE`, label to class:
|
|
175
|
+
|
|
176
|
+
| Records | Class |
|
|
177
|
+
|---|---|
|
|
178
|
+
| IONEX VERSION / TYPE | `Version` |
|
|
179
|
+
| PGM / RUN BY / DATE | `Program` |
|
|
180
|
+
| DESCRIPTION, COMMENT, OBSERVABLES USED, START OF AUX DATA, END OF AUX DATA | `Text` |
|
|
181
|
+
| EPOCH OF FIRST MAP, EPOCH OF LAST MAP, EPOCH OF CURRENT MAP | `Epoch` |
|
|
182
|
+
| INTERVAL, # OF MAPS IN FILE, # OF STATIONS, # OF SATELLITES, MAP DIMENSION, EXPONENT, START OF and END OF a TEC, RMS or HEIGHT MAP | `Count` |
|
|
183
|
+
| MAPPING FUNCTION | `MappingFunction` |
|
|
184
|
+
| ELEVATION CUTOFF, BASE RADIUS | `Real` |
|
|
185
|
+
| HGT1 / HGT2 / DHGT, LAT1 / LAT2 / DLAT, LON1 / LON2 / DLON | `Grid` |
|
|
186
|
+
| END OF HEADER, END OF FILE | `Blank` |
|
|
187
|
+
| LAT/LON1/LON2/DLON/H | `Band` |
|
|
188
|
+
| PRN / BIAS / RMS | `SatelliteBias` |
|
|
189
|
+
|
|
190
|
+
## Documentation
|
|
191
|
+
|
|
192
|
+
What gnsswire-ionex checks and does not check, what its tests rest on and
|
|
193
|
+
the readings it takes where its specification is ambiguous are under
|
|
194
|
+
[Limitations](https://github.com/tracenav/gnsswire#gnsswire-ionex) in the
|
|
195
|
+
[repository README](https://github.com/tracenav/gnsswire#readme), with the
|
|
196
|
+
interface every gnsswire format shares and the version policy. Release
|
|
197
|
+
notes are in [RELEASES.md](https://github.com/tracenav/gnsswire/blob/main/RELEASES.md).
|
|
198
|
+
|
|
199
|
+
## Contribute
|
|
200
|
+
|
|
201
|
+
Report bugs and request formats in the
|
|
202
|
+
[issue tracker](https://github.com/tracenav/gnsswire/issues).
|
|
203
|
+
|
|
204
|
+
## Licence
|
|
205
|
+
|
|
206
|
+
MIT.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# gnsswire-ionex
|
|
2
|
+
|
|
3
|
+
IONEX ionosphere map files for Python
|
|
4
|
+
|
|
5
|
+
[](https://github.com/tracenav/gnsswire/actions/workflows/test.yml)
|
|
6
|
+
[](https://pypi.org/project/gnsswire-ionex/)
|
|
7
|
+
|
|
8
|
+
gnsswire-ionex reads and writes IONEX 1.0 files, the text format in which
|
|
9
|
+
global and regional maps of the ionosphere's total electron content are
|
|
10
|
+
exchanged (the IGS final maps `IGS0OPSFIN_..._GIM.INX`, for example). It
|
|
11
|
+
gives you:
|
|
12
|
+
|
|
13
|
+
- the header records, the TEC, RMS and HEIGHT maps with their data
|
|
14
|
+
blocks, and the auxiliary data blocks (differential code biases) record
|
|
15
|
+
by record;
|
|
16
|
+
- a lossless round trip: `write(read(text)) == text` for every file `read`
|
|
17
|
+
accepts;
|
|
18
|
+
- every field as the text in its columns, and numbers as exact integers on
|
|
19
|
+
request, without floating point;
|
|
20
|
+
- each data block as integers with its map's epoch, its grid and the
|
|
21
|
+
exponent in effect (`layers`).
|
|
22
|
+
|
|
23
|
+
It is part of [gnsswire](https://pypi.org/project/gnsswire/), codecs for
|
|
24
|
+
GNSS wire formats.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
$ pip install gnsswire-ionex
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
gnsswire-ionex requires Python 3.11+ and has no dependencies. `pip install
|
|
33
|
+
gnsswire` installs it with every other format.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Read a file
|
|
38
|
+
|
|
39
|
+
`read(text)` gives an `IonexFile`: the header, then the maps. The text is
|
|
40
|
+
the file's, decoded (IONEX files are ASCII); a `.gz` file is opened with
|
|
41
|
+
`gzip.open(path, "rt", encoding="ascii", newline="")`:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from gnsswire import ionex
|
|
45
|
+
|
|
46
|
+
text = (
|
|
47
|
+
" 1.0 IONOSPHERE MAPS GPS IONEX VERSION / TYPE\n"
|
|
48
|
+
"example example 22-nov-26 12:00 PGM / RUN BY / DATE \n"
|
|
49
|
+
" 2026 10 7 0 0 0 EPOCH OF FIRST MAP \n"
|
|
50
|
+
" 2026 10 7 0 0 0 EPOCH OF LAST MAP \n"
|
|
51
|
+
" 7200 INTERVAL \n"
|
|
52
|
+
" 1 # OF MAPS IN FILE \n"
|
|
53
|
+
" COSZ MAPPING FUNCTION \n"
|
|
54
|
+
" 10.0 ELEVATION CUTOFF \n"
|
|
55
|
+
" OBSERVABLES USED \n"
|
|
56
|
+
" 6371.0 BASE RADIUS \n"
|
|
57
|
+
" 2 MAP DIMENSION \n"
|
|
58
|
+
" 450.0 450.0 0.0 HGT1 / HGT2 / DHGT \n"
|
|
59
|
+
" 50.0 45.0 -5.0 LAT1 / LAT2 / DLAT \n"
|
|
60
|
+
" 0.0 10.0 5.0 LON1 / LON2 / DLON \n"
|
|
61
|
+
" -1 EXPONENT \n"
|
|
62
|
+
" END OF HEADER \n"
|
|
63
|
+
" 1 START OF TEC MAP \n"
|
|
64
|
+
" 2026 10 7 0 0 0 EPOCH OF CURRENT MAP\n"
|
|
65
|
+
" 50.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
66
|
+
" 123 131 140\n"
|
|
67
|
+
" 45.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
68
|
+
" 150 157 9999\n"
|
|
69
|
+
" 1 END OF TEC MAP \n"
|
|
70
|
+
" 1 START OF RMS MAP \n"
|
|
71
|
+
" 50.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
72
|
+
" 20 21 22\n"
|
|
73
|
+
" 45.0 0.0 10.0 5.0 450.0 LAT/LON1/LON2/DLON/H\n"
|
|
74
|
+
" 23 24 9999\n"
|
|
75
|
+
" 1 END OF RMS MAP \n"
|
|
76
|
+
" END OF FILE \n"
|
|
77
|
+
)
|
|
78
|
+
file = ionex.read(text)
|
|
79
|
+
print(file.version, file.system) # 1.0 GPS
|
|
80
|
+
print([(m.kind, m.number) for m in file.maps]) # [('TEC', 1), ('RMS', 1)]
|
|
81
|
+
print(file.maps[0].epoch.hour) # 0
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### The values of a map
|
|
85
|
+
|
|
86
|
+
A map is a block of values per latitude (and height): the
|
|
87
|
+
LAT/LON1/LON2/DLON/H record, then (LON2-LON1)/DLON+1 values, 16 to a
|
|
88
|
+
line. `layers(file)` gives each block with what is needed to place it:
|
|
89
|
+
the kind and number of its map, the map's epoch (an RMS or HEIGHT map
|
|
90
|
+
without one takes that of the TEC map of its number), the latitude,
|
|
91
|
+
longitudes and height in units of 0.1 degree and 0.1 km, the EXPONENT in
|
|
92
|
+
effect, and the values as integers:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
for layer in ionex.layers(file):
|
|
96
|
+
print(layer.kind, layer.epoch, layer.lat, layer.lon1, layer.lon2, layer.dlon,
|
|
97
|
+
layer.exponent, layer.values)
|
|
98
|
+
# TEC (2026, 10, 7, 0, 0, 0) 500 0 100 50 -1 (123, 131, 140)
|
|
99
|
+
# TEC (2026, 10, 7, 0, 0, 0) 450 0 100 50 -1 (150, 157, 9999)
|
|
100
|
+
# RMS (2026, 10, 7, 0, 0, 0) 500 0 100 50 -1 (20, 21, 22)
|
|
101
|
+
# RMS (2026, 10, 7, 0, 0, 0) 450 0 100 50 -1 (23, 24, 9999)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
A value is in units of 10**exponent TECU (EXPONENT -1: 123 is 12.3 TECU);
|
|
105
|
+
9999 means "no value available" and is given as it is. Nothing is
|
|
106
|
+
interpolated or scaled here.
|
|
107
|
+
|
|
108
|
+
### Exact numbers
|
|
109
|
+
|
|
110
|
+
Every field is the text in the record's columns, blanks included, so
|
|
111
|
+
nothing is lost. `fields(record)` gives a record's content as the
|
|
112
|
+
dataclass of its columns, and `number(field, decimals)` a numeric field as
|
|
113
|
+
the integer of its digits:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
grid = ionex.fields(file.record("LAT1 / LAT2 / DLAT"))
|
|
117
|
+
print(grid.first, grid.last, grid.step) # 50.0 45.0 -5.0
|
|
118
|
+
print(ionex.number(grid.step, 1)) # -50, in 0.1 degree
|
|
119
|
+
block = file.maps[0].blocks[0]
|
|
120
|
+
print(block.fields.lat, block.values) # 50.0 (' 123', ' 131', ' 140')
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Differential code biases are in `file.aux`: each auxiliary data block
|
|
124
|
+
with its records, `PRN / BIAS / RMS` read by `fields` as `SatelliteBias`.
|
|
125
|
+
|
|
126
|
+
### Write it back
|
|
127
|
+
|
|
128
|
+
`write(file)` gives the text back, exactly as read:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
print(ionex.write(file) == text) # True
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Every labelled line is a `Record` (its 60 columns of content and its
|
|
135
|
+
label); `record(label, fields)` builds one from the dataclass of its
|
|
136
|
+
columns, for a file made or changed in Python. `write` reads its own
|
|
137
|
+
output back and refuses what would not read the same.
|
|
138
|
+
|
|
139
|
+
A file of another format version raises `Unsupported`; text that does not
|
|
140
|
+
follow the format (a missing header record, a block with the wrong count
|
|
141
|
+
of values, a map not closed) raises `Invalid`. Both derive from
|
|
142
|
+
`ionex.Error`, a `ValueError`.
|
|
143
|
+
|
|
144
|
+
## Records
|
|
145
|
+
|
|
146
|
+
Every record of Appendix A, Table 1 and Appendix B, Table 1 of "IONEX: The
|
|
147
|
+
IONosphere Map EXchange Format Version 1" (Schaer, Gurtner and Feltens,
|
|
148
|
+
1998) is in `TABLE`, label to class:
|
|
149
|
+
|
|
150
|
+
| Records | Class |
|
|
151
|
+
|---|---|
|
|
152
|
+
| IONEX VERSION / TYPE | `Version` |
|
|
153
|
+
| PGM / RUN BY / DATE | `Program` |
|
|
154
|
+
| DESCRIPTION, COMMENT, OBSERVABLES USED, START OF AUX DATA, END OF AUX DATA | `Text` |
|
|
155
|
+
| EPOCH OF FIRST MAP, EPOCH OF LAST MAP, EPOCH OF CURRENT MAP | `Epoch` |
|
|
156
|
+
| INTERVAL, # OF MAPS IN FILE, # OF STATIONS, # OF SATELLITES, MAP DIMENSION, EXPONENT, START OF and END OF a TEC, RMS or HEIGHT MAP | `Count` |
|
|
157
|
+
| MAPPING FUNCTION | `MappingFunction` |
|
|
158
|
+
| ELEVATION CUTOFF, BASE RADIUS | `Real` |
|
|
159
|
+
| HGT1 / HGT2 / DHGT, LAT1 / LAT2 / DLAT, LON1 / LON2 / DLON | `Grid` |
|
|
160
|
+
| END OF HEADER, END OF FILE | `Blank` |
|
|
161
|
+
| LAT/LON1/LON2/DLON/H | `Band` |
|
|
162
|
+
| PRN / BIAS / RMS | `SatelliteBias` |
|
|
163
|
+
|
|
164
|
+
## Documentation
|
|
165
|
+
|
|
166
|
+
What gnsswire-ionex checks and does not check, what its tests rest on and
|
|
167
|
+
the readings it takes where its specification is ambiguous are under
|
|
168
|
+
[Limitations](https://github.com/tracenav/gnsswire#gnsswire-ionex) in the
|
|
169
|
+
[repository README](https://github.com/tracenav/gnsswire#readme), with the
|
|
170
|
+
interface every gnsswire format shares and the version policy. Release
|
|
171
|
+
notes are in [RELEASES.md](https://github.com/tracenav/gnsswire/blob/main/RELEASES.md).
|
|
172
|
+
|
|
173
|
+
## Contribute
|
|
174
|
+
|
|
175
|
+
Report bugs and request formats in the
|
|
176
|
+
[issue tracker](https://github.com/tracenav/gnsswire/issues).
|
|
177
|
+
|
|
178
|
+
## Licence
|
|
179
|
+
|
|
180
|
+
MIT.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"] # 1.27: PEP 639 licence metadata
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "gnsswire-ionex"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "IONEX 1.0 ionosphere map files (TEC, RMS and height maps, differential code biases), read and written losslessly as fixed-column text fields."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
authors = [{ name = "Trace Navigation" }]
|
|
14
|
+
maintainers = [{ name = "Jacob Armstrong", email = "hi@jacobarm.com" }]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Topic :: Scientific/Engineering :: GIS",
|
|
27
|
+
]
|
|
28
|
+
dependencies = []
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/tracenav/gnsswire"
|
|
32
|
+
Source = "https://github.com/tracenav/gnsswire/tree/main/packages/ionex"
|
|
33
|
+
Changelog = "https://github.com/tracenav/gnsswire/blob/main/RELEASES.md"
|
|
34
|
+
Issues = "https://github.com/tracenav/gnsswire/issues"
|
|
35
|
+
|
|
36
|
+
# gnsswire is a namespace shared by several distributions: no __init__.py at that level.
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["src/gnsswire"]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""IONEX 1.0 ionosphere map files: text to records of text fields and back.
|
|
2
|
+
|
|
3
|
+
An IONEX file holds global or regional maps of the vertical total electron
|
|
4
|
+
content (TEC), with optional RMS and single-layer height maps, on a grid of
|
|
5
|
+
latitude, longitude and height, one map per epoch; its header may carry
|
|
6
|
+
auxiliary data such as differential code biases. It is read whole with
|
|
7
|
+
:func:`read` and written with :func:`write`, and ``write(read(text)) ==
|
|
8
|
+
text`` for every file this module accepts. Every labelled line is a
|
|
9
|
+
:class:`Record` (content and label), every data block a :class:`Block` (its
|
|
10
|
+
LAT/LON1/LON2/DLON/H record and its values), as the text of their columns;
|
|
11
|
+
:func:`fields` gives a record's content as the frozen dataclass of its
|
|
12
|
+
columns, and :func:`number` a numeric field as the integer of its digits.
|
|
13
|
+
:func:`layers` gives every block as integers, with its map's epoch and the
|
|
14
|
+
exponent in effect. Nothing is scaled: values are in units of 10**exponent
|
|
15
|
+
TECU (or km), latitudes and longitudes in 0.1 degree.
|
|
16
|
+
|
|
17
|
+
Source: "IONEX: The IONosphere Map EXchange Format Version 1" (S. Schaer,
|
|
18
|
+
W. Gurtner, J. Feltens, 25 February 1998), Appendices A and B; the readings
|
|
19
|
+
taken are in ``_file`` and ``_records``.
|
|
20
|
+
|
|
21
|
+
Errors: every exception this codec raises for a file it cannot read or
|
|
22
|
+
records it cannot write is an :class:`Error` (a ``ValueError``):
|
|
23
|
+
:class:`Invalid`, :class:`Unsupported` (another format version, or a
|
|
24
|
+
record without a table), and the error :func:`number` raises for a field
|
|
25
|
+
that is not a number of its format.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from ._file import (
|
|
29
|
+
MAP_KINDS,
|
|
30
|
+
Aux,
|
|
31
|
+
Block,
|
|
32
|
+
IonexFile,
|
|
33
|
+
Layer,
|
|
34
|
+
Map,
|
|
35
|
+
layers,
|
|
36
|
+
longitudes,
|
|
37
|
+
read,
|
|
38
|
+
write,
|
|
39
|
+
)
|
|
40
|
+
from ._records import (
|
|
41
|
+
TABLE,
|
|
42
|
+
Band,
|
|
43
|
+
Blank,
|
|
44
|
+
Col,
|
|
45
|
+
Count,
|
|
46
|
+
Epoch,
|
|
47
|
+
Error,
|
|
48
|
+
Grid,
|
|
49
|
+
Invalid,
|
|
50
|
+
MappingFunction,
|
|
51
|
+
Program,
|
|
52
|
+
Real,
|
|
53
|
+
Record,
|
|
54
|
+
SatelliteBias,
|
|
55
|
+
Text,
|
|
56
|
+
Unsupported,
|
|
57
|
+
Version,
|
|
58
|
+
columns,
|
|
59
|
+
fields,
|
|
60
|
+
label,
|
|
61
|
+
number,
|
|
62
|
+
record,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
__all__ = ["MAP_KINDS", "TABLE", "Aux", "Band", "Blank", "Block", "Col", "Count", "Epoch",
|
|
66
|
+
"Error", "Grid", "Invalid", "IonexFile", "Layer", "Map", "MappingFunction",
|
|
67
|
+
"Program", "Real", "Record", "SatelliteBias", "Text", "Unsupported", "Version",
|
|
68
|
+
"columns", "fields", "label", "layers", "longitudes", "number", "read", "record",
|
|
69
|
+
"write"]
|