Skip to content

Commit 2ec7b19

Browse files
Merge pull request #147 from IPGP/prerelease
Prerelease v3.4.0
2 parents 9fea70b + aa59379 commit 2ec7b19

14 files changed

+125
-69
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
__pycache__
22
venv/
33
.idea/
4-
venvrimo3/
54
rinexmod.egg-info/
5+
py3rimo4a/
6+
venvrimo3/
67

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include requirements.txt

README.md

+21-30
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ It is developed in Python 3, and can be run from the command line or directly in
88
The required input metadata can come from a sitelog file, or be manually entered as arguments to the command line or the called function.
99
It is available under the GNU license on the following GitHub repository: https://github.com/IPGP/rinexmod
1010

11-
v2 - 2023-05-15 - Pierre Sakic - [email protected]
12-
v1 - 2022-02-07 - Félix Léger - [email protected]
11+
v2+ - 2023-05-15 - Pierre Sakic - [email protected]
12+
v1 - 2022-02-07 - Félix Léger - [email protected]
1313

1414
Last version: v3.4.0 - 2024-09-30
1515

1616
## Tools overview
1717

1818
### Main tool
1919

20-
* `rinexmod.py` takes a list of RINEX Hatanaka compressed files (.d.Z or .d.gz or .rnx.gz),
20+
* `rinexmod_run` takes a list of RINEX Hatanaka compressed files (.d.Z or .d.gz or .rnx.gz),
2121
loops the rinex files list to modify the file's headers. It then writes them back to Hatanaka
2222
compressed format in an output folder. It also permits to rename the files, changing
2323
the four first characters of the file name with another station code. It can write
2424
those files with the long name naming convention with the --longname option.
2525

2626
### Annex tools
2727

28-
They are stored in `misc_tools` folder.
28+
They are stored in `bin/misc_tools` folder.
2929

3030
* `get_m3g_sitelogs.py` will get the last version of site logs from the M3G repository
3131
and write them in an observatory-dependent subfolder.
@@ -42,14 +42,7 @@ The tool is designed in Python 3, and you must have it installed on your machine
4242
You can use `pip` to install the last GitHub-hosted version with the following command:
4343
```pip install git+https://github.com/IPGP/rinexmod```
4444

45-
To use the front-end functions, you must also add the `rinexmod` folder in your `$PATH` environnement variable,
46-
defined in your `.bashrc`.
47-
If you used PIP for the installation, your can locate the folder where `rinexmod` has been installed with:
48-
```
49-
pip show rinexmod
50-
```
51-
at the line `Location:`. Usually, it is `/usr/local/lib/python3.NN/dist-packages/rinexmod` .
52-
Then edit your `~/.bashrc` and add it to the `$PATH` environnement variable
45+
Since the version 3.4.0, the frontend program `rinexmod_run` is available directly when you call it in your console.
5346

5447
### Required external modules
5548

@@ -67,11 +60,9 @@ You can install them with:
6760
pip install hatanaka pycountry matplotlib colorlog pandas
6861
```
6962

70-
71-
7263
## _rinexmod_ in command lines interface
7364

74-
### rinexmod.py
65+
### rinexmod_run
7566

7667
This is the main frontend function. It takes a list of RINEX Hatanaka compressed files (.d.Z or .d.gz or .rnx.gz),
7768
loop over the RINEX files list to modify the file's header. It then writes them back to Hatanaka-compressed
@@ -146,13 +137,13 @@ _rinexmod_ will add two comment lines, one indicating the source of the modifica
146137
147138
### Synopsis
148139
```
149-
rinexmod.py [-h] -i RINEXINPUT [RINEXINPUT ...] -o OUTPUTFOLDER
150-
[-s SITELOG] [-k KEY=VALUE [KEY=VALUE ...]] [-m MARKER]
151-
[-co COUNTRY] [-n NINECHARFILE] [-sti STATION_INFO]
152-
[-lfi LFILE_APRIORI] [-r RELATIVE] [-nh] [-c {gz,Z,none}]
153-
[-l] [-fs] [-fc] [-fr] [-ig] [-a] [-ol OUTPUT_LOGS] [-w]
154-
[-v] [-t] [-u] [-fns {basic,flex,exact}]
155-
[-mp MULTI_PROCESS] [-d] [-rm]
140+
rinexmod_run [-h] -i RINEXINPUT [RINEXINPUT ...] -o OUTPUTFOLDER
141+
[-s SITELOG] [-k KEY=VALUE [KEY=VALUE ...]] [-m MARKER]
142+
[-co COUNTRY] [-n NINECHARFILE] [-sti STATION_INFO]
143+
[-lfi LFILE_APRIORI] [-r RELATIVE] [-nh] [-c {gz,Z,none}]
144+
[-l] [-fs] [-fc] [-fr] [-ig] [-a] [-ol OUTPUT_LOGS] [-w]
145+
[-v] [-t] [-u] [-fns {basic,flex,exact}]
146+
[-mp MULTI_PROCESS] [-d] [-rm]
156147

