gnsskit 0.5.1__tar.gz → 0.6.1__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.
- {gnsskit-0.5.1 → gnsskit-0.6.1}/PKG-INFO +33 -69
- gnsskit-0.6.1/README.md +121 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/pyproject.toml +5 -1
- {gnsskit-0.5.1 → gnsskit-0.6.1}/pyproject.toml.orig +5 -1
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/__init__.py +16 -0
- gnsskit-0.6.1/src/gnsskit/interop/__init__.py +15 -0
- gnsskit-0.6.1/src/gnsskit/interop/_common.py +31 -0
- gnsskit-0.6.1/src/gnsskit/interop/geojson.py +69 -0
- gnsskit-0.6.1/src/gnsskit/interop/move3/__init__.py +6 -0
- gnsskit-0.6.1/src/gnsskit/interop/move3/report.py +289 -0
- gnsskit-0.6.1/src/gnsskit/interop/move3/writer.py +348 -0
- gnsskit-0.6.1/src/gnsskit/interop/sinex.py +192 -0
- gnsskit-0.6.1/src/gnsskit/interop/starnet.py +70 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/refsys.py +25 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/rinex.py +52 -4
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/rtklib/config.py +2 -2
- gnsskit-0.5.1/README.md +0 -157
- {gnsskit-0.5.1 → gnsskit-0.6.1}/LICENSE +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/kinematic/__init__.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/kinematic/trajectory.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/plot/__init__.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/plot/_map.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/plot/occupations.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/plot/solutions.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/plot/visibility.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/ppp/__init__.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/py.typed +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/rtklib/__init__.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/rtklib/pos.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/rtklib/runner.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/static/__init__.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/static/baseline.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/static/closure.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/static/network.py +0 -0
- {gnsskit-0.5.1 → gnsskit-0.6.1}/src/gnsskit/static/solve.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gnsskit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: RTKLIB-based GNSS post-processing toolkit: RINEX tools, RTKLIB wrappers, static baselines and network adjustment, kinematic trajectories
|
|
5
5
|
Keywords: gnss,gps,rtklib,ppk,surveying,least-squares
|
|
6
6
|
Author: Francesco Ioli
|
|
@@ -43,25 +43,12 @@ Shared tools for post-processing GNSS data with [RTKLIB](https://www.rtklib.com/
|
|
|
43
43
|
> command-line program `rnx2rtkp` (the CLI of RTKPOST) for the GNSS processing; `pip`/`uv` do
|
|
44
44
|
> not install it. See [RTKLIB](#rtklib-required-separately) below.
|
|
45
45
|
|
|
46
|
-
- **RTKLIB
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- **
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
file names, a field book or the headers), `sessions_from_overlap` and `flag_stale_headers`.
|
|
53
|
-
- **Plots** (`gnsskit.plot`, needs the `plot` extra): `plot_visibility` (RTKPLOT-style satellite
|
|
54
|
-
visibility), `plot_occupations` (map of where, when and with which receiver every point was
|
|
55
|
-
occupied), `plot_baselines` (baseline network: arrows base -> rover, fixed/float, repeated
|
|
56
|
-
baselines side by side, optional error ellipses) and `plot_pos` (RTKPLOT-like view of a static or
|
|
57
|
-
kinematic `.pos` solution: ground track and E/N/U, satellites and ratio against time, colored by
|
|
58
|
-
solution quality). The maps can be drawn over OpenStreetMap tiles.
|
|
59
|
-
- **Static** (`gnsskit.static`): `solve_static` (one solution over a time window), `process_baseline`
|
|
60
|
-
(static baselines with covariance), baseline IO and `loop_closures` (misclosure of every triangle of baselines); least-squares adjustment of a redundant baseline
|
|
61
|
-
network in `gnsskit.static.network` (needs the `network` extra).
|
|
62
|
-
- **Kinematic** (`gnsskit.kinematic`): trajectory interpolation and averaging.
|
|
63
|
-
- **Reference systems** (`gnsskit.refsys`): GPST/UTC, ellipsoids, ECEF/geodetic conversions and
|
|
64
|
-
`ENUFrame`, a local east-north-up frame at a point (points, vectors and covariances, both ways).
|
|
46
|
+
- **RTKLIB**: typed `RtkConfig`, `run_rnx2rtkp`, `read_pos`.
|
|
47
|
+
- **RINEX**: inspect, trim and decimate observation files; survey occupations.
|
|
48
|
+
- **Static**: baselines with covariance, loop closures, least-squares network adjustment.
|
|
49
|
+
- **Kinematic**: trajectory interpolation and averaging.
|
|
50
|
+
- **Reference systems and plots**: GPST/UTC, ECEF/geodetic/ENU; visibility, occupation, baseline and `.pos` plots.
|
|
51
|
+
- **Export**: MOVE3 projects.
|
|
65
52
|
|
|
66
53
|
## Install
|
|
67
54
|
|
|
@@ -106,39 +93,29 @@ reference systems) is pure Python and works without RTKLIB, e.g. on baselines co
|
|
|
106
93
|
|
|
107
94
|
## Example
|
|
108
95
|
|
|
109
|
-
|
|
110
|
-
from gnsskit import RtkConfig, read_pos, run_rnx2rtkp
|
|
111
|
-
|
|
112
|
-
config = RtkConfig(posmode="static", navsys="GEC", solformat="llh").with_base_llh(46.2, 9.8, 2300.0)
|
|
113
|
-
pos_file = run_rnx2rtkp(rover_obs, base_obs, [nav], config, "out.pos")
|
|
114
|
-
pos = read_pos(pos_file)
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Map of the occupations of a survey, from files named e.g. `s1_A1_gs14.26o`:
|
|
96
|
+
Baselines of a static network with RTKLIB, then a least-squares adjustment with one fixed point:
|
|
118
97
|
|
|
119
98
|
```python
|
|
120
|
-
from gnsskit import
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
99
|
+
from gnsskit import RtkConfig, process_baseline
|
|
100
|
+
from gnsskit.static.network import adjust_network, coordinate_table
|
|
101
|
+
|
|
102
|
+
conf = RtkConfig(posmode="static", navsys="GRE", solformat="xyz", base_postype="rinexhead")
|
|
103
|
+
baselines = [
|
|
104
|
+
process_baseline(rover, base, f"{rover}.26o", f"{base}.26o", ["nav.26n"], conf, f"{base}-{rover}.pos")
|
|
105
|
+
for base, rover in [("MIL3", "A1"), ("MIL3", "A2"), ("A1", "A2")]
|
|
106
|
+
]
|
|
107
|
+
adj = adjust_network(baselines, fixed={"MIL3": (4421979.9187, 718518.3650, 4524921.2364)})
|
|
108
|
+
print(coordinate_table(adj))
|
|
128
109
|
```
|
|
129
110
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
```python
|
|
133
|
-
import pandas as pd
|
|
134
|
-
from gnsskit import plot_baselines, plot_pos
|
|
135
|
-
|
|
136
|
-
baselines = pd.read_csv("baselines.csv", dtype={"base": str, "rover": str}) # baselines_to_df
|
|
137
|
-
plot_baselines(baselines, "network.png", fixed={"mil": (4421979.92, 718518.37, 4524921.24)})
|
|
138
|
-
plot_pos("rover.pos", "rover.png") # static or kinematic, llh / xyz / enu
|
|
139
|
-
```
|
|
111
|
+
## Documentation
|
|
140
112
|
|
|
141
|
-
|
|
113
|
+
- [docs/](https://github.com/franioli/gnsskit/tree/main/docs): one short guide per module (RINEX,
|
|
114
|
+
RTKLIB, static baselines and adjustment, kinematic, reference systems, plots, MOVE3 export).
|
|
115
|
+
- [scripts/](https://github.com/franioli/gnsskit/tree/main/scripts): command-line tools for RINEX
|
|
116
|
+
statistics, occupation maps and trimming.
|
|
117
|
+
- [example/](https://github.com/franioli/gnsskit/tree/main/example): complete worked examples
|
|
118
|
+
(static, kinematic, static network with data).
|
|
142
119
|
|
|
143
120
|
## Contributing
|
|
144
121
|
|
|
@@ -162,30 +139,17 @@ Issues are welcome on [GitHub](https://github.com/franioli/gnsskit/issues). To c
|
|
|
162
139
|
|
|
163
140
|
## Releasing a new version
|
|
164
141
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
which checks that the tag matches the version, runs the tests, builds and uploads to PyPI:
|
|
142
|
+
Maintainers only. Publishing a GitHub release runs
|
|
143
|
+
[`publish.yml`](.github/workflows/publish.yml), which checks the tag against the version, builds
|
|
144
|
+
and uploads to PyPI (Trusted Publishing: publisher `franioli/gnsskit`, workflow `publish.yml`,
|
|
145
|
+
environment `pypi`):
|
|
170
146
|
|
|
171
147
|
```sh
|
|
172
|
-
uv version --bump patch # or minor / major: updates pyproject.toml
|
|
173
148
|
uv run pytest
|
|
149
|
+
uv version --bump patch # or minor / major
|
|
174
150
|
git commit -am "Release $(uv version --short)" && git push
|
|
175
|
-
gh release create "v$(uv version --short)" --generate-notes
|
|
151
|
+
gh release create "v$(uv version --short)" --generate-notes
|
|
176
152
|
```
|
|
177
153
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
on GitHub. PyPI never accepts the same version twice.
|
|
181
|
-
|
|
182
|
-
One-time setup of the automatic upload (PyPI Trusted Publishing, no token): on pypi.org, project
|
|
183
|
-
gnsskit -> Settings -> Publishing -> add a GitHub publisher with owner `franioli`, repository
|
|
184
|
-
`gnsskit`, workflow `publish.yml` and environment `pypi`.
|
|
185
|
-
|
|
186
|
-
Manual upload, if needed, with a project-scoped token kept outside the repository:
|
|
187
|
-
|
|
188
|
-
```sh
|
|
189
|
-
rm -rf dist && uv build
|
|
190
|
-
UV_PUBLISH_TOKEN=$(cat ~/.config/pypi/gnsskit.token) uv publish
|
|
191
|
-
```
|
|
154
|
+
PyPI never accepts the same version twice. Manual upload, if needed:
|
|
155
|
+
`rm -rf dist && uv build && UV_PUBLISH_TOKEN=<project token> uv publish`.
|
gnsskit-0.6.1/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# gnsskit
|
|
2
|
+
|
|
3
|
+
Shared tools for post-processing GNSS data with [RTKLIB](https://www.rtklib.com/) `rnx2rtkp`, used by
|
|
4
|
+
[djippk](https://github.com/franioli/djippk) (drone PPK) and [stopgo](https://github.com/franioli/stopgo)
|
|
5
|
+
(stop-and-go surveys).
|
|
6
|
+
|
|
7
|
+
> [!IMPORTANT]
|
|
8
|
+
> **RTKLIB is not included and must be installed separately.** gnsskit runs the RTKLIB
|
|
9
|
+
> command-line program `rnx2rtkp` (the CLI of RTKPOST) for the GNSS processing; `pip`/`uv` do
|
|
10
|
+
> not install it. See [RTKLIB](#rtklib-required-separately) below.
|
|
11
|
+
|
|
12
|
+
- **RTKLIB**: typed `RtkConfig`, `run_rnx2rtkp`, `read_pos`.
|
|
13
|
+
- **RINEX**: inspect, trim and decimate observation files; survey occupations.
|
|
14
|
+
- **Static**: baselines with covariance, loop closures, least-squares network adjustment.
|
|
15
|
+
- **Kinematic**: trajectory interpolation and averaging.
|
|
16
|
+
- **Reference systems and plots**: GPST/UTC, ECEF/geodetic/ENU; visibility, occupation, baseline and `.pos` plots.
|
|
17
|
+
- **Export**: MOVE3 projects.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
With [uv](https://docs.astral.sh/uv/) (recommended), in your project:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
uv add gnsskit # library
|
|
25
|
+
uv add "gnsskit[network]" # + network adjustment (scipy, pyproj)
|
|
26
|
+
uv add "gnsskit[network,plot]" # + visibility plots and occupation maps (matplotlib)
|
|
27
|
+
uv add "gnsskit[all]" # every extra
|
|
28
|
+
uv add git+https://github.com/franioli/gnsskit # development version
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
or in an existing environment, `uv pip install gnsskit` (same extras).
|
|
32
|
+
|
|
33
|
+
With pip:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
pip install gnsskit
|
|
37
|
+
pip install "gnsskit[all]" # with every extra
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### RTKLIB (required separately)
|
|
41
|
+
|
|
42
|
+
The processing functions (`run_rnx2rtkp`, `process_baseline`, `solve_static`) call the RTKLIB
|
|
43
|
+
command-line program **`rnx2rtkp`**, which must be installed on your system and found on your
|
|
44
|
+
`PATH` (or passed with `exe=`); `trim_rinex(use_convbin=True)` also needs RTKLIB `convbin`.
|
|
45
|
+
The [demo5 fork](https://github.com/rtklibexplorer/RTKLIB) is
|
|
46
|
+
recommended; gnsskit is developed with `rnx2rtkp ver.EX 2.5.1`.
|
|
47
|
+
|
|
48
|
+
- **Windows**: download a [demo5 release](https://github.com/rtklibexplorer/RTKLIB/releases),
|
|
49
|
+
unzip it and add the folder with `rnx2rtkp.exe` to your `PATH`.
|
|
50
|
+
- **Linux / macOS**: build it from source:
|
|
51
|
+
```sh
|
|
52
|
+
git clone https://github.com/rtklibexplorer/RTKLIB
|
|
53
|
+
cd RTKLIB/app/consapp/rnx2rtkp/gcc && make && sudo make install
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Check it with `rnx2rtkp -?`. If it is missing, `run_rnx2rtkp` raises an error with these
|
|
57
|
+
instructions. The rest of gnsskit (RINEX tools, `read_pos`, loop closures, network adjustment,
|
|
58
|
+
reference systems) is pure Python and works without RTKLIB, e.g. on baselines computed elsewhere.
|
|
59
|
+
|
|
60
|
+
## Example
|
|
61
|
+
|
|
62
|
+
Baselines of a static network with RTKLIB, then a least-squares adjustment with one fixed point:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from gnsskit import RtkConfig, process_baseline
|
|
66
|
+
from gnsskit.static.network import adjust_network, coordinate_table
|
|
67
|
+
|
|
68
|
+
conf = RtkConfig(posmode="static", navsys="GRE", solformat="xyz", base_postype="rinexhead")
|
|
69
|
+
baselines = [
|
|
70
|
+
process_baseline(rover, base, f"{rover}.26o", f"{base}.26o", ["nav.26n"], conf, f"{base}-{rover}.pos")
|
|
71
|
+
for base, rover in [("MIL3", "A1"), ("MIL3", "A2"), ("A1", "A2")]
|
|
72
|
+
]
|
|
73
|
+
adj = adjust_network(baselines, fixed={"MIL3": (4421979.9187, 718518.3650, 4524921.2364)})
|
|
74
|
+
print(coordinate_table(adj))
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Documentation
|
|
78
|
+
|
|
79
|
+
- [docs/](https://github.com/franioli/gnsskit/tree/main/docs): one short guide per module (RINEX,
|
|
80
|
+
RTKLIB, static baselines and adjustment, kinematic, reference systems, plots, MOVE3 export).
|
|
81
|
+
- [scripts/](https://github.com/franioli/gnsskit/tree/main/scripts): command-line tools for RINEX
|
|
82
|
+
statistics, occupation maps and trimming.
|
|
83
|
+
- [example/](https://github.com/franioli/gnsskit/tree/main/example): complete worked examples
|
|
84
|
+
(static, kinematic, static network with data).
|
|
85
|
+
|
|
86
|
+
## Contributing
|
|
87
|
+
|
|
88
|
+
Issues are welcome on [GitHub](https://github.com/franioli/gnsskit/issues). To contribute code:
|
|
89
|
+
|
|
90
|
+
1. Fork the repository on GitHub and clone your fork:
|
|
91
|
+
```sh
|
|
92
|
+
git clone https://github.com/<your-username>/gnsskit && cd gnsskit
|
|
93
|
+
git checkout -b my-feature
|
|
94
|
+
```
|
|
95
|
+
2. Set up the environment, make your changes and check them:
|
|
96
|
+
```sh
|
|
97
|
+
uv sync # environment with the dev dependencies (incl. ruff)
|
|
98
|
+
uv run pytest # tests
|
|
99
|
+
uv run ruff format . # format the code
|
|
100
|
+
uv run ruff check --fix . # lint, fixing what can be fixed automatically
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
3. Push the branch to your fork and open a pull request against `main` of
|
|
104
|
+
`franioli/gnsskit`.
|
|
105
|
+
|
|
106
|
+
## Releasing a new version
|
|
107
|
+
|
|
108
|
+
Maintainers only. Publishing a GitHub release runs
|
|
109
|
+
[`publish.yml`](.github/workflows/publish.yml), which checks the tag against the version, builds
|
|
110
|
+
and uploads to PyPI (Trusted Publishing: publisher `franioli/gnsskit`, workflow `publish.yml`,
|
|
111
|
+
environment `pypi`):
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
uv run pytest
|
|
115
|
+
uv version --bump patch # or minor / major
|
|
116
|
+
git commit -am "Release $(uv version --short)" && git push
|
|
117
|
+
gh release create "v$(uv version --short)" --generate-notes
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
PyPI never accepts the same version twice. Manual upload, if needed:
|
|
121
|
+
`rm -rf dist && uv build && UV_PUBLISH_TOKEN=<project token> uv publish`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "gnsskit"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.1"
|
|
4
4
|
description = "RTKLIB-based GNSS post-processing toolkit: RINEX tools, RTKLIB wrappers, static baselines and network adjustment, kinematic trajectories"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -46,6 +46,10 @@ all = [
|
|
|
46
46
|
"matplotlib",
|
|
47
47
|
]
|
|
48
48
|
|
|
49
|
+
[project.scripts]
|
|
50
|
+
gnsskit-move3 = "gnsskit.interop.move3.writer:main"
|
|
51
|
+
gnsskit-starnet = "gnsskit.interop.starnet:main"
|
|
52
|
+
|
|
49
53
|
[project.urls]
|
|
50
54
|
Repository = "https://github.com/franioli/gnsskit"
|
|
51
55
|
Issues = "https://github.com/franioli/gnsskit/issues"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "gnsskit"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.1"
|
|
4
4
|
description = "RTKLIB-based GNSS post-processing toolkit: RINEX tools, RTKLIB wrappers, static baselines and network adjustment, kinematic trajectories"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -26,6 +26,10 @@ network = ["scipy", "pyproj"]
|
|
|
26
26
|
plot = ["matplotlib"]
|
|
27
27
|
all = ["scipy", "pyproj", "matplotlib"] # every extra above
|
|
28
28
|
|
|
29
|
+
[project.scripts]
|
|
30
|
+
gnsskit-move3 = "gnsskit.interop.move3.writer:main"
|
|
31
|
+
gnsskit-starnet = "gnsskit.interop.starnet:main"
|
|
32
|
+
|
|
29
33
|
[project.urls]
|
|
30
34
|
Repository = "https://github.com/franioli/gnsskit"
|
|
31
35
|
Issues = "https://github.com/franioli/gnsskit/issues"
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from importlib.metadata import version
|
|
4
4
|
|
|
5
|
+
from .interop import (
|
|
6
|
+
read_move3_folder,
|
|
7
|
+
read_move3_report,
|
|
8
|
+
write_geojson,
|
|
9
|
+
write_move3,
|
|
10
|
+
write_sinex,
|
|
11
|
+
write_starnet,
|
|
12
|
+
)
|
|
5
13
|
from .kinematic import interpolate
|
|
6
14
|
from .plot import plot_baselines, plot_occupations, plot_pos, plot_visibility
|
|
7
15
|
from .refsys import (
|
|
@@ -13,6 +21,7 @@ from .refsys import (
|
|
|
13
21
|
ENUFrame,
|
|
14
22
|
enu_diff,
|
|
15
23
|
gpst_to_local,
|
|
24
|
+
to_gpst,
|
|
16
25
|
utc_to_gpst,
|
|
17
26
|
)
|
|
18
27
|
from .rinex import (
|
|
@@ -72,6 +81,8 @@ __all__ = [
|
|
|
72
81
|
"plot_visibility",
|
|
73
82
|
"process_baseline",
|
|
74
83
|
"read_header",
|
|
84
|
+
"read_move3_folder",
|
|
85
|
+
"read_move3_report",
|
|
75
86
|
"read_occupations",
|
|
76
87
|
"read_pos",
|
|
77
88
|
"read_ref_pos",
|
|
@@ -82,6 +93,11 @@ __all__ = [
|
|
|
82
93
|
"sessions_from_overlap",
|
|
83
94
|
"signal_stats",
|
|
84
95
|
"solve_static",
|
|
96
|
+
"to_gpst",
|
|
85
97
|
"trim_rinex",
|
|
86
98
|
"utc_to_gpst",
|
|
99
|
+
"write_geojson",
|
|
100
|
+
"write_move3",
|
|
101
|
+
"write_sinex",
|
|
102
|
+
"write_starnet",
|
|
87
103
|
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Interfaces to external software: MOVE3, StarNet, SINEX and GeoJSON."""
|
|
2
|
+
|
|
3
|
+
from .geojson import write_geojson
|
|
4
|
+
from .move3 import read_move3_folder, read_move3_report, write_move3
|
|
5
|
+
from .sinex import write_sinex
|
|
6
|
+
from .starnet import write_starnet
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"read_move3_folder",
|
|
10
|
+
"read_move3_report",
|
|
11
|
+
"write_geojson",
|
|
12
|
+
"write_move3",
|
|
13
|
+
"write_sinex",
|
|
14
|
+
"write_starnet",
|
|
15
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Helpers shared by the writers of the interop module."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Mapping, Sequence
|
|
6
|
+
from dataclasses import replace
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from ..static.baseline import BaselineResult, read_baselines
|
|
10
|
+
|
|
11
|
+
CRLF = "\r\n" # MOVE3 and StarNet are Windows programs: use CRLF line endings
|
|
12
|
+
MAX_NAME_LEN = 16 # station names (MOVE3 spec 1.1); applied to every writer
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def prepare_baselines(
|
|
16
|
+
baselines: Sequence[BaselineResult] | Path | str, rename: Mapping[str, str] | None
|
|
17
|
+
) -> list[BaselineResult]:
|
|
18
|
+
"""Load baselines from a CSV if needed, rename stations and validate the names."""
|
|
19
|
+
bls = read_baselines(baselines) if isinstance(baselines, (str, Path)) else list(baselines)
|
|
20
|
+
if not bls:
|
|
21
|
+
raise ValueError("no baselines to export")
|
|
22
|
+
rename = rename or {}
|
|
23
|
+
bls = [
|
|
24
|
+
replace(b, base=rename.get(b.base, b.base), rover=rename.get(b.rover, b.rover)) for b in bls
|
|
25
|
+
]
|
|
26
|
+
for name in {n for b in bls for n in (b.base, b.rover)}:
|
|
27
|
+
if len(name) > MAX_NAME_LEN or " " in name or " " in name.strip():
|
|
28
|
+
raise ValueError(
|
|
29
|
+
f"invalid MOVE3 station name {name!r}: max {MAX_NAME_LEN} characters, no spaces"
|
|
30
|
+
)
|
|
31
|
+
return bls
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Export of a network adjustment to GeoJSON (RFC 7946), readable by QGIS and web maps.
|
|
2
|
+
|
|
3
|
+
One FeatureCollection with a Point per station (adjusted and held) and a LineString per
|
|
4
|
+
baseline. Coordinates are WGS84 [lon, lat, ellipsoidal height]. Standard library + numpy.
|
|
5
|
+
|
|
6
|
+
from gnsskit import write_geojson
|
|
7
|
+
write_geojson(adj, "network.geojson")
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import TYPE_CHECKING
|
|
15
|
+
|
|
16
|
+
import numpy as np
|
|
17
|
+
|
|
18
|
+
from ..refsys import WGS84, ecef_to_enu_matrix, ecef_to_llh
|
|
19
|
+
|
|
20
|
+
if TYPE_CHECKING: # the adjustment needs scipy: import it only for the annotations
|
|
21
|
+
from ..static.network import Adjustment
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _llh(xyz: np.ndarray) -> list[float]:
|
|
25
|
+
lat, lon, h = ecef_to_llh(*xyz, ellipsoid=WGS84)
|
|
26
|
+
return [round(float(lon), 9), round(float(lat), 9), round(float(h), 3)]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def write_geojson(adj: Adjustment, path: Path | str) -> Path:
|
|
30
|
+
"""Write the adjusted network as a GeoJSON FeatureCollection.
|
|
31
|
+
|
|
32
|
+
Point properties: `name`, `fixed`, ECEF `X`, `Y`, `Z` [m] and the standard deviations
|
|
33
|
+
`sd_E`, `sd_N`, `sd_U` [m] in the local east-north-up frame (0 for held points).
|
|
34
|
+
LineString properties: `kind` = "baseline", `session`, `from`, `to`, `length_m`.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
adj: Result of `adjust_network`.
|
|
38
|
+
path: Output file.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
The written file.
|
|
42
|
+
"""
|
|
43
|
+
xyz = {**dict(zip(adj.unknowns, adj.xyz, strict=True)), **adj.fixed}
|
|
44
|
+
feats = []
|
|
45
|
+
for i, (name, p) in enumerate(xyz.items()):
|
|
46
|
+
lat, lon, _ = ecef_to_llh(*p, ellipsoid=WGS84)
|
|
47
|
+
if i < len(adj.unknowns): # propagate the 3x3 block to east-north-up
|
|
48
|
+
R = ecef_to_enu_matrix(float(lat), float(lon))
|
|
49
|
+
sd = np.sqrt(np.diag(R @ adj.Cxx[3 * i : 3 * i + 3, 3 * i : 3 * i + 3] @ R.T))
|
|
50
|
+
else:
|
|
51
|
+
sd = np.zeros(3)
|
|
52
|
+
props = {"name": name, "fixed": name in adj.fixed}
|
|
53
|
+
props |= dict(zip("XYZ", map(float, p), strict=True))
|
|
54
|
+
props |= {f"sd_{k}": round(float(s), 5) for k, s in zip("ENU", sd, strict=True)}
|
|
55
|
+
feats.append(_feature({"type": "Point", "coordinates": _llh(p)}, props))
|
|
56
|
+
for b in adj.baselines:
|
|
57
|
+
line = {"type": "LineString", "coordinates": [_llh(xyz[b.base]), _llh(xyz[b.rover])]}
|
|
58
|
+
length = float(np.linalg.norm(xyz[b.rover] - xyz[b.base]))
|
|
59
|
+
props = {"kind": "baseline", "session": b.session, "from": b.base, "to": b.rover}
|
|
60
|
+
props["length_m"] = round(length, 3)
|
|
61
|
+
feats.append(_feature(line, props))
|
|
62
|
+
out = Path(path)
|
|
63
|
+
out.parent.mkdir(parents=True, exist_ok=True)
|
|
64
|
+
out.write_text(json.dumps({"type": "FeatureCollection", "features": feats}, indent=1))
|
|
65
|
+
return out
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _feature(geometry: dict, properties: dict) -> dict:
|
|
69
|
+
return {"type": "Feature", "geometry": geometry, "properties": properties}
|