canvod-filemap 1.0.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.
- canvod_filemap-1.0.0/LICENSE +203 -0
- canvod_filemap-1.0.0/NOTICE +14 -0
- canvod_filemap-1.0.0/PKG-INFO +109 -0
- canvod_filemap-1.0.0/README.md +78 -0
- canvod_filemap-1.0.0/pyproject.toml +57 -0
- canvod_filemap-1.0.0/pyproject.toml.orig +53 -0
- canvod_filemap-1.0.0/src/canvod/filemap/__init__.py +38 -0
- canvod_filemap-1.0.0/src/canvod/filemap/mapping.py +28 -0
- canvod_filemap-1.0.0/src/canvod/filemap/patterns.py +28 -0
- canvod_filemap-1.0.0/src/canvod/filemap/recipe.py +387 -0
- canvod_filemap-1.0.0/src/canvod/filemap/recipe_files.py +125 -0
- canvod_filemap-1.0.0/src/canvod/filemap/remote.py +160 -0
- canvod_filemap-1.0.0/src/canvod/filemap/templates/recipe.yaml +77 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Nicolas François Bader
|
|
190
|
+
Climate and Environmental Remote Sensing Research Unit (CLIMERS)
|
|
191
|
+
Department of Geodesy and Geoinformation, TU Wien
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
canvodpy-extensions
|
|
2
|
+
Copyright 2026 Nicolas François Bader, TU Wien
|
|
3
|
+
|
|
4
|
+
This product includes software developed at the
|
|
5
|
+
Climate and Environmental Remote Sensing Research Unit (CLIMERS),
|
|
6
|
+
Department of Geodesy and Geoinformation, TU Wien.
|
|
7
|
+
|
|
8
|
+
This product includes contributions from the canVODpy community.
|
|
9
|
+
Individual contributors are listed in the CONTRIBUTORS.md file and
|
|
10
|
+
recorded in the Git revision history of the repository:
|
|
11
|
+
https://github.com/TUW-GEO/canvodpy-extensions
|
|
12
|
+
|
|
13
|
+
canvodpy-extensions is an optional extension monorepo for
|
|
14
|
+
https://github.com/TUW-GEO/canvodpy.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: canvod-filemap
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Naming recipes that map non-canonical GNSS-T filenames to canVOD names
|
|
5
|
+
Keywords: GNSS,GNSS-T,file names,naming recipes,RINEX,SBF,remote sensing
|
|
6
|
+
Author: Nicolas François Bader
|
|
7
|
+
Author-email: Nicolas François Bader <support@canvodpy.eu>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Requires-Dist: canvod-preflight>=1.0.0
|
|
19
|
+
Requires-Dist: canvod-utils>=1.0.0
|
|
20
|
+
Requires-Dist: pydantic>=2.5.0
|
|
21
|
+
Requires-Dist: pyyaml>=6.0
|
|
22
|
+
Requires-Dist: natsort>=8.4.0
|
|
23
|
+
Maintainer: Climate and Environmental Remote Sensing (CLIMERS)
|
|
24
|
+
Maintainer-email: Climate and Environmental Remote Sensing (CLIMERS) <support@canvodpy.eu>
|
|
25
|
+
Requires-Python: >=3.14
|
|
26
|
+
Project-URL: Homepage, https://github.com/TUW-GEO/canvodpy-extensions
|
|
27
|
+
Project-URL: Documentation, https://extensions.canvodpy.eu/packages/filemap/overview/
|
|
28
|
+
Project-URL: Repository, https://github.com/TUW-GEO/canvodpy-extensions
|
|
29
|
+
Project-URL: Issues, https://github.com/TUW-GEO/canvodpy-extensions/issues
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<picture>
|
|
34
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/TUW-GEO/canvodpy/main/docs/assets/logo/canvodpy_logo_dark_mode.svg">
|
|
35
|
+
<img alt="canVODpy" src="https://raw.githubusercontent.com/TUW-GEO/canvodpy/main/docs/assets/logo/canvodpy_logo_bright_mode.svg" width="260">
|
|
36
|
+
</picture>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
# canvod-filemap
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/canvod-filemap/)
|
|
42
|
+
[](https://www.python.org/)
|
|
43
|
+
[](https://github.com/TUW-GEO/canvodpy-extensions/blob/main/LICENSE)
|
|
44
|
+
[](https://doi.org/10.5281/zenodo.21359005)
|
|
45
|
+
|
|
46
|
+
**Naming recipes for receiver files that don't follow the canVOD file name convention.** `canvod-filemap` is one of the
|
|
47
|
+
[canVODpy extensions](https://extensions.canvodpy.eu/), optional packages
|
|
48
|
+
for [canVODpy](https://canvodpy.eu/), an open Python ecosystem for
|
|
49
|
+
GNSS-Transmissometry (GNSS-T) canopy VOD retrievals.
|
|
50
|
+
|
|
51
|
+
## What it does
|
|
52
|
+
|
|
53
|
+
`canvodpy run` processes files whose names follow the canVOD convention, in
|
|
54
|
+
any folder layout. For a receiver whose files are named differently, a
|
|
55
|
+
naming recipe translates each file name to its canonical name, without
|
|
56
|
+
renaming any file on disk.
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
{SIT}{T}{NN}{AGC}_R_{YYYY}{DOY}{HHMM}_{PERIOD}_{SAMPLING}_{CONTENT}.{TYPE}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Example: `FANA01INK_R_20250010000_15M_05S_AA.rnx`
|
|
63
|
+
|
|
64
|
+
| Component | Purpose |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `NamingRecipe` | Translates a receiver's own file names to canonical names |
|
|
67
|
+
| `find_recipe`, `create_recipe` | Recipe files at `<config dir>/recipes/<site>/<name>.yaml`; new ones from the template |
|
|
68
|
+
| `fetch_recipe`, `check_recipe_url` | Recipes from a raw GitHub link (commit, tag or branch), fetched by every run |
|
|
69
|
+
|
|
70
|
+
`canvodpy config validate --site <site>` checks before a run which files the
|
|
71
|
+
run would process.
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv add canvod-filemap
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
canVODpy requires Python 3.14.
|
|
80
|
+
|
|
81
|
+
## Example
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from pathlib import Path
|
|
85
|
+
|
|
86
|
+
from canvod.filemap import NamingRecipe
|
|
87
|
+
|
|
88
|
+
recipe = NamingRecipe.load(Path("config/recipes/fangorn/fangorn_reference.yaml"))
|
|
89
|
+
vf = recipe.to_virtual_file(Path("rref001a15.25o"))
|
|
90
|
+
print(vf.conventional_name) # canonical canVOD name; the file keeps its name
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Documentation
|
|
94
|
+
|
|
95
|
+
[filemap documentation](https://extensions.canvodpy.eu/packages/filemap/overview/)
|
|
96
|
+
and the [canVODpy documentation](https://canvodpy.eu/).
|
|
97
|
+
|
|
98
|
+
## Citation
|
|
99
|
+
|
|
100
|
+
Please cite the canVODpy extensions with their Zenodo DOI,
|
|
101
|
+
[10.5281/zenodo.21359005](https://doi.org/10.5281/zenodo.21359005), and
|
|
102
|
+
canVODpy with
|
|
103
|
+
[10.5281/zenodo.18496233](https://doi.org/10.5281/zenodo.18496233).
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
Apache License 2.0. See
|
|
108
|
+
[LICENSE](https://github.com/TUW-GEO/canvodpy-extensions/blob/main/LICENSE)
|
|
109
|
+
and [NOTICE](https://github.com/TUW-GEO/canvodpy-extensions/blob/main/NOTICE).
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/TUW-GEO/canvodpy/main/docs/assets/logo/canvodpy_logo_dark_mode.svg">
|
|
4
|
+
<img alt="canVODpy" src="https://raw.githubusercontent.com/TUW-GEO/canvodpy/main/docs/assets/logo/canvodpy_logo_bright_mode.svg" width="260">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
# canvod-filemap
|
|
9
|
+
|
|
10
|
+
[](https://pypi.org/project/canvod-filemap/)
|
|
11
|
+
[](https://www.python.org/)
|
|
12
|
+
[](https://github.com/TUW-GEO/canvodpy-extensions/blob/main/LICENSE)
|
|
13
|
+
[](https://doi.org/10.5281/zenodo.21359005)
|
|
14
|
+
|
|
15
|
+
**Naming recipes for receiver files that don't follow the canVOD file name convention.** `canvod-filemap` is one of the
|
|
16
|
+
[canVODpy extensions](https://extensions.canvodpy.eu/), optional packages
|
|
17
|
+
for [canVODpy](https://canvodpy.eu/), an open Python ecosystem for
|
|
18
|
+
GNSS-Transmissometry (GNSS-T) canopy VOD retrievals.
|
|
19
|
+
|
|
20
|
+
## What it does
|
|
21
|
+
|
|
22
|
+
`canvodpy run` processes files whose names follow the canVOD convention, in
|
|
23
|
+
any folder layout. For a receiver whose files are named differently, a
|
|
24
|
+
naming recipe translates each file name to its canonical name, without
|
|
25
|
+
renaming any file on disk.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
{SIT}{T}{NN}{AGC}_R_{YYYY}{DOY}{HHMM}_{PERIOD}_{SAMPLING}_{CONTENT}.{TYPE}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Example: `FANA01INK_R_20250010000_15M_05S_AA.rnx`
|
|
32
|
+
|
|
33
|
+
| Component | Purpose |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `NamingRecipe` | Translates a receiver's own file names to canonical names |
|
|
36
|
+
| `find_recipe`, `create_recipe` | Recipe files at `<config dir>/recipes/<site>/<name>.yaml`; new ones from the template |
|
|
37
|
+
| `fetch_recipe`, `check_recipe_url` | Recipes from a raw GitHub link (commit, tag or branch), fetched by every run |
|
|
38
|
+
|
|
39
|
+
`canvodpy config validate --site <site>` checks before a run which files the
|
|
40
|
+
run would process.
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uv add canvod-filemap
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
canVODpy requires Python 3.14.
|
|
49
|
+
|
|
50
|
+
## Example
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from pathlib import Path
|
|
54
|
+
|
|
55
|
+
from canvod.filemap import NamingRecipe
|
|
56
|
+
|
|
57
|
+
recipe = NamingRecipe.load(Path("config/recipes/fangorn/fangorn_reference.yaml"))
|
|
58
|
+
vf = recipe.to_virtual_file(Path("rref001a15.25o"))
|
|
59
|
+
print(vf.conventional_name) # canonical canVOD name; the file keeps its name
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Documentation
|
|
63
|
+
|
|
64
|
+
[filemap documentation](https://extensions.canvodpy.eu/packages/filemap/overview/)
|
|
65
|
+
and the [canVODpy documentation](https://canvodpy.eu/).
|
|
66
|
+
|
|
67
|
+
## Citation
|
|
68
|
+
|
|
69
|
+
Please cite the canVODpy extensions with their Zenodo DOI,
|
|
70
|
+
[10.5281/zenodo.21359005](https://doi.org/10.5281/zenodo.21359005), and
|
|
71
|
+
canVODpy with
|
|
72
|
+
[10.5281/zenodo.18496233](https://doi.org/10.5281/zenodo.18496233).
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
Apache License 2.0. See
|
|
77
|
+
[LICENSE](https://github.com/TUW-GEO/canvodpy-extensions/blob/main/LICENSE)
|
|
78
|
+
and [NOTICE](https://github.com/TUW-GEO/canvodpy-extensions/blob/main/NOTICE).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "canvod-filemap"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Naming recipes that map non-canonical GNSS-T filenames to canVOD names"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = [
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"NOTICE",
|
|
11
|
+
]
|
|
12
|
+
keywords = [
|
|
13
|
+
"GNSS",
|
|
14
|
+
"GNSS-T",
|
|
15
|
+
"file names",
|
|
16
|
+
"naming recipes",
|
|
17
|
+
"RINEX",
|
|
18
|
+
"SBF",
|
|
19
|
+
"remote sensing",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 5 - Production/Stable",
|
|
23
|
+
"Intended Audience :: Science/Research",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Topic :: Scientific/Engineering",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"canvod-preflight>=1.0.0",
|
|
32
|
+
"canvod-utils>=1.0.0",
|
|
33
|
+
"pydantic>=2.5.0",
|
|
34
|
+
"pyyaml>=6.0",
|
|
35
|
+
"natsort>=8.4.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[[project.authors]]
|
|
39
|
+
name = "Nicolas François Bader"
|
|
40
|
+
email = "support@canvodpy.eu"
|
|
41
|
+
|
|
42
|
+
[[project.maintainers]]
|
|
43
|
+
name = "Climate and Environmental Remote Sensing (CLIMERS)"
|
|
44
|
+
email = "support@canvodpy.eu"
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/TUW-GEO/canvodpy-extensions"
|
|
48
|
+
Documentation = "https://extensions.canvodpy.eu/packages/filemap/overview/"
|
|
49
|
+
Repository = "https://github.com/TUW-GEO/canvodpy-extensions"
|
|
50
|
+
Issues = "https://github.com/TUW-GEO/canvodpy-extensions/issues"
|
|
51
|
+
|
|
52
|
+
[build-system]
|
|
53
|
+
requires = ["uv_build>=0.13.0,<0.14.0"]
|
|
54
|
+
build-backend = "uv_build"
|
|
55
|
+
|
|
56
|
+
[tool.uv.build-backend]
|
|
57
|
+
module-name = "canvod.filemap"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "canvod-filemap"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Naming recipes that map non-canonical GNSS-T filenames to canVOD names"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
authors = [
|
|
8
|
+
{name = "Nicolas François Bader", email = "support@canvodpy.eu"},
|
|
9
|
+
]
|
|
10
|
+
maintainers = [
|
|
11
|
+
{name = "Climate and Environmental Remote Sensing (CLIMERS)", email = "support@canvodpy.eu"},
|
|
12
|
+
]
|
|
13
|
+
license = "Apache-2.0"
|
|
14
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
15
|
+
keywords = [
|
|
16
|
+
"GNSS",
|
|
17
|
+
"GNSS-T",
|
|
18
|
+
"file names",
|
|
19
|
+
"naming recipes",
|
|
20
|
+
"RINEX",
|
|
21
|
+
"SBF",
|
|
22
|
+
"remote sensing",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 5 - Production/Stable",
|
|
26
|
+
"Intended Audience :: Science/Research",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
30
|
+
"Programming Language :: Python :: 3.14",
|
|
31
|
+
"Topic :: Scientific/Engineering",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
dependencies = [
|
|
35
|
+
"canvod-preflight>=1.0.0",
|
|
36
|
+
"canvod-utils>=1.0.0",
|
|
37
|
+
"pydantic>=2.5.0",
|
|
38
|
+
"pyyaml>=6.0",
|
|
39
|
+
"natsort>=8.4.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.com/TUW-GEO/canvodpy-extensions"
|
|
44
|
+
Documentation = "https://extensions.canvodpy.eu/packages/filemap/overview/"
|
|
45
|
+
Repository = "https://github.com/TUW-GEO/canvodpy-extensions"
|
|
46
|
+
Issues = "https://github.com/TUW-GEO/canvodpy-extensions/issues"
|
|
47
|
+
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["uv_build>=0.13.0,<0.14.0"]
|
|
50
|
+
build-backend = "uv_build"
|
|
51
|
+
|
|
52
|
+
[tool.uv.build-backend]
|
|
53
|
+
module-name = "canvod.filemap"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""canvod-filemap: naming recipes for non-canonical GNSS filenames."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version
|
|
4
|
+
|
|
5
|
+
__version__ = version("canvod-filemap")
|
|
6
|
+
|
|
7
|
+
from .mapping import VirtualFile
|
|
8
|
+
from .recipe import NamingRecipe, recipe_sha256
|
|
9
|
+
from .recipe_files import (
|
|
10
|
+
RecipeNotFoundError,
|
|
11
|
+
create_recipe,
|
|
12
|
+
find_recipe,
|
|
13
|
+
recipe_path,
|
|
14
|
+
)
|
|
15
|
+
from .remote import (
|
|
16
|
+
RecipeFetchError,
|
|
17
|
+
RecipeURLError,
|
|
18
|
+
RemoteRecipeError,
|
|
19
|
+
check_recipe_url,
|
|
20
|
+
fetch_recipe,
|
|
21
|
+
is_recipe_url,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"NamingRecipe",
|
|
26
|
+
"RecipeFetchError",
|
|
27
|
+
"RecipeNotFoundError",
|
|
28
|
+
"RecipeURLError",
|
|
29
|
+
"RemoteRecipeError",
|
|
30
|
+
"VirtualFile",
|
|
31
|
+
"check_recipe_url",
|
|
32
|
+
"create_recipe",
|
|
33
|
+
"fetch_recipe",
|
|
34
|
+
"find_recipe",
|
|
35
|
+
"is_recipe_url",
|
|
36
|
+
"recipe_path",
|
|
37
|
+
"recipe_sha256",
|
|
38
|
+
]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""``VirtualFile``: a physical file paired with its canVOD conventional name.
|
|
2
|
+
|
|
3
|
+
``NamingRecipe.to_virtual_file`` returns it; the file on disk keeps its name.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from canvod.preflight.convention import CanVODFilename
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class VirtualFile:
|
|
16
|
+
"""Physical file mapped to its canVOD conventional name."""
|
|
17
|
+
|
|
18
|
+
physical_path: Path
|
|
19
|
+
conventional_name: CanVODFilename
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def canonical_str(self) -> str:
|
|
23
|
+
"""The conventional filename as a string."""
|
|
24
|
+
return self.conventional_name.name
|
|
25
|
+
|
|
26
|
+
def open(self, mode: str = "rb"):
|
|
27
|
+
"""Open the physical file."""
|
|
28
|
+
return self.physical_path.open(mode)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Helpers for the date and time fields of non-canonical filenames."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# RINEX v2 hour letter: a-x = 0-23
|
|
6
|
+
_HOUR_LETTER_MAP: dict[str, int] = {chr(ord("a") + h): h for h in range(24)}
|
|
7
|
+
_HOUR_LETTER_MAP["0"] = 0 # '0' also means hour 0
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def hour_letter_to_int(letter: str) -> int:
|
|
11
|
+
"""Convert a RINEX hour letter (a-x or '0') to an integer 0-23.
|
|
12
|
+
|
|
13
|
+
Raises
|
|
14
|
+
------
|
|
15
|
+
ValueError
|
|
16
|
+
If the letter is not a valid RINEX hour code.
|
|
17
|
+
"""
|
|
18
|
+
try:
|
|
19
|
+
return _HOUR_LETTER_MAP[letter.lower()]
|
|
20
|
+
except KeyError:
|
|
21
|
+
raise ValueError(f"Invalid hour letter: {letter!r}") from None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def resolve_year_from_yy(yy: int) -> int:
|
|
25
|
+
"""Expand a 2-digit year to 4 digits (80-99 → 1980-1999, 00-79 → 2000-2079)."""
|
|
26
|
+
if yy >= 80:
|
|
27
|
+
return 1900 + yy
|
|
28
|
+
return 2000 + yy
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"""Naming recipe: user-defined mapping from arbitrary filenames to canVOD names.
|
|
2
|
+
|
|
3
|
+
A recipe is a small YAML file that describes:
|
|
4
|
+
1. The canonical identity of a receiver (site, agency, sampling, etc.)
|
|
5
|
+
2. How to extract date/time fields from the user's physical filenames.
|
|
6
|
+
|
|
7
|
+
The field extraction is a sequential left-to-right walk over the filename.
|
|
8
|
+
Each entry in the ``fields`` list consumes characters and either extracts
|
|
9
|
+
a named value or skips literal characters.
|
|
10
|
+
|
|
11
|
+
Recognized field names
|
|
12
|
+
----------------------
|
|
13
|
+
- ``year`` 4-digit year (e.g. 2025)
|
|
14
|
+
- ``yy`` 2-digit year (80-99 → 19xx, 00-79 → 20xx)
|
|
15
|
+
- ``doy`` day of year (1-366)
|
|
16
|
+
- ``month`` month (01-12)
|
|
17
|
+
- ``day`` day of month (01-31)
|
|
18
|
+
- ``hour`` hour (00-23)
|
|
19
|
+
- ``minute`` minute (00-59)
|
|
20
|
+
- ``hour_letter`` RINEX 2 session letter (a-x = hours 0-23; 0 = daily file)
|
|
21
|
+
- ``skip`` ignore these characters
|
|
22
|
+
|
|
23
|
+
Example recipe (YAML)
|
|
24
|
+
---------------------
|
|
25
|
+
::
|
|
26
|
+
|
|
27
|
+
name: fangorn_reference
|
|
28
|
+
description: Orthanc, reference receiver
|
|
29
|
+
|
|
30
|
+
site: FAN
|
|
31
|
+
agency: INK
|
|
32
|
+
receiver_number: 1
|
|
33
|
+
receiver_type: reference
|
|
34
|
+
sampling: "05S"
|
|
35
|
+
period: "15M"
|
|
36
|
+
content: "AA"
|
|
37
|
+
file_type: rnx
|
|
38
|
+
|
|
39
|
+
glob: "*.??o"
|
|
40
|
+
|
|
41
|
+
# Example: rref001a15.25o
|
|
42
|
+
fields:
|
|
43
|
+
- skip: 4
|
|
44
|
+
- doy: 3
|
|
45
|
+
- hour_letter: 1
|
|
46
|
+
- minute: 2
|
|
47
|
+
- skip: 1
|
|
48
|
+
- yy: 2
|
|
49
|
+
- skip: 1
|
|
50
|
+
|
|
51
|
+
Example recipe for exotic filenames
|
|
52
|
+
------------------------------------
|
|
53
|
+
::
|
|
54
|
+
|
|
55
|
+
# Example: STATION_2025_042_00_15.rinex
|
|
56
|
+
fields:
|
|
57
|
+
- skip: 8
|
|
58
|
+
- year: 4
|
|
59
|
+
- skip: 1
|
|
60
|
+
- doy: 3
|
|
61
|
+
- skip: 1
|
|
62
|
+
- hour: 2
|
|
63
|
+
- skip: 1
|
|
64
|
+
- minute: 2
|
|
65
|
+
- skip: 6
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
from __future__ import annotations
|
|
69
|
+
|
|
70
|
+
import hashlib
|
|
71
|
+
from pathlib import Path
|
|
72
|
+
from typing import Literal
|
|
73
|
+
|
|
74
|
+
import yaml
|
|
75
|
+
from canvod.preflight.convention import (
|
|
76
|
+
AgencyId,
|
|
77
|
+
CanVODFilename,
|
|
78
|
+
ContentCode,
|
|
79
|
+
Duration,
|
|
80
|
+
FileType,
|
|
81
|
+
ReceiverType,
|
|
82
|
+
SiteId,
|
|
83
|
+
)
|
|
84
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
85
|
+
|
|
86
|
+
from .mapping import VirtualFile
|
|
87
|
+
from .patterns import hour_letter_to_int, resolve_year_from_yy
|
|
88
|
+
|
|
89
|
+
# Field names the parser understands
|
|
90
|
+
KNOWN_FIELDS = frozenset(
|
|
91
|
+
{
|
|
92
|
+
"year",
|
|
93
|
+
"yy",
|
|
94
|
+
"doy",
|
|
95
|
+
"month",
|
|
96
|
+
"day",
|
|
97
|
+
"hour",
|
|
98
|
+
"minute",
|
|
99
|
+
"hour_letter",
|
|
100
|
+
"skip",
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class NamingRecipe(BaseModel):
|
|
106
|
+
"""A user-defined mapping from arbitrary filenames to canVOD names.
|
|
107
|
+
|
|
108
|
+
Serialize to YAML for sharing, to JSON for API transport. Fields it
|
|
109
|
+
does not know are ignored; :meth:`unrecognized_fields` names them.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
model_config = ConfigDict(extra="ignore")
|
|
113
|
+
|
|
114
|
+
name: str = Field(description="Recipe identifier (e.g. 'fangorn_reference')")
|
|
115
|
+
description: str = ""
|
|
116
|
+
|
|
117
|
+
# Canonical identity
|
|
118
|
+
site: SiteId
|
|
119
|
+
agency: AgencyId
|
|
120
|
+
receiver_number: int = Field(ge=1, le=99)
|
|
121
|
+
receiver_type: Literal["reference", "canopy"] = "canopy"
|
|
122
|
+
sampling: Duration = "05S"
|
|
123
|
+
period: Duration = "15M"
|
|
124
|
+
content: ContentCode = "AA"
|
|
125
|
+
file_type: Literal["rnx", "sbf", "ubx", "nmea"] = "rnx"
|
|
126
|
+
|
|
127
|
+
# File discovery
|
|
128
|
+
glob: str = Field(description="Glob pattern to find files (e.g. '*.??o', '*.rinex')")
|
|
129
|
+
|
|
130
|
+
# Field extraction: sequential left-to-right
|
|
131
|
+
# Each entry is a single-key dict: {field_name: width}
|
|
132
|
+
fields: list[dict[str, int]] = Field(
|
|
133
|
+
description="Sequential field extraction. Each entry: {field_name: width}"
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
@model_validator(mode="after")
|
|
137
|
+
def _validate_fields(self) -> NamingRecipe:
|
|
138
|
+
for i, entry in enumerate(self.fields):
|
|
139
|
+
if len(entry) != 1:
|
|
140
|
+
msg = f"fields[{i}]: each entry must be a single key-value pair, got {entry}"
|
|
141
|
+
raise ValueError(msg)
|
|
142
|
+
field_name = next(iter(entry))
|
|
143
|
+
width = entry[field_name]
|
|
144
|
+
if field_name not in KNOWN_FIELDS:
|
|
145
|
+
msg = f"fields[{i}]: unknown field '{field_name}'. Known: {sorted(KNOWN_FIELDS)}"
|
|
146
|
+
raise ValueError(msg)
|
|
147
|
+
if not isinstance(width, int) or width < 1:
|
|
148
|
+
msg = f"fields[{i}]: width must be a positive integer, got {width}"
|
|
149
|
+
raise ValueError(msg)
|
|
150
|
+
return self
|
|
151
|
+
|
|
152
|
+
# -- Parsing ---------------------------------------------------------------
|
|
153
|
+
|
|
154
|
+
def parse_filename(self, filename: str) -> dict[str, str | int]:
|
|
155
|
+
"""Extract fields from a physical filename.
|
|
156
|
+
|
|
157
|
+
Parameters
|
|
158
|
+
----------
|
|
159
|
+
filename
|
|
160
|
+
Bare filename (no directory components).
|
|
161
|
+
|
|
162
|
+
Returns
|
|
163
|
+
-------
|
|
164
|
+
dict
|
|
165
|
+
Extracted field values. Integer fields (year, doy, etc.) are
|
|
166
|
+
returned as ``int``. ``hour_letter`` is returned as ``str``.
|
|
167
|
+
``skip`` fields are not included.
|
|
168
|
+
|
|
169
|
+
Raises
|
|
170
|
+
------
|
|
171
|
+
ValueError
|
|
172
|
+
If the filename is too short for the field spec.
|
|
173
|
+
"""
|
|
174
|
+
pos = 0
|
|
175
|
+
result: dict[str, str | int] = {}
|
|
176
|
+
|
|
177
|
+
for entry in self.fields:
|
|
178
|
+
field_name = next(iter(entry))
|
|
179
|
+
width = entry[field_name]
|
|
180
|
+
|
|
181
|
+
if pos + width > len(filename):
|
|
182
|
+
msg = (
|
|
183
|
+
f"Filename {filename!r} too short: need {width} chars "
|
|
184
|
+
f"at position {pos} for '{field_name}', "
|
|
185
|
+
f"but only {len(filename) - pos} remain"
|
|
186
|
+
)
|
|
187
|
+
raise ValueError(msg)
|
|
188
|
+
|
|
189
|
+
raw = filename[pos : pos + width]
|
|
190
|
+
pos += width
|
|
191
|
+
|
|
192
|
+
if field_name == "skip":
|
|
193
|
+
continue
|
|
194
|
+
elif field_name == "hour_letter":
|
|
195
|
+
result["hour_letter"] = raw
|
|
196
|
+
else:
|
|
197
|
+
try:
|
|
198
|
+
result[field_name] = int(raw)
|
|
199
|
+
except ValueError:
|
|
200
|
+
msg = f"Cannot parse '{field_name}' as integer from {raw!r} in {filename!r}"
|
|
201
|
+
raise ValueError(msg) from None
|
|
202
|
+
|
|
203
|
+
return result
|
|
204
|
+
|
|
205
|
+
def to_virtual_file(self, file_path: Path) -> VirtualFile:
|
|
206
|
+
"""Map a physical file to a VirtualFile using this recipe.
|
|
207
|
+
|
|
208
|
+
Parameters
|
|
209
|
+
----------
|
|
210
|
+
file_path
|
|
211
|
+
Path to the physical file.
|
|
212
|
+
|
|
213
|
+
Returns
|
|
214
|
+
-------
|
|
215
|
+
VirtualFile
|
|
216
|
+
The mapped virtual file.
|
|
217
|
+
|
|
218
|
+
Raises
|
|
219
|
+
------
|
|
220
|
+
ValueError
|
|
221
|
+
If the filename cannot be parsed.
|
|
222
|
+
"""
|
|
223
|
+
parsed = self.parse_filename(file_path.name)
|
|
224
|
+
|
|
225
|
+
def _require_int(parsed_key: str) -> int:
|
|
226
|
+
value = parsed[parsed_key]
|
|
227
|
+
if isinstance(value, int):
|
|
228
|
+
return value
|
|
229
|
+
msg = (
|
|
230
|
+
f"Recipe '{self.name}': expected integer field '{parsed_key}' "
|
|
231
|
+
f"for {file_path.name!r}, got {value!r}"
|
|
232
|
+
)
|
|
233
|
+
raise ValueError(msg)
|
|
234
|
+
|
|
235
|
+
def _require_str(parsed_key: str) -> str:
|
|
236
|
+
value = parsed[parsed_key]
|
|
237
|
+
if isinstance(value, str):
|
|
238
|
+
return value
|
|
239
|
+
msg = (
|
|
240
|
+
f"Recipe '{self.name}': expected string field '{parsed_key}' "
|
|
241
|
+
f"for {file_path.name!r}, got {value!r}"
|
|
242
|
+
)
|
|
243
|
+
raise ValueError(msg)
|
|
244
|
+
|
|
245
|
+
# Resolve year
|
|
246
|
+
if "year" in parsed:
|
|
247
|
+
year = _require_int("year")
|
|
248
|
+
elif "yy" in parsed:
|
|
249
|
+
year = resolve_year_from_yy(_require_int("yy"))
|
|
250
|
+
else:
|
|
251
|
+
raise ValueError(
|
|
252
|
+
f"Recipe '{self.name}': no 'year' or 'yy' field "
|
|
253
|
+
f"in parsed result for {file_path.name!r}"
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
# Resolve DOY (from doy directly, or from month+day)
|
|
257
|
+
if "doy" in parsed:
|
|
258
|
+
doy = _require_int("doy")
|
|
259
|
+
elif "month" in parsed and "day" in parsed:
|
|
260
|
+
from datetime import date
|
|
261
|
+
|
|
262
|
+
doy = date(year, _require_int("month"), _require_int("day")).timetuple().tm_yday
|
|
263
|
+
else:
|
|
264
|
+
raise ValueError(
|
|
265
|
+
f"Recipe '{self.name}': no 'doy' or 'month'+'day' fields "
|
|
266
|
+
f"in parsed result for {file_path.name!r}"
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
# Resolve hour
|
|
270
|
+
if "hour" in parsed:
|
|
271
|
+
hour = _require_int("hour")
|
|
272
|
+
elif "hour_letter" in parsed:
|
|
273
|
+
hour = hour_letter_to_int(_require_str("hour_letter"))
|
|
274
|
+
else:
|
|
275
|
+
hour = 0
|
|
276
|
+
|
|
277
|
+
# Resolve minute
|
|
278
|
+
minute = _require_int("minute") if "minute" in parsed else 0
|
|
279
|
+
|
|
280
|
+
# Daily file: no hour in the name, or the RINEX 2 daily session "0"
|
|
281
|
+
# (hourly sessions are "a"-"x", so one recipe matches both)
|
|
282
|
+
period = self.period
|
|
283
|
+
has_hour = any("hour" in e or "hour_letter" in e for e in self.fields)
|
|
284
|
+
if parsed.get("hour_letter") == "0" or (hour == 0 and minute == 0 and not has_hour):
|
|
285
|
+
period = "01D"
|
|
286
|
+
|
|
287
|
+
rx_type = (
|
|
288
|
+
ReceiverType.REFERENCE if self.receiver_type == "reference" else ReceiverType.ACTIVE
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
conventional = CanVODFilename(
|
|
292
|
+
site=self.site,
|
|
293
|
+
receiver_type=rx_type,
|
|
294
|
+
receiver_number=self.receiver_number,
|
|
295
|
+
agency=self.agency,
|
|
296
|
+
year=year,
|
|
297
|
+
doy=doy,
|
|
298
|
+
hour=hour,
|
|
299
|
+
minute=minute,
|
|
300
|
+
period=period,
|
|
301
|
+
sampling=self.sampling,
|
|
302
|
+
content=self.content,
|
|
303
|
+
file_type=FileType(self.file_type),
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
return VirtualFile(physical_path=file_path, conventional_name=conventional)
|
|
307
|
+
|
|
308
|
+
@property
|
|
309
|
+
def expected_length(self) -> int:
|
|
310
|
+
"""Total number of characters consumed by the field spec."""
|
|
311
|
+
return sum(next(iter(e.values())) for e in self.fields)
|
|
312
|
+
|
|
313
|
+
def matches(self, filename: str) -> bool:
|
|
314
|
+
"""Check if a filename can be parsed by this recipe."""
|
|
315
|
+
if len(filename) != self.expected_length:
|
|
316
|
+
return False
|
|
317
|
+
try:
|
|
318
|
+
self.parse_filename(filename)
|
|
319
|
+
return True
|
|
320
|
+
except ValueError:
|
|
321
|
+
return False
|
|
322
|
+
|
|
323
|
+
# -- Serialization ---------------------------------------------------------
|
|
324
|
+
|
|
325
|
+
def to_yaml(self) -> str:
|
|
326
|
+
"""Serialize to YAML string."""
|
|
327
|
+
return yaml.dump(
|
|
328
|
+
self.model_dump(mode="json"),
|
|
329
|
+
default_flow_style=False,
|
|
330
|
+
sort_keys=False,
|
|
331
|
+
allow_unicode=True,
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
def save(self, path: Path) -> None:
|
|
335
|
+
"""Write recipe to a YAML file."""
|
|
336
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
337
|
+
path.write_text(self.to_yaml(), encoding="utf-8")
|
|
338
|
+
|
|
339
|
+
@classmethod
|
|
340
|
+
def from_yaml(cls, text: str) -> NamingRecipe:
|
|
341
|
+
"""Load from a YAML string."""
|
|
342
|
+
data = yaml.safe_load(text)
|
|
343
|
+
return cls.model_validate(data)
|
|
344
|
+
|
|
345
|
+
@classmethod
|
|
346
|
+
def load(cls, path: Path) -> NamingRecipe:
|
|
347
|
+
"""Load from a YAML file."""
|
|
348
|
+
text = path.read_text(encoding="utf-8")
|
|
349
|
+
return cls.from_yaml(text)
|
|
350
|
+
|
|
351
|
+
@classmethod
|
|
352
|
+
def unrecognized_fields(cls, path: Path) -> list[str]:
|
|
353
|
+
"""Top-level fields of a recipe file that the recipe does not know.
|
|
354
|
+
|
|
355
|
+
They are ignored when the recipe is loaded, for example a misspelled
|
|
356
|
+
field or one a later version of canvod-filemap reads.
|
|
357
|
+
|
|
358
|
+
Parameters
|
|
359
|
+
----------
|
|
360
|
+
path : Path
|
|
361
|
+
A recipe file.
|
|
362
|
+
|
|
363
|
+
Returns
|
|
364
|
+
-------
|
|
365
|
+
list[str]
|
|
366
|
+
The unknown field names, in file order; empty if there are none.
|
|
367
|
+
"""
|
|
368
|
+
data = yaml.safe_load(path.read_text(encoding="utf-8"))
|
|
369
|
+
if not isinstance(data, dict):
|
|
370
|
+
return []
|
|
371
|
+
return [str(key) for key in data if key not in cls.model_fields]
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def recipe_sha256(path: Path) -> str:
|
|
375
|
+
"""The sha256 of a recipe file, as recorded in a store's metadata.
|
|
376
|
+
|
|
377
|
+
Parameters
|
|
378
|
+
----------
|
|
379
|
+
path : Path
|
|
380
|
+
A recipe file, local or fetched by this run.
|
|
381
|
+
|
|
382
|
+
Returns
|
|
383
|
+
-------
|
|
384
|
+
str
|
|
385
|
+
The hexadecimal sha256 of the file's bytes.
|
|
386
|
+
"""
|
|
387
|
+
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""Where naming recipe files live, and creating them from the template.
|
|
2
|
+
|
|
3
|
+
Recipes are kept per site in the configuration directory::
|
|
4
|
+
|
|
5
|
+
<config dir>/recipes/<site>/<name>.yaml
|
|
6
|
+
|
|
7
|
+
``<site>`` is the site name in the settings file and ``<name>`` the
|
|
8
|
+
receiver's ``recipe:`` setting. Recipe files are user data: they are not part
|
|
9
|
+
of any repository and are only read from this location.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from .remote import fetch_recipe, is_recipe_url
|
|
17
|
+
|
|
18
|
+
#: The recipe template shipped with this package.
|
|
19
|
+
TEMPLATE_PATH = Path(__file__).parent / "templates" / "recipe.yaml"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RecipeNotFoundError(FileNotFoundError):
|
|
23
|
+
"""No recipe file exists for a site and recipe name."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def recipe_path(config_dir: Path, site: str, name: str) -> Path:
|
|
27
|
+
"""Path of the recipe ``name`` of ``site``, whether it exists or not.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
config_dir : Path
|
|
32
|
+
The configuration directory (the one holding the settings file).
|
|
33
|
+
site : str
|
|
34
|
+
Site name in the settings file.
|
|
35
|
+
name : str
|
|
36
|
+
Recipe name, the receiver's ``recipe:`` setting.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
Path
|
|
41
|
+
``<config_dir>/recipes/<site>/<name>.yaml``.
|
|
42
|
+
"""
|
|
43
|
+
return Path(config_dir) / "recipes" / site / f"{name}.yaml"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def find_recipe(config_dir: Path, site: str, name: str) -> Path:
|
|
47
|
+
"""Path of the existing recipe file ``name`` of ``site``.
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
config_dir : Path
|
|
52
|
+
The configuration directory (the one holding the settings file).
|
|
53
|
+
site : str
|
|
54
|
+
Site name in the settings file.
|
|
55
|
+
name : str
|
|
56
|
+
Recipe name, the receiver's ``recipe:`` setting.
|
|
57
|
+
|
|
58
|
+
Returns
|
|
59
|
+
-------
|
|
60
|
+
Path
|
|
61
|
+
``<config_dir>/recipes/<site>/<name>.yaml``, or, if ``name`` is a
|
|
62
|
+
URL, the file of the recipe this run fetched
|
|
63
|
+
(:func:`canvod.filemap.remote.fetch_recipe`).
|
|
64
|
+
|
|
65
|
+
Raises
|
|
66
|
+
------
|
|
67
|
+
RecipeNotFoundError
|
|
68
|
+
If that file does not exist. If the recipe is found directly in
|
|
69
|
+
``<config_dir>/recipes/``, the message says where to move it.
|
|
70
|
+
RemoteRecipeError
|
|
71
|
+
If ``name`` is a URL that is not a raw file link, or the recipe
|
|
72
|
+
cannot be fetched or is not valid.
|
|
73
|
+
"""
|
|
74
|
+
if is_recipe_url(name):
|
|
75
|
+
return fetch_recipe(name)
|
|
76
|
+
path = recipe_path(config_dir, site, name)
|
|
77
|
+
if path.is_file():
|
|
78
|
+
return path
|
|
79
|
+
flat = Path(config_dir) / "recipes" / f"{name}.yaml"
|
|
80
|
+
if flat.is_file():
|
|
81
|
+
msg = (
|
|
82
|
+
f"Recipe '{name}' of site '{site}' must be in a folder named after "
|
|
83
|
+
f"the site. Move {flat} to {path}"
|
|
84
|
+
)
|
|
85
|
+
raise RecipeNotFoundError(msg)
|
|
86
|
+
msg = f"Recipe file not found for '{name}' of site '{site}': {path}"
|
|
87
|
+
raise RecipeNotFoundError(msg)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def create_recipe(config_dir: Path, site: str, name: str, *, overwrite: bool = False) -> Path:
|
|
91
|
+
"""Create the recipe ``name`` of ``site`` from the template.
|
|
92
|
+
|
|
93
|
+
The new file has ``name`` filled in. The receiver identity and the
|
|
94
|
+
``fields`` list must be edited before the recipe can be loaded.
|
|
95
|
+
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
config_dir : Path
|
|
99
|
+
The configuration directory (the one holding the settings file).
|
|
100
|
+
site : str
|
|
101
|
+
Site name in the settings file.
|
|
102
|
+
name : str
|
|
103
|
+
Recipe name, the receiver's ``recipe:`` setting.
|
|
104
|
+
overwrite : bool
|
|
105
|
+
Replace an existing recipe file.
|
|
106
|
+
|
|
107
|
+
Returns
|
|
108
|
+
-------
|
|
109
|
+
Path
|
|
110
|
+
The created file, ``<config_dir>/recipes/<site>/<name>.yaml``.
|
|
111
|
+
|
|
112
|
+
Raises
|
|
113
|
+
------
|
|
114
|
+
FileExistsError
|
|
115
|
+
If the recipe file exists and ``overwrite`` is false.
|
|
116
|
+
"""
|
|
117
|
+
path = recipe_path(config_dir, site, name)
|
|
118
|
+
if path.exists() and not overwrite:
|
|
119
|
+
msg = f"Recipe file already exists: {path}"
|
|
120
|
+
raise FileExistsError(msg)
|
|
121
|
+
text = TEMPLATE_PATH.read_text(encoding="utf-8")
|
|
122
|
+
text = text.replace("name: CHANGEME", f"name: {name}", 1)
|
|
123
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
124
|
+
path.write_text(text, encoding="utf-8")
|
|
125
|
+
return path
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""Naming recipes read from a URL.
|
|
2
|
+
|
|
3
|
+
A receiver's ``recipe:`` setting can be a raw file link to a recipe in a
|
|
4
|
+
GitHub repository, at a commit, a tag or a branch::
|
|
5
|
+
|
|
6
|
+
https://raw.githubusercontent.com/<account>/<repo>/<commit>/<path>/<name>.yaml
|
|
7
|
+
https://raw.githubusercontent.com/<account>/<repo>/refs/tags/<tag>/<path>/<name>.yaml
|
|
8
|
+
https://raw.githubusercontent.com/<account>/<repo>/refs/heads/<branch>/<path>/<name>.yaml
|
|
9
|
+
|
|
10
|
+
The user is responsible for what the link points to. Every run fetches
|
|
11
|
+
the recipe again; there is no cache, so a run needs network access. The
|
|
12
|
+
sha256 of the fetched file, recorded in the store's metadata with the
|
|
13
|
+
file name of the URL (never the URL), says which recipe a run used.
|
|
14
|
+
|
|
15
|
+
A recipe in a private repository needs a GitHub token in the environment
|
|
16
|
+
variable ``GH_TOKEN`` or ``GITHUB_TOKEN``. canvodpy stores no secrets
|
|
17
|
+
(ADR "Credentials come from the environment" in the canvodpy repository).
|
|
18
|
+
The token is only sent to ``raw.githubusercontent.com``, never to the
|
|
19
|
+
target of a redirect, and never appears in messages or logs.
|
|
20
|
+
|
|
21
|
+
The URL check, token and download are canvodpy's
|
|
22
|
+
:mod:`canvod.utils.remote_file`, which also reads settings files from a
|
|
23
|
+
URL; this module adds the recipe check and keeps the recipe names and
|
|
24
|
+
errors.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
from pathlib import Path, PurePosixPath
|
|
30
|
+
from urllib.parse import urlsplit
|
|
31
|
+
|
|
32
|
+
import yaml
|
|
33
|
+
from canvod.utils import remote_file
|
|
34
|
+
from canvod.utils.remote_file import RemoteFetchError, RemoteURLError
|
|
35
|
+
from pydantic import ValidationError
|
|
36
|
+
|
|
37
|
+
from .recipe import NamingRecipe
|
|
38
|
+
|
|
39
|
+
#: The only host recipes are read from.
|
|
40
|
+
RECIPE_HOST = remote_file.REMOTE_HOST
|
|
41
|
+
|
|
42
|
+
#: Environment variables a GitHub token is read from, in this order.
|
|
43
|
+
TOKEN_VARIABLES = remote_file.TOKEN_VARIABLES
|
|
44
|
+
|
|
45
|
+
#: Largest recipe file accepted, in bytes.
|
|
46
|
+
MAX_RECIPE_BYTES = 1_000_000
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class RemoteRecipeError(Exception):
|
|
50
|
+
"""A recipe URL that cannot be used."""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class RecipeURLError(RemoteRecipeError, ValueError):
|
|
54
|
+
"""A recipe URL that is not a raw file link."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class RecipeFetchError(RemoteRecipeError):
|
|
58
|
+
"""A recipe that could not be fetched, or whose file is not a valid recipe."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def is_recipe_url(value: str) -> bool:
|
|
62
|
+
"""Whether a ``recipe:`` setting is a URL rather than a recipe name.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
value : str
|
|
67
|
+
The receiver's ``recipe:`` setting.
|
|
68
|
+
|
|
69
|
+
Returns
|
|
70
|
+
-------
|
|
71
|
+
bool
|
|
72
|
+
True for ``https://`` and ``http://`` values.
|
|
73
|
+
"""
|
|
74
|
+
return remote_file.is_url(value)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def check_recipe_url(url: str) -> None:
|
|
78
|
+
"""Check that ``url`` is a raw file link in a GitHub repository.
|
|
79
|
+
|
|
80
|
+
Parameters
|
|
81
|
+
----------
|
|
82
|
+
url : str
|
|
83
|
+
The recipe URL.
|
|
84
|
+
|
|
85
|
+
Raises
|
|
86
|
+
------
|
|
87
|
+
RecipeURLError
|
|
88
|
+
If the URL is not ``https``, holds a user name, password, query or
|
|
89
|
+
fragment, points to a host other than ``raw.githubusercontent.com``
|
|
90
|
+
(a ``github.com/.../blob/...`` link gets the matching raw link),
|
|
91
|
+
has no ``<account>/<repo>/<commit, tag or branch>/<file>`` path, or
|
|
92
|
+
does not end in a ``.yaml`` or ``.yml`` file.
|
|
93
|
+
"""
|
|
94
|
+
try:
|
|
95
|
+
remote_file.parse_remote_url(url, what="recipe")
|
|
96
|
+
except RemoteURLError as exc:
|
|
97
|
+
raise RecipeURLError(str(exc)) from None
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def fetch_recipe(url: str, *, timeout: float = 30.0) -> Path:
|
|
101
|
+
"""The local file of the recipe at ``url``, fetched by this run.
|
|
102
|
+
|
|
103
|
+
The URL is checked with :func:`check_recipe_url`. The file is fetched,
|
|
104
|
+
read like a local recipe file, and its ``name`` must match the file
|
|
105
|
+
name at the end of the URL. A run fetches a URL once, into a folder
|
|
106
|
+
of the run that is removed when the process that made it ends
|
|
107
|
+
(:func:`canvod.utils.remote_file.fetch_remote`).
|
|
108
|
+
|
|
109
|
+
Parameters
|
|
110
|
+
----------
|
|
111
|
+
url : str
|
|
112
|
+
The recipe URL.
|
|
113
|
+
timeout : float
|
|
114
|
+
Seconds to wait for the server.
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
Path
|
|
119
|
+
The fetched recipe file.
|
|
120
|
+
|
|
121
|
+
Raises
|
|
122
|
+
------
|
|
123
|
+
RecipeURLError
|
|
124
|
+
If the URL is not a raw file link.
|
|
125
|
+
RecipeFetchError
|
|
126
|
+
If the file cannot be fetched (not found, no access, a token that
|
|
127
|
+
is not a token, no network, timeout), is not a valid recipe, or its
|
|
128
|
+
name does not match the URL.
|
|
129
|
+
"""
|
|
130
|
+
try:
|
|
131
|
+
return remote_file.fetch_remote(
|
|
132
|
+
url,
|
|
133
|
+
what="recipe",
|
|
134
|
+
check=lambda data: _check_content(url, data),
|
|
135
|
+
max_bytes=MAX_RECIPE_BYTES,
|
|
136
|
+
timeout=timeout,
|
|
137
|
+
)
|
|
138
|
+
except RemoteURLError as exc:
|
|
139
|
+
raise RecipeURLError(str(exc)) from None
|
|
140
|
+
except RemoteFetchError as exc:
|
|
141
|
+
raise RecipeFetchError(str(exc)) from None
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _check_content(url: str, data: bytes) -> None:
|
|
145
|
+
"""Read ``data`` like a local recipe file and check its name against ``url``."""
|
|
146
|
+
try:
|
|
147
|
+
recipe = NamingRecipe.from_yaml(data.decode("utf-8"))
|
|
148
|
+
except (UnicodeDecodeError, yaml.YAMLError) as exc:
|
|
149
|
+
msg = f"Recipe {url} is not a YAML file: {exc}"
|
|
150
|
+
raise RecipeFetchError(msg) from None
|
|
151
|
+
except ValidationError as exc:
|
|
152
|
+
msg = f"Recipe {url} is not a valid recipe:\n{exc}"
|
|
153
|
+
raise RecipeFetchError(msg) from None
|
|
154
|
+
stem = PurePosixPath(urlsplit(url).path).stem
|
|
155
|
+
if recipe.name != stem:
|
|
156
|
+
msg = (
|
|
157
|
+
f"Recipe {url} is named '{recipe.name}', but its file is '{stem}'. "
|
|
158
|
+
"The recipe's name must match its file name."
|
|
159
|
+
)
|
|
160
|
+
raise RecipeFetchError(msg)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# canVODpy naming recipe
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# A recipe maps the file names of one receiver to the canonical canVOD name
|
|
5
|
+
# {SIT}{T}{NN}{AGC}_R_{YYYY}{DOY}{HHMM}_{PERIOD}_{SAMPLING}_{CONTENT}.{TYPE}
|
|
6
|
+
# without renaming anything on disk. It is only needed if the receiver writes
|
|
7
|
+
# non-canonical file names.
|
|
8
|
+
#
|
|
9
|
+
# Recipes live in <config dir>/recipes/<site>/<name>.yaml, where <site> is the
|
|
10
|
+
# site name in canvod-settings.yaml and <name> is the receiver's `recipe:`
|
|
11
|
+
# setting. Fill in the receiver identity below, then describe the file names
|
|
12
|
+
# in the `fields:` list.
|
|
13
|
+
|
|
14
|
+
name: CHANGEME # same as the file name, without .yaml
|
|
15
|
+
description: ""
|
|
16
|
+
|
|
17
|
+
# -----------------------------------------------------------------------
|
|
18
|
+
# Receiver identity: the first 9 characters of the canonical name
|
|
19
|
+
# -----------------------------------------------------------------------
|
|
20
|
+
site: CHANGEME # 3-character site code, e.g. FAN
|
|
21
|
+
agency: CHANGEME # 3-character agency code, e.g. INK
|
|
22
|
+
receiver_number: 1 # 1-99, unique per receiver role at the site
|
|
23
|
+
receiver_type: reference # reference or canopy
|
|
24
|
+
|
|
25
|
+
# -----------------------------------------------------------------------
|
|
26
|
+
# File properties written into the canonical name
|
|
27
|
+
# -----------------------------------------------------------------------
|
|
28
|
+
sampling: "05S" # sampling interval, e.g. 01S, 05S, 15S, 30S
|
|
29
|
+
period: "15M" # time span of one file, e.g. 15M, 01H, 01D
|
|
30
|
+
content: AA # content code (AA = all observables)
|
|
31
|
+
file_type: rnx # rnx, sbf, ubx or nmea
|
|
32
|
+
|
|
33
|
+
# -----------------------------------------------------------------------
|
|
34
|
+
# Which files belong to this receiver
|
|
35
|
+
# -----------------------------------------------------------------------
|
|
36
|
+
glob: "*.??o" # pattern the file names must match
|
|
37
|
+
|
|
38
|
+
# -----------------------------------------------------------------------
|
|
39
|
+
# Field extraction: a left-to-right walk over the file name
|
|
40
|
+
# -----------------------------------------------------------------------
|
|
41
|
+
# Each entry consumes N characters and either reads a value or skips them.
|
|
42
|
+
# Field names:
|
|
43
|
+
# year 4-digit year (e.g. 2025)
|
|
44
|
+
# yy 2-digit year (80-99 -> 19xx, 00-79 -> 20xx)
|
|
45
|
+
# doy day of year (1-366)
|
|
46
|
+
# month, day calendar month and day (together, instead of doy)
|
|
47
|
+
# hour hour (00-23)
|
|
48
|
+
# minute minute (00-59)
|
|
49
|
+
# hour_letter RINEX 2 session letter, instead of hour: a-x = hours 0-23,
|
|
50
|
+
# 0 = daily file (period 01D)
|
|
51
|
+
# skip ignore these characters
|
|
52
|
+
#
|
|
53
|
+
# Example 1, RINEX short name rref001a15.25o
|
|
54
|
+
# station "rref", doy "001", hour letter "a", minute "15", extension "25o"
|
|
55
|
+
# fields:
|
|
56
|
+
# - skip: 4
|
|
57
|
+
# - doy: 3
|
|
58
|
+
# - hour_letter: 1
|
|
59
|
+
# - minute: 2
|
|
60
|
+
# - skip: 1
|
|
61
|
+
# - yy: 2
|
|
62
|
+
# - skip: 1
|
|
63
|
+
#
|
|
64
|
+
# Example 2, STATION_2025_042_00_15.rinex
|
|
65
|
+
# fields:
|
|
66
|
+
# - skip: 8
|
|
67
|
+
# - year: 4
|
|
68
|
+
# - skip: 1
|
|
69
|
+
# - doy: 3
|
|
70
|
+
# - skip: 1
|
|
71
|
+
# - hour: 2
|
|
72
|
+
# - skip: 1
|
|
73
|
+
# - minute: 2
|
|
74
|
+
# - skip: 6
|
|
75
|
+
|
|
76
|
+
fields:
|
|
77
|
+
- skip: 0 # CHANGEME: replace with the fields of your file names
|