157148
RinexMod takes RINEX files (v2 or v3/4, compressed or not), rename them and modifiy their headers, and write them back to a destination directory
158149

@@ -195,7 +186,7 @@ optional arguments:
195186
-fs, --force_sitelog If a single sitelog is provided, force sitelog-based header values when RINEX's header and sitelog site name do not correspond.
196187
If several sitelogs are provided, skip badly-formated sitelogs.
197188
-fc, --force_fake_coords
198-
When using GAMIT station.info metadata without apriori coordinates in the L-File, gives fake coordinates at (0°,0°) to the site
189+
When using GAMIT station.info metadata without apriori coordinates in the L-File, gives fake coordinates at (0??,0??) to the site
199190
-fr, --force_rnx_load
200191
Force the loading of the input RINEX. Useful if its name is not standard
201192
-ig, --ignore Ignore firmware changes between instrumentation periods when getting header values info from sitelogs
@@ -229,10 +220,10 @@ RinexMod 3.3.0 - GNU Public Licence v3 - P. Sakic et al. - IPGP-OVS - https://gi
229220
### Examples
230221
231222
```
232-
./rinexmod.py -i RINEXLIST -o OUTPUTFOLDER (-k antenna_type='ANT TYPE' antenna_X_pos=9999 agency=AGN) (-m AGAL) (-r ./ROOTFOLDER/) (-f) (-v)
223+
./rinexmod_run -i RINEXLIST -o OUTPUTFOLDER (-k antenna_type='ANT TYPE' antenna_X_pos=9999 agency=AGN) (-m AGAL) (-r ./ROOTFOLDER/) (-f) (-v)
233224
```
234225
```
235-
./rinexmod.py (-a) -i RINEXFILE -o OUTPUTFOLDER (-s ./sitelogsfolder/stationsitelog.log) (-i) (-w) (-o ./LOGFOLDER) (-v)
226+
./rinexmod_run (-a) -i RINEXFILE -o OUTPUTFOLDER (-s ./sitelogsfolder/stationsitelog.log) (-i) (-w) (-o ./LOGFOLDER) (-v)
236227
```
237228
238229
## _rinexmod_ in API mode
@@ -373,7 +364,7 @@ rimo_api.rinexmod(rinexfile, outputfolder, sitelog=None, modif_kw=dict(), marker
373364
position and DOMES information (needs also station_info option)
374365
force_fake_coords: bool, optional
375366
When using GAMIT station.info metadata without apriori coordinates
376-
in the L-File, gives fake coordinates at (0°,0°) to the site
367+
in the L-File, gives fake coordinates at (0??,0??) to the site
377368
remove: bool, optional
378369
Remove input RINEX file if the output RINEX is correctly written
379370
The default is False.
@@ -397,17 +388,17 @@ rimo_api.rinexmod(rinexfile, outputfolder, sitelog=None, modif_kw=dict(), marker
397388
```
398389
## Other command line functions
399390
400-
### crzmeta.py
391+
### crzmeta
401392
402393
Extract metadata from crz file.
403394
404395
With -p option, will plot the file's samples intervals
405396
```
406397
EXAMPLE:
407-
./crzmeta.py RINEXFILE (-p)
398+
./crzmeta RINEXFILE (-p)
408399
```
409400
410-
### get_m3g_sitelogs.py
401+
### get_m3g_sitelogs
411402
412403
This script will get the last version of sitelogs from M3G repository and write them
413404
in an observatory dependent subfolder set in 'observatories'.
@@ -425,7 +416,7 @@ OPTION :
425416

426417
EXAMPLE:
427418

428-
./get_m3g_sitelogs.py OUTPUTFOLDER (-d)
419+
./get_m3g_sitelogs OUTPUTFOLDER (-d)
429420
```
430421
431422
## _rinexmod_ error messages

changelog.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
## Changelog
22

3+
### v3.4.0 (Dec, 2024)
4+
5+
- shell programs are now in a `bin` folder and are set as executable in the `setup.py`
6+
- **the frontend command line interface program has been renamed `rinexmod_run.py` to avoid conflict with the module name**
7+
- add `shortname` option to force RINEX file renaming with short name convention, and modify `longname` option to force RINEX file renaming with long name convention
8+
(Behavior of previous `longname` option was ambiguous.)
9+
`shortname` is mutually exclusive with `longname`.
10+
11+
### v3.3.0 (Sep 4, 2024)
12+
13+
* `--tolerant_file_period/-tol` is replaced by a more flexible --filename_style/-fns option.
14+
* it takes now one string argument with 3 acceptable values: 'basic' (per default), 'flex', and 'exact'.
15+
see help for more details
16+
* misc. improvements and bug corrections
17+
18+
### v3.2.0 (Aug 15, 2024)
19+
20+
Misc improvements:
21+
22+
* Enhanced log messages
23+
* Some exception handling when reading RINEX
24+
* RINEX version attribute is now also float
25+
* you can now remove your input RINEXs with -rm, but be carful of what you are doing!
26+
27+
28+
### v3.1.0 (Jun 5, 2024)
29+
30+
make rinexmod compliant with IGSMAIL-8458, i.e. nine characters site in sitelogs, and Country or Region field instead of Country.
31+
332
### v3.0.0 (Mar 15, 2024)
433

534
- **important user interface change**

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
colorlog
22
pandas
33
hatanaka
4-
matplotlib
4+
#matplotlib
55
numpy
66
requests
77
setuptools

rinexmod/bin/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on 21/09/2024 20:30:36
5+
6+
@author: psakic
7+
"""

rinexmod/bin/misc_tools/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on 21/09/2024 20:30:36
5+
6+
@author: psakic
7+
"""

misc_tools/crzmeta.py rinexmod/bin/misc_tools/crzmeta.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def crzmeta(rinexfile, plot):
5454
return
5555

5656

57-
if __name__ == '__main__':
58-
57+
def main():
5958
import argparse
6059

6160
# Parsing Args
@@ -68,3 +67,6 @@ def crzmeta(rinexfile, plot):
6867
plot = args.plot
6968

7069
crzmeta(rinexfile, plot)
70+
71+
if __name__ == '__main__':
72+
main()

misc_tools/get_m3g_sitelogs.py rinexmod/bin/misc_tools/get_m3g_sitelogs.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747

4848
import rinexmod.get_m3g
4949

50-
if __name__ == "__main__":
51-
50+
def main():
5251
import argparse
5352

5453
# Parsing Args
@@ -123,3 +122,6 @@
123122
rinexmod.get_m3g.get_m3g_sitelogs(
124123
sitelogsfolder, delete, observatory, root, svn, move_folder, force, exclude
125124
)
125+
126+
if __name__ == '__main__':
127+
main()

misc_tools/rinexrename.py rinexmod/bin/misc_tools/rinexrename.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def rinexrename(rinexinput, output=None, delete=False, alone=False, country="00X
5858
return Output_path_list
5959

6060

61-
if __name__ == '__main__':
62-
61+
def main():
6362
import argparse
6463

6564

@@ -80,3 +79,6 @@ def rinexrename(rinexinput, output=None, delete=False, alone=False, country="00X
8079
country = args.country
8180

8281
rinexrename(rinexinput, output, delete, alone, country)
82+
83+
if __name__ == '__main__':
84+
main()

rinexmod.py rinexmod/bin/rinexmod_run.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@
1616
import argparse
1717
import textwrap
1818

19-
import textwrap
20-
21-
2219
import rinexmod
2320
import rinexmod.rinexmod_api as rimo_api
2421

2522
from argparse import RawTextHelpFormatter
2623

27-
if __name__ == "__main__":
24+
def main():
2825

2926
class SmartFormatter(argparse.HelpFormatter):
3027
# source: https://stackoverflow.com/a/22157136/3464212

rinexmod/rinexfile.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515
import hatanaka
16-
import matplotlib.pyplot as plt
16+
#import matplotlib.pyplot as plt
1717
import numpy as np
1818

1919
import rinexmod.logger as rimo_log
@@ -675,14 +675,14 @@ def _get_date_patterns(self):
675675
# Pattern of an observation line containing a date - RINEX 3
676676
# date_pattern = re.compile('> (\d{4}) (\d{2}) (\d{2}) (\d{2}) (\d{2}) ((?: |\d)\d.\d{4})')
677677
date_pattern = re.compile(
678-
"> (\d{4}) (\d{2}| \d) (\d{2}| \d) (\d{2}| \d) (\d{2}| \d) ((?: |\d)\d.\d{4})"
678+
r"> (\d{4}) (\d{2}| \d) (\d{2}| \d) (\d{2}| \d) (\d{2}| \d) ((?: |\d)\d.\d{4})"
679679
)
680680
year_prefix = "" # Prefix of year for date formatting
681681

682682
elif self.version_float < 3:
683683
# Pattern of an observation line containing a date - RINEX 2
684684
date_pattern = re.compile(
685-
" (\d{2}) ((?: |\d)\d{1}) ((?: |\d)\d{1}) ((?: |\d)\d{1}) ((?: |\d)\d{1}) ((?: |\d)\d{1}.\d{4})"
685+
r" (\d{2}) ((?: |\d)\d{1}) ((?: |\d)\d{1}) ((?: |\d)\d{1}) ((?: |\d)\d{1}) ((?: |\d)\d{1}.\d{4})"
686686
)
687687
year_prefix = "20" # Prefix of year for date formatting
688688
### !!!!!!!!! before 2000 must be implemented !!!!!!
@@ -881,7 +881,9 @@ def _date_conv(sample):
881881

882882
non_nominal_interval_percent = num_bad_sp / len(samples_rate_diff)
883883

884+
plot = False
884885
if plot:
886+
import matplotlib.pyplot as plt
885887
print(
886888
"{:29} : {}".format(
887889
"Sample intervals not nominals",
@@ -2164,13 +2166,13 @@ def regex_pattern_rinex_filename():
21642166
pattern_dic = dict()
21652167
# pattern_dic["shortname"] = "....[0-9]{3}(\d|\D)\.[0-9]{2}(o|d)(|\.(Z|gz))"
21662168
pattern_dic["shortname"] = (
2167-
"....[0-9]{3}(\d|\D)([0-9]{2}\.|\.)[0-9]{2}(o|d)(|\.(Z|gz))" ### add subhour starting min
2169+
r"....[0-9]{3}(\d|\D)([0-9]{2}\.|\.)[0-9]{2}(o|d)(|\.(Z|gz))" ### add subhour starting min
21682170
)
21692171
pattern_dic["longname"] = (
2170-
".{4}[0-9]{2}.{3}_(R|S|U)_[0-9]{11}_([0-9]{2}\w)_[0-9]{2}\w_\w{2}\.\w{3}(\.gz|)"
2172+
r".{4}[0-9]{2}.{3}_(R|S|U)_[0-9]{11}_([0-9]{2}\w)_[0-9]{2}\w_\w{2}\.\w{3}(\.gz|)"
21712173
)
21722174
pattern_dic["longname_gfz"] = (
2173-
".{4}[0-9]{2}.{3}_[0-9]{8}_.{3}_.{3}_.{2}_[0-9]{8}_[0-9]{6}_[0-9]{2}\w_[0-9]{2}\w_[A-Z]*\.\w{3}(\.gz)?"
2175+
r".{4}[0-9]{2}.{3}_[0-9]{8}_.{3}_.{3}_.{2}_[0-9]{8}_[0-9]{6}_[0-9]{2}\w_[0-9]{2}\w_[A-Z]*\.\w{3}(\.gz)?"
21742176
)
21752177

21762178
return pattern_dic

0 commit comments

Comments
 (0)