Skip to content

Commit 3a41322

Browse files
Merge pull request #107 from IPGP/dev-vdg-sakic_04a
Dev vdg sakic 04a
2 parents 353c59a + 0ef8237 commit 3a41322

15 files changed

+251
-467
lines changed

README.md

+2-23
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# autorino
44
autorino is a tool for _Assisted Unloading, Treatment & Organisation of RINex Observations_ 🛰️ 🌐 🦏
55

6-
**Version: 1.1.0**
7-
**Date: 2025-01-30**
6+
**Version: 1.2.0**
7+
**Date: 2025-03-08**
88

99
**Authors & Contributors:**
1010
* [Pierre Sakic](https://github.com/PierreS-alpha) (IPGP-OVS, Paris, France)
@@ -50,7 +50,6 @@ For developpers, you can install _autorino_ in [developement mode](https://setup
5050
pip install -e .
5151
```
5252

53-
5453
### Setting up the environment
5554

5655
You need to set up the environment variable `$AUTORINO_ENV` to point to the _autorino_'s configuration file.
@@ -64,26 +63,6 @@ This configuration file is a YAML file that contains the paths to the different
6463
If `$AUTORINO_ENV` is not set, _autorino_ will use the default configuration file located in the package's `configfiles/env/` folder.
6564
Per defaults values assume that the converter executables are known by your system and (e.g. set in your `$PATH`).
6665

67-
68-
### Advenced user installation (legacy style)
69-
70-
You can install _autorino_ package by adding its path of to your `$PYTHONPATH` in your _.bashrc_.
71-
```bash
72-
PYTHONPATH=$PYTHONPATH:/home/user/path_to/autorino
73-
```
74-
If you want to use _autorino_ in CLI mode, you must also add the path to the _autorino_ script to your `$PATH` in your _.bashrc_.
75-
```bash
76-
$PATH=$PATH:/home/user/path_to/autorino/autorino
77-
```
78-
Note that it is `autorino/autorino` two times, since the CLI programs are inside the _autorino_'s module.
79-
80-
_autorino_ relies on several external dependencies. Be sure to have them installed on your system using
81-
```
82-
pip install -r /home/user/path_to/autorino/requirements.txt
83-
```
84-
85-
And then set up the environment variable `$AUTORINO_ENV` as described above.
86-
8766
## External utilities (GNSS converters)
8867

8968
### Download external utilities

autorino/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
from os import path
88

9-
__version__='1.1.0' # changed automaticcaly with bump-my-version
9+
__version__='1.2.0' # changed automaticcaly with bump-my-version
1010

1111
#### IMPORT CONFIG FOR LOGGER
1212
log_file_path = os.path.join(

autorino/bin/autorino_convert_rnx.py

+6
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ def main():
109109

110110
args = parser.parse_args()
111111

112+
if args.list_file_input:
113+
with open(args.raws_inp[0], "r") as f:
114+
raws_inp = f.read().splitlines()
115+
else:
116+
raws_inp = args.raws_inp
117+
112118
aroapi.convert_rnx(
113119
inp_raws=_prep_raws_inp(args),
114120
out_dir=args.out_dir,

autorino/cfgfiles/cfgfile_read.py

+84-12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import autorino.handle as arohdl
2020

2121
from rinexmod import rinexmod_api
22+
from rinexmod import metadata as rimo_mda
23+
24+
import datetime as dt
2225

2326
# import autorino.session as aroses
2427
# import autorino.epochrange as aroepo
@@ -96,6 +99,11 @@ def read_cfg(configfile_path, epoch_range=None, main_cfg_path=None):
9699
else:
97100
y_main = None
98101

102+
if not y_main and check_from_main(y):
103+
errmsg="FROM_MAIN keyword used in cfg file, but no main cfg file provided (-m option)"
104+
logger.error(errmsg)
105+
raise FileNotFoundError(None, errmsg)
106+
99107
y = update_w_main_dic(y, y_main)
100108

101109
print_cfg_for_debug = False
@@ -110,7 +118,6 @@ def read_cfg(configfile_path, epoch_range=None, main_cfg_path=None):
110118

111119
return steps_lis_lis, steps_dic_dic, y_station
112120

113-
114121
def read_cfg_sessions(y_sessions_dict, epoch_range_inp=None, y_station=None):
115122
"""
116123
Reads and interprets session configurations from a dictionary
@@ -139,7 +146,9 @@ def read_cfg_sessions(y_sessions_dict, epoch_range_inp=None, y_station=None):
139146
"""
140147

141148
# ++++ METADATA
142-
if y_station["site"]["sitelog_path"]:
149+
# Load as sitelog
150+
151+
if y_station["device"]["attributes_from_sitelog"]:
143152
slpath = y_station["site"]["sitelog_path"]
144153
if os.path.isdir(slpath) or os.path.isfile(slpath):
145154
# Load the metadata if the path is a directory or a file
@@ -148,9 +157,9 @@ def read_cfg_sessions(y_sessions_dict, epoch_range_inp=None, y_station=None):
148157
# If not, consider it as a string
149158
# (because the path might be translated later in the object)
150159
metadata = slpath
160+
# Load as devie block
151161
else:
152-
###### MUST BE IMPLEMENTED WITH MANUAL VALUES
153-
metadata = None
162+
metadata = _device2mda(y_station)
154163

155164
steps_lis_lis = []
156165
steps_dic_dic = {}
@@ -206,12 +215,8 @@ def read_cfg_sessions(y_sessions_dict, epoch_range_inp=None, y_station=None):
206215
if "inp_file_regex" in y_stp.keys():
207216
inp_file_regex = y_stp["inp_file_regex"]
208217
else:
209-
logger.warning(
210-
"Compatibility Warning: inp_file_regex not defined in the cfg files, set to .*"
211-
)
212-
logger.warning(
213-
"Compatibility Warning: you should upgrade your config file to >v15"
214-
)
218+
logger.warning("Compatibility! inp_file_regex not defined in cfg files")
219+
logger.warning("upgrade your config file to >v15, set to .* for now")
215220
inp_file_regex = ".*"
216221

217222
kwargs_for_step = {
@@ -298,7 +303,7 @@ def _check_parent_dir_exist(parent_dir, parent_dir_key=None):
298303
parent_dir_key = "a directory"
299304

300305
logger.error(
301-
"%s is not correctly defined in the main cfgfiles file"
306+
"%s is not correctly defined in the main cfgfiles file "
302307
"(FROM_MAIN can not be replaced)",
303308
parent_dir_key,
304309
)
@@ -405,6 +410,48 @@ def _get_dir_path(y_step, dir_type="out", check_parent_dir_exist=True):
405410
return dir_path, dir_parent, structure
406411

407412

413+
def _device2mda(y_station):
414+
"""
415+
Convert a device block from a configuration file to a MetaData object.
416+
"""
417+
y_dev = y_station["device"]
418+
y_sit = y_station['site']
419+
420+
metadata = rimo_mda.MetaData()
421+
rec_dic = dict()
422+
if y_dev["rec_type"]:
423+
rec_dic["Receiver Type"] = y_dev["rec_type"]
424+
if y_dev["rec_sn"]:
425+
rec_dic["Serial Number"] = y_dev["rec_sn"]
426+
if y_dev["rec_fw"]:
427+
rec_dic["Firmware Version"] = y_dev["rec_fw"]
428+
429+
ant_dic = dict()
430+
if y_dev["ant_type"]:
431+
ant_dic["Antenna Type"] = y_dev["ant_type"]
432+
if y_dev["ant_sn"]:
433+
ant_dic["Serial Number"] = y_dev["ant_sn"]
434+
435+
if y_dev["ecc_une"]:
436+
ant_dic["Marker->ARP Up Ecc. (m)"] = y_dev["ecc_une"][0]
437+
ant_dic["Marker->ARP North Ecc(m)"] = y_dev["ecc_une"][1]
438+
ant_dic["Marker->ARP East Ecc(m)"] = y_dev["ecc_une"][2]
439+
440+
metadata.add_instru(rec_dic, ant_dic)
441+
442+
metadata.set_meta(site_id=y_sit['site_id'],
443+
domes=y_sit['domes'],
444+
operator=y_sit['operator'],
445+
x=y_sit["position_xyz"][0],
446+
y=y_sit["position_xyz"][1],
447+
z=y_sit["position_xyz"][2],
448+
country=y_sit["country"],
449+
date_prepared=dt.datetime.now(),
450+
agency=y_sit["agency"])
451+
452+
return metadata
453+
454+
408455
def format_dir_path(dir_parent, structure):
409456
"""
410457
Formats a directory path by adding or removing a leading slash.
@@ -426,6 +473,30 @@ def format_dir_path(dir_parent, structure):
426473

427474
return dir_parent, structure
428475

476+
def check_from_main(y):
477+
"""
478+
Check if the FROM_MAIN keyword is used in the configuration file.
479+
480+
This function takes a dictionary representing the configuration file.
481+
It checks if the 'FROM_MAIN' keyword is used in the configuration file.
482+
If it is, it returns True. Otherwise, it returns False.
483+
484+
Parameters
485+
----------
486+
y : dict
487+
A dictionary representing the configuration file.
488+
489+
Returns
490+
-------
491+
bool
492+
True if the 'FROM_MAIN' keyword is used in the configuration file.
493+
False otherwise.
494+
"""
495+
if "FROM_MAIN" in str(y):
496+
return True
497+
else:
498+
return False
499+
429500

430501
def update_w_main_dic(d, u=None, specific_value="FROM_MAIN"):
431502
"""
@@ -476,7 +547,8 @@ def run_steps(
476547
It is the opposite behavior of the regular one using steps_select_list
477548
Default is False.
478549
verbose : bool, optional
479-
A flag indicating whether to print the tables during the execution of the steps. Default is True.
550+
A flag indicating whether to print the tables during the execution of the steps.
551+
Default is True.
480552
force : bool, optional
481553
A flag indicating whether to force the execution of the steps.
482554
overrides the 'force' parameters in the configuration file.

configfiles/env/autorino_env_PS1a.yml

-13
This file was deleted.
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
conv_software_paths:
2+
convbin : "convbin" #RTKLIB converter
3+
mdb2rinex : "mdb2rinex" # Leica
4+
sbf2rin : "sbf2rin" # Septentrio
5+
tps2rin : "tps2rin.exe" # Topcon
6+
### Trimble
7+
t0xconvert : "t0xConvert" # Trimble official
8+
trm2rinex : "trm2rinex:cli-light" # Trimble unofficial docker
9+
runpkr00 : "runpkr00" # Trimble legacy
10+
### RINEX handeling
11+
converto : "ConvertoCPP"
12+
gfzrnx : "gfzrnx"
13+
teqc : "teqc"
14+
general:
15+
log_level: "DEBUG"
16+
trimble_default_software: "trm2rinex" # name of the Trimble converter key in the conv_software_paths above
17+

configfiles/main/autorino_main_cfg_01a.yml

-85
This file was deleted.

0 commit comments

Comments
 (0)