Synthèse 2025

This commit is contained in:
Alex38Lyon
2026-01-07 21:08:15 +01:00
parent ce332fd020
commit cc6b472720
56 changed files with 220276 additions and 186057 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
"""
#############################################################################################
!#############################################################################################
# #
# general_fonctions.py for pyCreateTh.py #
# #
#############################################################################################
!#############################################################################################
Alex 2025 06 09
"""
+31 -9
View File
@@ -1,7 +1,9 @@
"""
#############################################################################################
!#############################################################################################!
global_data.py for pyCreateTh.py
#############################################################################################
!#############################################################################################!
"""
Version = "2026.01.07"
@@ -37,12 +39,31 @@ parse_tro_files_by_explo = True
#################################################################################################
THERION_KEYWORDS = {
"centerline", "end centerline",
"date", "units", "flags", "team",
"calibrate", "data", "declination",
"fix", "station", "equate",
"cs", "extend", "infer",
"instrument", "grade", "clino", "compass", "length", "reverse", "topofil", "duplicate", "not",
"centerline",
"endcenterline",
"date",
"units",
"flags",
"team",
"calibrate",
"data",
"declination",
"fix",
"station",
"equate",
"cs",
"extend",
"infer",
"explo-team",
"instrument",
"grade",
"clino",
"compass",
"length",
"reverse",
"topofil",
"duplicate",
"not",
}
#################################################################################################
@@ -153,7 +174,8 @@ endscrap
#################################################################################################
datumToEPSG = {
# Datums globaux
"wgs84": "326", # UTM Nord (WGS84) - EPSG:326XX
"wgs84": "326", # UTM Nord (WGS84) - EPSG:326XX
"wgs1984": "326", # UTM Nord (WGS84) - EPSG:326XX
"etrs89": "258", # UTM Nord (ETRS89) - Europe
# Datums européens
@@ -190,12 +190,21 @@ def writecenterlineheader(file, entrance, settings, comments, data, coordsyst, c
elif thlang == u'en':
file.write(u'\t\t# If date is used, comment the ligne "declination", '
u'the date will be use to compute it\n')
file.write(u'\t\tdeclination %s %s \n'% (str(settings[5]), angleU[settings[2]]))
# file.write(u'\t\t\tteam "G.S. Vulcain" \n')
if str(settings[9]) == "":
file.write(u'\t\tdeclination %s %s \n'% (str(settings[5]), angleU[settings[2]]))
else :
file.write(u'\t\t# declination %s %s \n'% (str(settings[5]), angleU[settings[2]]))
# file.write(u'\t\t\tteam "G.S. Vulcain" \n')
file.write(u'\t\t# team "%s" \n' % club)
file.write(u'\t\t#explo-date %s\n'% str(settings[9]))
file.write(u'\t\t# explo-date %s\n'% str(settings[9]))
# file.write(u'\t\t\texplo-team "G.S. Vulcain" \n')
file.write(u'\t\t# explo-team "%s" \n' % club)
if club.count(' ') >= 2:
_club = club.replace(' ', '/', 1)
else :
_club = club
file.write(u'\t\texplo-team "%s" \n' % _club)
if icomments:
if thlang == u'en': file.write(u'\t\t# (to be completed, add many lines as you need) \n')
elif thlang == u'fr': file.write(u'\t\t# (peut être complété en ajoutant le nombre de lignes nécessaires) \n')
+5 -7
View File
@@ -16,6 +16,7 @@
TODOS : -....
"""
#################################################################################################
@@ -29,18 +30,15 @@ import pandas as pd
pd.set_option('future.no_silent_downcasting', True)
from datetime import datetime
from collections import defaultdict
from copy import deepcopy
from alive_progress import alive_bar # https://github.com/rsalmei/alive-progress
from contextlib import redirect_stdout
from Lib.survey import SurveyLoader, NoSurveysFoundException
from Lib.therion import compile_template, compile_file, get_stats_from_log
from Lib.general_fonctions import setup_logger, Colors, safe_relpath, colored_help
from Lib.general_fonctions import load_config, select_file_tk_window, release_log_file, sanitize_filename
from Lib.general_fonctions import copy_template_if_not_exists, add_copyright_header, copy_file_with_copyright, update_template_files, load_text_file_utf8
from Lib.general_fonctions import Colors, safe_relpath
from Lib.general_fonctions import sanitize_filename
from Lib.general_fonctions import copy_template_if_not_exists, copy_file_with_copyright, update_template_files, load_text_file_utf8
import Lib.global_data as globalData
from Lib.pytro2th.tro2th import convert_tro #Version local modifiée
from Lib.trox2th import analyse_xml_balises
log = logging.getLogger("Logger")
+4 -2
View File
@@ -1,7 +1,9 @@
"""
#############################################################################################
!#############################################################################################
therion.py for pyCreateTh.py
#############################################################################################
!#############################################################################################
"""
import tempfile, shutil, os, re, logging, threading, subprocess, time
+23 -12
View File
@@ -1,6 +1,6 @@
"""
#############################################################################################
!############################################################################################
# #
# Script pour convertir des données topographiques des formats #
# .th de Therion (brut, sans les dossiers) #
@@ -15,7 +15,7 @@
# Usage : python pyCreateTh.py #
# Commandes : pyCreateTh.py --help #
# #
#############################################################################################
!############################################################################################
Merci à :
- Tanguy Racine pour les scripts https://github.com/tr1813
@@ -32,13 +32,12 @@ Création Alex le 2025 06 09
En cours :
- Exports Tro :
- Pas possible de gérer les fichiers tro avec plusieurs entrées / points fixes car pas sauvegardé dans le format tro
- gérer les déclinaison si une date est présente et si une coordonnées
- gérer pour ne pas avoir de copie de config.ini
- gérer "# explo-team"
- modifier les coordonnées de km vers m
- Exports TroX
- A créer pour avoir notamment les réseaux à plusieurs entrées
- Exports DAT/MARK
- gérer Flags '# #|LP#' not implemented in therion
- Attention les Flags '#|L#' posent problèmes (A voir convertisseur PdB vers compass...)
- tester avec les dernières option de la version de DAT (CORRECTION2 et suivants)
- améliorer fonction wall shot pour faire habillage des th2 files, les jointures...
- traiter les series avec 1 ou 2 stations
@@ -714,14 +713,15 @@ def formated_station_list(df, dataFormat, unit = "meter", shortCurentFile ="None
# Si la colonne 10 contient #|L# Exclude from Length
if "#|L#" in col10:
surface_row = [" "] * len(row)
surface_row[0] = "flags surface"
surface_row[0] = "flags duplicate"
new_rows.append(surface_row)
new_rows.append(row.tolist())
not_surface_row = [" "] * len(row)
not_surface_row[0] = "flags not surface"
not_surface_row[0] = "flags not duplicate"
new_rows.append(not_surface_row)
log.warning(f"Flags '{Colors.ENDC}{col10}{Colors.WARNING}' not implemented in therion, line {Colors.ENDC}{idx+1}{Colors.WARNING} in {Colors.ENDC}{shortCurentFile}")
# Si la colonne 10 contient #|S# type Spay (habillages)
elif "#|S#" in col10:
@@ -730,6 +730,8 @@ def formated_station_list(df, dataFormat, unit = "meter", shortCurentFile ="None
new_rows.append(surface_row)
new_rows.append(row.tolist())
row[1] = "-"
not_surface_row = [" "] * len(row)
not_surface_row[0] = "flags not splay"
@@ -774,18 +776,20 @@ def formated_station_list(df, dataFormat, unit = "meter", shortCurentFile ="None
new_rows.append(not_surface_row)
log.warning(f"Flags #|C# exclude from closure not implemented in therion, line {Colors.ENDC}{idx+1}{Colors.WARNING} in {Colors.ENDC}{shortCurentFile}")
# Si la colonne 10 contient #|PL# exclude from plotting and Length i.e splay
# Si la colonne 10 contient #|PL# exclude from plotting and Length ( i.e converti en splay)
elif "#|PL#" in col10 or "#|LP#" in col10:
surface_row = [" "] * len(row)
surface_row[0] = "flags duplicate"
surface_row[0] = "flags splay"
new_rows.append(surface_row)
new_rows.append(row.tolist())
row[1] = "-"
not_surface_row = [" "] * len(row)
not_surface_row[0] = "flags not duplicate"
not_surface_row[0] = "flags not splay"
new_rows.append(not_surface_row)
log.warning(f"Flags '{Colors.ENDC}{col10}{Colors.WARNING}' not implemented in therion, line {Colors.ENDC}{idx+1}{Colors.WARNING} in {Colors.ENDC}{shortCurentFile}")
# log.warning(f"Flags '{Colors.ENDC}{col10}{Colors.WARNING}' not implemented in therion, line {Colors.ENDC}{idx+1}{Colors.WARNING} in {Colors.ENDC}{shortCurentFile}")
# Si la colonne 10 contient #|LC# exclude from Length and Closure
elif "#|LC#" in col10 or "#|CL#" in col10:
@@ -1543,6 +1547,10 @@ def tro_to_th_files(ENTRY_FILE, centerlines = [],
}
DEST_PATH = os.path.dirname(ENTRY_FILE) + '/' + SurveyTitle
# from pprint import pprint
# pprint(config_vars, width=120, depth=2)
update_template_files(DEST_PATH + '/template.thconfig', config_vars, DEST_PATH + '/' + SurveyTitle + '.thconfig')
update_template_files(DEST_PATH + '/template-tot.th', config_vars, DEST_PATH + '/' + SurveyTitle + '-tot.th')
@@ -1715,7 +1723,10 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "",
line.strip()
elif NextLineSurveyTeam == True :
NextLineSurveyTeam = False
section_data['SURVEY_TEAM'] = line.strip()
val = line.strip()
if val.count(' ') >= 2:
val = val.replace(' ', '/', 1)
section_data['SURVEY_TEAM'] = val
elif line.startswith('DECLINATION:'):
for champ, pattern in regex_patterns.items():
match = re.search(pattern, line)