gnsswire-tro 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.
@@ -0,0 +1,13 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ build/
6
+ dist/
7
+ *.egg-info/
8
+ # Specs are staged locally for reading; several are copyrighted and none are committed.
9
+ refs/*
10
+ !refs/README.md
11
+ .claude/settings.local.json
12
+ /AGENTS.md
13
+ /STATUS.md
@@ -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,168 @@
1
+ Metadata-Version: 2.5
2
+ Name: gnsswire-tro
3
+ Version: 0.1.0
4
+ Summary: SINEX_TRO troposphere files (versions 0.01 and 2.00): zenith delays, gradients and their description, read and written losslessly as text fields.
5
+ Project-URL: Homepage, https://github.com/tracenav/gnsswire
6
+ Project-URL: Source, https://github.com/tracenav/gnsswire/tree/main/packages/tro
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-tro
28
+
29
+ SINEX_TRO troposphere files for Python
30
+
31
+ [![tests](https://github.com/tracenav/gnsswire/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/tracenav/gnsswire/actions/workflows/test.yml)
32
+ [![PyPI](https://img.shields.io/pypi/v/gnsswire-tro)](https://pypi.org/project/gnsswire-tro/)
33
+
34
+ gnsswire-tro reads and writes SINEX_TRO files, the text format in which
35
+ zenith tropospheric delays, their gradients and other tropospheric and
36
+ meteorological parameters are exchanged: version 2.00, and version 0.01,
37
+ in which the IGS writes its troposphere products
38
+ (`IGS0OPSFIN_..._TRO.TRO`). It gives you:
39
+
40
+ - the header line and every block, line by line;
41
+ - the solution (TROP/SOLUTION and SLANT/SOLUTION) as rows of marker, time
42
+ tag and values, named by TROP/DESCRIPTION, and the station coordinates;
43
+ - a lossless round trip: `write(read(text)) == text` for every file `read`
44
+ accepts;
45
+ - values as the text written, and as exact integers on request, without
46
+ floating point.
47
+
48
+ It is part of [gnsswire](https://pypi.org/project/gnsswire/), codecs for
49
+ GNSS wire formats.
50
+
51
+ ## Installation
52
+
53
+ ```sh
54
+ $ pip install gnsswire-tro
55
+ ```
56
+
57
+ gnsswire-tro requires Python 3.11+ and has no dependencies. `pip install
58
+ gnsswire` installs it with every other format.
59
+
60
+ ## Usage
61
+
62
+ ### Read a file
63
+
64
+ `read(text)` gives a `TroFile`: the header line, the blocks (`Block`: its
65
+ `+TITLE` line, its lines, its `-TITLE` line) and the comment and empty
66
+ lines between them, then the footer line. The text is the file's, decoded
67
+ (`encoding="latin-1"` reads any file); a `.gz` file is opened with
68
+ `gzip.open(path, "rt", encoding="latin-1", newline="")`:
69
+
70
+ ```python
71
+ from gnsswire import tro
72
+
73
+ text = (
74
+ "%=TRO 2.00 ABC 2026:281:03600 ABC 2026:280:00000 2026:280:86399 P MIX\n"
75
+ "+TROP/DESCRIPTION\n"
76
+ "*_________KEYWORD_____________ __VALUE(S)_______________________\n"
77
+ " TROPO SAMPLING INTERVAL 300\n"
78
+ " TROPO PARAMETER NAMES TROTOT STDDEV TGNTOT STDDEV TGETOT STDDEV\n"
79
+ " TROPO PARAMETER UNITS 1e+03 1e+03 1e+03 1e+03 1e+03 1e+03\n"
80
+ "-TROP/DESCRIPTION\n"
81
+ "+SITE/COORDINATES\n"
82
+ "*STATION__ PT SOLN T __DATA_START__ __DATA_END____ __STA_X_____ __STA_Y_____ __STA_Z_____ SYSTEM REMRK\n"
83
+ " ZIMM00CHE A 1 P 2026:280:00000 2026:280:86399 4331296.936 567556.035 4633134.023 IGS20 ABC\n"
84
+ "-SITE/COORDINATES\n"
85
+ "+TROP/SOLUTION\n"
86
+ "*STATION__ ____EPOCH_____ TROTOT STDDEV TGNTOT STDDEV TGETOT STDDEV\n"
87
+ " ZIMM00CHE 2026:280:00000 2187.1 1.2 0.31 0.10 -0.42 0.11\n"
88
+ " ZIMM00CHE 2026:280:00300 2187.4 1.2 0.30 0.10 -0.41 0.11\n"
89
+ "-TROP/SOLUTION\n"
90
+ "%=ENDTRO\n"
91
+ )
92
+ file = tro.read(text)
93
+ print(file.version, file.fields.agency, file.fields.contents) # 2.00 ABC MIX
94
+ print([b.title for b in file.blocks])
95
+ # ['TROP/DESCRIPTION', 'SITE/COORDINATES', 'TROP/SOLUTION']
96
+ print(file.description[0]) # ('TROPO SAMPLING INTERVAL', '300')
97
+ ```
98
+
99
+ ### The solution
100
+
101
+ TROP/SOLUTION lines are "space separated fields of variable length", their
102
+ number and order given in TROP/DESCRIPTION (TROPO PARAMETER NAMES in
103
+ 2.00, SOLUTION_FIELDS_1, _2, ... in 0.01). `file.solution` gives each
104
+ line as a `Row`, `file.parameters` the names and `file.units` their units
105
+ (2.00):
106
+
107
+ ```python
108
+ print(file.parameters) # ('TROTOT', 'STDDEV', 'TGNTOT', 'STDDEV', 'TGETOT', 'STDDEV')
109
+ for row in file.solution:
110
+ print(row.marker, row.epoch, row.values[0])
111
+ # ZIMM00CHE Epoch(year=2026, day=280, second=0) 2187.1
112
+ # ZIMM00CHE Epoch(year=2026, day=280, second=300) 2187.4
113
+ c = file.coordinates[0]
114
+ print(c.site, c.x, c.y, c.z, c.rest) # ZIMM00CHE 4331296.936 567556.035 4633134.023 ('IGS20', 'ABC')
115
+ ```
116
+
117
+ `file.slant`, `file.slant_parameters` and `file.slant_units` do the same
118
+ for SLANT/SOLUTION. A time tag's year is kept as written: two digits in
119
+ 0.01 files (`Epoch(year=26, ...)`).
120
+
121
+ ### Exact numbers
122
+
123
+ Values are kept as the text written. `digits(text)` gives a number as the
124
+ integer of its digits and its count of decimals, the value being
125
+ `integer * 10**-decimals`, without floating point:
126
+
127
+ ```python
128
+ print(tro.digits(file.solution[0].values[0])) # (21871, 1): 2187.1
129
+ print(tro.digits(file.units[0])) # (1, -3): 1e+03
130
+ ```
131
+
132
+ TROTOT 2187.1 in units of 1e+03 is 2.1871 m: "Values reported in
133
+ TROP/SOLUTION Block should be divided by the related TROPO UNITS to get
134
+ the base units".
135
+
136
+ ### Write it back
137
+
138
+ `write(file)` gives the text back, exactly as read:
139
+
140
+ ```python
141
+ print(tro.write(file) == text) # True
142
+ ```
143
+
144
+ `read` checks the structure: the header line's format version, blocks
145
+ begun and ended, the first character of every line, the footer line. The
146
+ fields are checked when they are asked for, so that a file whose
147
+ description or solution does not follow the document still reads and
148
+ writes back; the property raises `Invalid` then. A file of another format
149
+ version raises `Unsupported`. Both derive from `tro.Error`, a
150
+ `ValueError`.
151
+
152
+ ## Documentation
153
+
154
+ What gnsswire-tro checks and does not check, what its tests rest on and
155
+ the readings it takes where its specifications are ambiguous are under
156
+ [Limitations](https://github.com/tracenav/gnsswire#gnsswire-tro) in the
157
+ [repository README](https://github.com/tracenav/gnsswire#readme), with the
158
+ interface every gnsswire format shares and the version policy. Release
159
+ notes are in [RELEASES.md](https://github.com/tracenav/gnsswire/blob/main/RELEASES.md).
160
+
161
+ ## Contribute
162
+
163
+ Report bugs and request formats in the
164
+ [issue tracker](https://github.com/tracenav/gnsswire/issues).
165
+
166
+ ## Licence
167
+
168
+ MIT.
@@ -0,0 +1,142 @@
1
+ # gnsswire-tro
2
+
3
+ SINEX_TRO troposphere files for Python
4
+
5
+ [![tests](https://github.com/tracenav/gnsswire/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/tracenav/gnsswire/actions/workflows/test.yml)
6
+ [![PyPI](https://img.shields.io/pypi/v/gnsswire-tro)](https://pypi.org/project/gnsswire-tro/)
7
+
8
+ gnsswire-tro reads and writes SINEX_TRO files, the text format in which
9
+ zenith tropospheric delays, their gradients and other tropospheric and
10
+ meteorological parameters are exchanged: version 2.00, and version 0.01,
11
+ in which the IGS writes its troposphere products
12
+ (`IGS0OPSFIN_..._TRO.TRO`). It gives you:
13
+
14
+ - the header line and every block, line by line;
15
+ - the solution (TROP/SOLUTION and SLANT/SOLUTION) as rows of marker, time
16
+ tag and values, named by TROP/DESCRIPTION, and the station coordinates;
17
+ - a lossless round trip: `write(read(text)) == text` for every file `read`
18
+ accepts;
19
+ - values as the text written, and as exact integers on request, without
20
+ floating point.
21
+
22
+ It is part of [gnsswire](https://pypi.org/project/gnsswire/), codecs for
23
+ GNSS wire formats.
24
+
25
+ ## Installation
26
+
27
+ ```sh
28
+ $ pip install gnsswire-tro
29
+ ```
30
+
31
+ gnsswire-tro requires Python 3.11+ and has no dependencies. `pip install
32
+ gnsswire` installs it with every other format.
33
+
34
+ ## Usage
35
+
36
+ ### Read a file
37
+
38
+ `read(text)` gives a `TroFile`: the header line, the blocks (`Block`: its
39
+ `+TITLE` line, its lines, its `-TITLE` line) and the comment and empty
40
+ lines between them, then the footer line. The text is the file's, decoded
41
+ (`encoding="latin-1"` reads any file); a `.gz` file is opened with
42
+ `gzip.open(path, "rt", encoding="latin-1", newline="")`:
43
+
44
+ ```python
45
+ from gnsswire import tro
46
+
47
+ text = (
48
+ "%=TRO 2.00 ABC 2026:281:03600 ABC 2026:280:00000 2026:280:86399 P MIX\n"
49
+ "+TROP/DESCRIPTION\n"
50
+ "*_________KEYWORD_____________ __VALUE(S)_______________________\n"
51
+ " TROPO SAMPLING INTERVAL 300\n"
52
+ " TROPO PARAMETER NAMES TROTOT STDDEV TGNTOT STDDEV TGETOT STDDEV\n"
53
+ " TROPO PARAMETER UNITS 1e+03 1e+03 1e+03 1e+03 1e+03 1e+03\n"
54
+ "-TROP/DESCRIPTION\n"
55
+ "+SITE/COORDINATES\n"
56
+ "*STATION__ PT SOLN T __DATA_START__ __DATA_END____ __STA_X_____ __STA_Y_____ __STA_Z_____ SYSTEM REMRK\n"
57
+ " ZIMM00CHE A 1 P 2026:280:00000 2026:280:86399 4331296.936 567556.035 4633134.023 IGS20 ABC\n"
58
+ "-SITE/COORDINATES\n"
59
+ "+TROP/SOLUTION\n"
60
+ "*STATION__ ____EPOCH_____ TROTOT STDDEV TGNTOT STDDEV TGETOT STDDEV\n"
61
+ " ZIMM00CHE 2026:280:00000 2187.1 1.2 0.31 0.10 -0.42 0.11\n"
62
+ " ZIMM00CHE 2026:280:00300 2187.4 1.2 0.30 0.10 -0.41 0.11\n"
63
+ "-TROP/SOLUTION\n"
64
+ "%=ENDTRO\n"
65
+ )
66
+ file = tro.read(text)
67
+ print(file.version, file.fields.agency, file.fields.contents) # 2.00 ABC MIX
68
+ print([b.title for b in file.blocks])
69
+ # ['TROP/DESCRIPTION', 'SITE/COORDINATES', 'TROP/SOLUTION']
70
+ print(file.description[0]) # ('TROPO SAMPLING INTERVAL', '300')
71
+ ```
72
+
73
+ ### The solution
74
+
75
+ TROP/SOLUTION lines are "space separated fields of variable length", their
76
+ number and order given in TROP/DESCRIPTION (TROPO PARAMETER NAMES in
77
+ 2.00, SOLUTION_FIELDS_1, _2, ... in 0.01). `file.solution` gives each
78
+ line as a `Row`, `file.parameters` the names and `file.units` their units
79
+ (2.00):
80
+
81
+ ```python
82
+ print(file.parameters) # ('TROTOT', 'STDDEV', 'TGNTOT', 'STDDEV', 'TGETOT', 'STDDEV')
83
+ for row in file.solution:
84
+ print(row.marker, row.epoch, row.values[0])
85
+ # ZIMM00CHE Epoch(year=2026, day=280, second=0) 2187.1
86
+ # ZIMM00CHE Epoch(year=2026, day=280, second=300) 2187.4
87
+ c = file.coordinates[0]
88
+ print(c.site, c.x, c.y, c.z, c.rest) # ZIMM00CHE 4331296.936 567556.035 4633134.023 ('IGS20', 'ABC')
89
+ ```
90
+
91
+ `file.slant`, `file.slant_parameters` and `file.slant_units` do the same
92
+ for SLANT/SOLUTION. A time tag's year is kept as written: two digits in
93
+ 0.01 files (`Epoch(year=26, ...)`).
94
+
95
+ ### Exact numbers
96
+
97
+ Values are kept as the text written. `digits(text)` gives a number as the
98
+ integer of its digits and its count of decimals, the value being
99
+ `integer * 10**-decimals`, without floating point:
100
+
101
+ ```python
102
+ print(tro.digits(file.solution[0].values[0])) # (21871, 1): 2187.1
103
+ print(tro.digits(file.units[0])) # (1, -3): 1e+03
104
+ ```
105
+
106
+ TROTOT 2187.1 in units of 1e+03 is 2.1871 m: "Values reported in
107
+ TROP/SOLUTION Block should be divided by the related TROPO UNITS to get
108
+ the base units".
109
+
110
+ ### Write it back
111
+
112
+ `write(file)` gives the text back, exactly as read:
113
+
114
+ ```python
115
+ print(tro.write(file) == text) # True
116
+ ```
117
+
118
+ `read` checks the structure: the header line's format version, blocks
119
+ begun and ended, the first character of every line, the footer line. The
120
+ fields are checked when they are asked for, so that a file whose
121
+ description or solution does not follow the document still reads and
122
+ writes back; the property raises `Invalid` then. A file of another format
123
+ version raises `Unsupported`. Both derive from `tro.Error`, a
124
+ `ValueError`.
125
+
126
+ ## Documentation
127
+
128
+ What gnsswire-tro checks and does not check, what its tests rest on and
129
+ the readings it takes where its specifications are ambiguous are under
130
+ [Limitations](https://github.com/tracenav/gnsswire#gnsswire-tro) in the
131
+ [repository README](https://github.com/tracenav/gnsswire#readme), with the
132
+ interface every gnsswire format shares and the version policy. Release
133
+ notes are in [RELEASES.md](https://github.com/tracenav/gnsswire/blob/main/RELEASES.md).
134
+
135
+ ## Contribute
136
+
137
+ Report bugs and request formats in the
138
+ [issue tracker](https://github.com/tracenav/gnsswire/issues).
139
+
140
+ ## Licence
141
+
142
+ 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-tro"
7
+ version = "0.1.0"
8
+ description = "SINEX_TRO troposphere files (versions 0.01 and 2.00): zenith delays, gradients and their description, read and written losslessly as 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/tro"
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,44 @@
1
+ """SINEX_TRO troposphere files, versions 0.01 and 2.00: text to lines and fields, and back.
2
+
3
+ A SINEX_TRO file holds, per site and epoch, tropospheric parameters such as
4
+ the zenith total delay and its horizontal gradients (the troposphere
5
+ products of the IGS: one file per site and day, at 5-minute steps), with
6
+ the description of the solution, the station metadata and, in version
7
+ 2.00, slant delays and meteorological parameters. It is read whole with
8
+ :func:`read` and written with :func:`write`, and ``write(read(text)) ==
9
+ text`` for every file this module accepts. The file is its header and
10
+ footer lines and its blocks (:class:`Block`), each the text of its lines;
11
+ :class:`TroFile` reads the header line, TROP/DESCRIPTION, the solution
12
+ blocks (:class:`Row`) and the station coordinates (:class:`Coordinates`)
13
+ into fields, as text, and :func:`digits` gives a number as the integer of
14
+ its digits and its count of decimals. Nothing is scaled: values are in the
15
+ units the file gives (0.01: millimetres; 2.00: TROPO PARAMETER UNITS).
16
+
17
+ Sources: SINEX_TRO Version 2.00 (R. Pacione, J. Dousa, December 2020) and
18
+ Version 0.01 (G. Gendt, 1 March 1997); the readings taken are in ``_file``.
19
+
20
+ Errors: every exception this codec raises for a file it cannot read or
21
+ lines it cannot write is an :class:`Error` (a ``ValueError``):
22
+ :class:`Invalid`, :class:`Unsupported` (another format version), and the
23
+ error :func:`digits` raises for text that is not a number.
24
+ """
25
+
26
+ from ._file import (
27
+ VERSIONS,
28
+ Block,
29
+ Coordinates,
30
+ Epoch,
31
+ Error,
32
+ Header,
33
+ Invalid,
34
+ Row,
35
+ TroFile,
36
+ Unsupported,
37
+ digits,
38
+ epoch,
39
+ read,
40
+ write,
41
+ )
42
+
43
+ __all__ = ["VERSIONS", "Block", "Coordinates", "Epoch", "Error", "Header", "Invalid", "Row",
44
+ "TroFile", "Unsupported", "digits", "epoch", "read", "write"]