pyCreateTh

This commit is contained in:
Alex38Lyon
2025-06-19 07:16:16 +02:00
parent ef55235a11
commit 7fb026c131
19 changed files with 1134 additions and 1097 deletions
+1 -1
View File
@@ -11,5 +11,5 @@ xth_cp_map_tree_insert map 1 948X1 p2 1 MC-Z510-coupe-tot MC-Z510-coupe-tot@Z510
xth_cp_map_tree_create xth_cp_map_tree_create
xth_cp_comp_stat 742 14 xth_cp_comp_stat 742 14
set xth(th_exit_state) 1 set xth(th_exit_state) 1
set xth(th_exit_number) 1746719589 set xth(th_exit_number) 1750235501
Binary file not shown.
+5 -41
View File
@@ -20,8 +20,8 @@ searching for centerline loops ... done
calculating station coordinates ... done calculating station coordinates ... done
processing survey data ... processing survey data ...
####################### cavern log file ######################## ####################### cavern log file ########################
1> Survex 1.4.15 1> Survex 1.4.17
2> Copyright ¸ 1990-2024 Olly Betts 2> Copyright ¸ 1990-2025 Olly Betts
3> 3>
4> La topographie contient 574 stations, connectes par 573 vises. 4> La topographie contient 574 stations, connectes par 573 vises.
5> Il y a 0 bouclages. 5> Il y a 0 bouclages.
@@ -31,48 +31,12 @@ processing survey data ...
9> Intervalle vertical = 238.38m (de 34 … 1644.00m jusqu'… 223 … 1405.62m) 9> Intervalle vertical = 238.38m (de 34 … 1644.00m jusqu'… 223 … 1405.62m)
10> Intervalle Nord-Sud = 70.50m (de 34 … 4758093.00m jusqu'… 293 … 4758022.50m) 10> Intervalle Nord-Sud = 70.50m (de 34 … 4758093.00m jusqu'… 293 … 4758022.50m)
11> Intervalle Est-Ouest = 60.84m (de 40 … 679299.28m jusqu'… 293 … 679238.44m) 11> Intervalle Est-Ouest = 60.84m (de 40 … 679299.28m jusqu'… 293 … 679238.44m)
12> 425 1-noeuds. 12>
13> 79 2-noeuds.
14> 9 3-noeuds.
15> 1 4-noeud.
16> 5 5-noeuds.
17> 29 6-noeuds.
18> 1 7-noeud.
19> 1 9-noeud.
20> 3 10-noeuds.
21> 4 11-noeuds.
22> 3 12-noeuds.
23> 5 13-noeuds.
24> 3 14-noeuds.
25> 2 15-noeuds.
26> 1 16-noeud.
27> 1 17-noeud.
28> 1 18-noeud.
29> 1 19-noeud.
30>
######################### transcription ######################## ######################### transcription ########################
4> 574 : .@Z510.Z510 -- 573 : 2024.23@Z510.Z510 4> 574 : .@Z510.Z510 -- 573 : 2024.23@Z510.Z510
9> 34 : Z_510@Z510.Z510 -- 223 : .@Z510.Z510 9> 34 : Z_510@Z510.Z510 -- 223 : .@Z510.Z510
10> 34 : Z_510@Z510.Z510 -- 293 : .@Z510.Z510 10> 34 : Z_510@Z510.Z510 -- 293 : .@Z510.Z510
11> 40 : 8.2@Z510.Z510 -- 293 : .@Z510.Z510 11> 40 : 8.2@Z510.Z510 -- 293 : .@Z510.Z510
12> 425 : .@Z510.Z510
13> 79 : 10.3@Z510.Z510
14> 9 : 4.2@Z510.Z510
15> 1 : 0@Z510.Z510
16> 5 : 3.0@Z510.Z510
17> 29 : 1.9@Z510.Z510
18> 1 : 0@Z510.Z510
19> 1 : 0@Z510.Z510
20> 3 : 2.0@Z510.Z510
21> 4 : 2.1@Z510.Z510
22> 3 : 2.0@Z510.Z510
23> 5 : 3.0@Z510.Z510
24> 3 : 2.0@Z510.Z510
25> 2 : 0d@Z510.Z510
26> 1 : 0@Z510.Z510
27> 1 : 0@Z510.Z510
28> 1 : 0@Z510.Z510
29> 1 : 0@Z510.Z510
#################### end of cavern log file #################### #################### end of cavern log file ####################
done done
calculating basic statistics ... done calculating basic statistics ... done
@@ -91,7 +55,7 @@ processing projection extended ... done
average distortion: 0.02% average distortion: 0.02%
done done
####################### metapost log file ######################## ####################### metapost log file ########################
This is MetaPost, version 2.01 (TeX Live 2021/W32TeX) (kpathsea version 6.3.3) 8 MAY 2025 17:53 This is MetaPost, version 2.01 (TeX Live 2021/W32TeX) (kpathsea version 6.3.3) 18 JUN 2025 10:31
**data.mp **data.mp
(c:/Program Files/Therion/texmf/mpost/mpost.mp (c:/Program Files/Therion/texmf/mpost/mpost.mp
(c:/Program Files/Therion/texmf/mpost/plain.mp (c:/Program Files/Therion/texmf/mpost/plain.mp
@@ -113,7 +77,7 @@ writing Outputs/Z510-Surveys.kml ...
C:\Program Files\Therion\therion.exe: warning -- geographical reference is not associated with table C:\Program Files\Therion\therion.exe: warning -- geographical reference is not associated with table
done done
writing xtherion file ... done writing xtherion file ... done
compilation time: 1 sec compilation time: 0 sec
###################### scrap distortions ####################### ###################### scrap distortions #######################
+26
View File
@@ -63,3 +63,29 @@
2025-06-16 21:47:56,152 - INFO - ******************************************************************************************************************************************** 2025-06-16 21:47:56,152 - INFO - ********************************************************************************************************************************************
2025-06-16 21:47:56,153 - ERROR - !!! file not yet supported 2025-06-16 21:47:56,153 - ERROR - !!! file not yet supported
2025-06-16 21:47:56,154 - ERROR - !!! There were 1 errors during 3.19 secondes, check the log file ~\..\pyCreateTh.log 2025-06-16 21:47:56,154 - ERROR - !!! There were 1 errors during 3.19 secondes, check the log file ~\..\pyCreateTh.log
2025-06-17 18:45:15,108 - INFO - ********************************************************************************************************************************************
2025-06-17 18:45:15,108 - INFO - * Conversion Th, Dat, Mak files to Therion files and folders
2025-06-17 18:45:15,109 - INFO - * Script pyCreateTh by : alexandre.pont@yahoo.fr
2025-06-17 18:45:15,109 - INFO - * Version : 2025.06.17
2025-06-17 18:45:15,109 - INFO - * Input file :
2025-06-17 18:45:15,109 - INFO - * Output file : ~\.
2025-06-17 18:45:15,110 - INFO - * Log file : ~\..\pyCreateTh.log
2025-06-17 18:45:15,110 - INFO - *
2025-06-17 18:45:15,110 - INFO - *
2025-06-17 18:45:15,110 - INFO - *
2025-06-17 18:45:15,111 - INFO - ********************************************************************************************************************************************
2025-06-17 18:45:15,112 - ERROR - !!! file not yet supported
2025-06-17 18:45:15,112 - ERROR - !!! There were 1 errors during 3.06 secondes, check the log file ~\..\pyCreateTh.log
2025-06-18 21:39:26,689 - INFO - ********************************************************************************************************************************************
2025-06-18 21:39:26,689 - INFO - * Conversion Th, Dat, Mak files to Therion files and folders
2025-06-18 21:39:26,690 - INFO - * Script pyCreateTh by : alexandre.pont@yahoo.fr
2025-06-18 21:39:26,690 - INFO - * Version : 2025.06.18
2025-06-18 21:39:26,690 - INFO - * Input file :
2025-06-18 21:39:26,690 - INFO - * Output file : ~\.
2025-06-18 21:39:26,690 - INFO - * Log file : ~\..\pyCreateTh.log
2025-06-18 21:39:26,690 - INFO - *
2025-06-18 21:39:26,691 - INFO - *
2025-06-18 21:39:26,691 - INFO - *
2025-06-18 21:39:26,691 - INFO - ********************************************************************************************************************************************
2025-06-18 21:39:26,692 - ERROR - !!! file not yet supported
2025-06-18 21:39:26,692 - ERROR - !!! There were 1 errors during 32.63 secondes, check the log file ~\..\pyCreateTh.log
+3
View File
@@ -2,6 +2,7 @@
"cSpell.words": [ "cSpell.words": [
"annee", "annee",
"ansi", "ansi",
"ARSIP",
"australiangeodetic", "australiangeodetic",
"australiangeodeticdatum", "australiangeodeticdatum",
"backclino", "backclino",
@@ -14,6 +15,7 @@
"cumcount", "cumcount",
"datat", "datat",
"depmatch", "depmatch",
"depthchange",
"depthre", "depthre",
"downcasting", "downcasting",
"drawnexemptextendedre", "drawnexemptextendedre",
@@ -36,6 +38,7 @@
"Geophysicaya", "Geophysicaya",
"isin", "isin",
"Koef", "Koef",
"Larra",
"lengthre", "lengthre",
"lenmatch", "lenmatch",
"levelname", "levelname",
+137 -20
View File
@@ -1,25 +1,142 @@
## Global data for pyCreateTh.py """
#############################################################################################
global_data.py for pyCreateTh.py
#############################################################################################
"""
# # [Survey_Data] default values #################################################################################################
# Author = "Created by pyCreateTh.py"
# Copyright = "# Copyright (C) pyCreateTh.py"
# Copyright_Short = "Licence (C) pyCreateTh.py"
# map_comment = "Created by pyCreateTh.py"
# cs = "UTM30"
# club = "Therion"
# thanksto = "Therion"
# datat = "https://therion.speleo.sk/"
# wpage = "https://therion.speleo.sk/"
# ## [Application_data] default values
# template_path = "./Template"
# station_by_scrap = 20
# final_therion_exe = True
# therion_path = "C:/Therion/therion.exe"
# LINES = -1
# NAMES = -1
# configIni = "config.ini" # Default config file name
# debug_log = False # Mode debug des messages
error_count = 0 # Compteur d'erreurs error_count = 0 # Compteur d'erreurs
#################################################################################################
thFileDat = """
encoding utf-8
# File generated by pyCreateTh.py version {VERSION} date: {DATE}
survey {SURVEY_NAME} -title "{COMMENT}"
\tcenterline
\t\tdate {SURVEY_DATE}
\t\t# team "{SURVEY_TEAM}"
{FIX_POINTS}
\t\t# explo-date "{EXPLO_DATE}"
\t\t# explo-team "{EXPLO_TEAM}"
\t\tunits {LENGTH}
\t\tunits {COMPASS}
\t\tunits {CLINO}
\t\t{DATA_FORMAT}
\t#{DATA}
\tendcenterline
endsurvey
{SOURCE}
"""
#################################################################################################
thconfigTemplate = """
source "{th_file}"
layout minimal
scale 1 {scale}
endlayout
select {selector}
#export model -o "{th_name}.lox"
export map -projection plan -o "{th_name}-Plan.xvi" -layout minimal -layout-debug station-names
export map -projection extended -o "{th_name}-Extended.xvi" -layout minimal -layout-debug station-names
"""
#################################################################################################
th2FileHeader = """encoding utf-8"""
th2File = """
##XTHERION## xth_me_area_adjust {X_Min} {Y_Min} {X_Max} {Y_Max}
##XTHERION## xth_me_area_zoom_to 100
##XTHERION## xth_me_image_insert {insert_XVI}
{Copyright}
# File generated by pyCreateTh.py version {version} date: {date}
# x_min: {X_Min}, x_max: {X_Max} ecart : {X_Max_X_Min}
# y_min: {Y_Min}, y_max: {Y_Max} ecart : {Y_Max_Y_Min}
scrap S{projection_short}-{name}_01 -station-names "" "@{name}" -projection {projection} -author {year} "{author}" -copyright {year} "{Copyright_Short}"
{points}
{names}
{lines}
endscrap
"""
th2Point = """ point {x} {y} station -name {station}"""
th2Name = """ point {x} {y} station-name -align tr -scale xs -text {station}"""
th2Line = """
line u:Shot_Survey
{x1} {y1}
{x2} {y2}
endline
"""
th2Scrap = """
scrap S{projection_short}-{name}_{num:02} -station-names "" "@{name}" -projection {projection} -author {year} "{author}" -copyright {year} "{Copyright_Short}"
endscrap
"""
#################################################################################################
datumToEPSG = {
# Datums globaux
"wgs84": "326", # UTM Nord (WGS84) - EPSG:326XX
"etrs89": "258", # UTM Nord (ETRS89) - Europe
# Datums européens
"european1950": "230", # ED50 / UTM Nord - Europe
"ed50": "230",
# Datums nord-américains
"nad27": "267", # UTM Nord (NAD27) - Amérique du Nord
"northamericandatum1927": "267",
"northamerican1927": "267",
"nad83": "269", # UTM Nord (NAD83) - Amérique du Nord
"northamericandatum1983": "269",
"northamerican1983" : "269",
# Datums français
"ntf": "275", # UTM Nord (NTF) - France (Paris)
"nouvelletriangulationfrançaise": "275",
# Datums africains
"clarke1880": "297", # UTM Nord (Clarke 1880) - Afrique
# Datums australiens
"agd66": "202", # UTM Nord (AGD66) - Australie
"australiangeodeticdatum1966": "202",
"australiangeodetic1966": "202",
"agd84": "203", # UTM Nord (AGD84) - Australie
"australiangeodeticdatum1984": "203",
"australiangeodetic1984": "203",
"gda94": "283", # UTM Nord (GDA94) - Australie
"geocentricdatumofaustralia1994": "283",
"geocentricofaustralia1994": "283",
# Datums asiatiques
"pulkovo1942": "284", # UTM Nord (Pulkovo 1942) - Russie/CEI
"beijing1954": "214", # UTM Nord (Beijing 1954) - Chine
# Datums sud-américains
"sad69": "291", # UTM Nord (SAD69) - Amérique du Sud
"southamericandatum1969": "291",
"southamerican1969": "291",
"sirgas2000": "319", # UTM Nord (SIRGAS 2000) - Amérique Latine
}
+16
View File
@@ -1,8 +1,15 @@
"""
#############################################################################################
logger_config.py for pyCreateTh.py
#############################################################################################
"""
import logging import logging
import sys import sys
import re import re
#################################################################################################
# Couleurs ANSI par niveau de log # Couleurs ANSI par niveau de log
#################################################################################################
COLOR_CODES = { COLOR_CODES = {
logging.DEBUG: "\033[94m", # Bleu logging.DEBUG: "\033[94m", # Bleu
logging.INFO: "\033[92m", # Vert logging.INFO: "\033[92m", # Vert
@@ -12,19 +19,25 @@ COLOR_CODES = {
} }
RESET = "\033[0m" RESET = "\033[0m"
#################################################################################################
# Supprime les codes ANSI (pour l'écriture dans les fichiers) # Supprime les codes ANSI (pour l'écriture dans les fichiers)
#################################################################################################
def strip_ansi_codes(text): def strip_ansi_codes(text):
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
return ansi_escape.sub('', text) return ansi_escape.sub('', text)
#################################################################################################
# Formatter pour la console avec couleurs # Formatter pour la console avec couleurs
#################################################################################################
class ConsoleFormatter(logging.Formatter): class ConsoleFormatter(logging.Formatter):
def format(self, record): def format(self, record):
color = COLOR_CODES.get(record.levelno, "") color = COLOR_CODES.get(record.levelno, "")
message = super().format(record) message = super().format(record)
return f"{color}{message}{RESET}" return f"{color}{message}{RESET}"
#################################################################################################
# Formatter pour le fichier avec "!!!" sur les erreurs # Formatter pour le fichier avec "!!!" sur les erreurs
#################################################################################################
class FileFormatter(logging.Formatter): class FileFormatter(logging.Formatter):
def format(self, record): def format(self, record):
clean_msg = strip_ansi_codes(record.getMessage()) clean_msg = strip_ansi_codes(record.getMessage())
@@ -42,7 +55,10 @@ class FileFormatter(logging.Formatter):
) )
return super().format(record_copy) return super().format(record_copy)
#################################################################################################
# Fonction de configuration du logger # Fonction de configuration du logger
#################################################################################################
def setup_logger(logfile="app.log", debug_log=False): def setup_logger(logfile="app.log", debug_log=False):
logger = logging.getLogger("Logger") logger = logging.getLogger("Logger")
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
+23 -65
View File
@@ -1,3 +1,9 @@
"""
#############################################################################################
therion.py for pyCreateTh.py
#############################################################################################
"""
import tempfile import tempfile
import shutil import shutil
import os import os
@@ -48,7 +54,7 @@ def safe_relpath(path):
return valeur return valeur
except ValueError: except ValueError:
max_depth = 6 # Profondeur maximale pour tronquer le chemin max_depth = 4 # Profondeur maximale pour tronquer le chemin
# Disques différents, afficher le chemin relatif partiel depuis la racine commune # Disques différents, afficher le chemin relatif partiel depuis la racine commune
path_parts = abs_path.split(os.sep) path_parts = abs_path.split(os.sep)
@@ -103,7 +109,6 @@ def compile_templateOld(template, template_args, **kwargs):
# Compiler une configuration générée dynamiquement à partir d'un template texte. # # Compiler une configuration générée dynamiquement à partir d'un template texte. #
################################################################################################# #################################################################################################
def compile_template(template, template_args, **kwargs): def compile_template(template, template_args, **kwargs):
logfile = "" logfile = ""
tmpdir = None tmpdir = None
try: try:
@@ -117,7 +122,6 @@ def compile_template(template, template_args, **kwargs):
therion_path = kwargs.get("therion_path", "therion") therion_path = kwargs.get("therion_path", "therion")
# Écriture des fichiers config + log
with open(config_file, "w", encoding="utf-8") as tmp: with open(config_file, "w", encoding="utf-8") as tmp:
tmp.write(config) tmp.write(config)
tmp.flush() tmp.flush()
@@ -125,14 +129,15 @@ def compile_template(template, template_args, **kwargs):
# Exécution de Therion # Exécution de Therion
result = subprocess.run( result = subprocess.run(
[therion_path, config_file, "-l", log_file], [therion_path, config_file, "-l", log_file],
stdin=subprocess.DEVNULL, # Évite toute attente d'entrée clavier
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
text=True, # Décode automatiquement en UTF-8 (avec fallback ci-dessous) text=True,
timeout=kwargs.get("timeout", 30), timeout=kwargs.get("timeout", 30),
errors="replace" # Remplace caractères invalides (évite UnicodeDecodeError) errors="replace"
) )
# Lecture du log (en mode tolérant) # Lecture du fichier log
try: try:
with open(log_file, "r", encoding="cp1252", errors="replace") as f: with open(log_file, "r", encoding="cp1252", errors="replace") as f:
logfile = f.read() logfile = f.read()
@@ -140,17 +145,18 @@ def compile_template(template, template_args, **kwargs):
log.warning(f"Could not read Therion log: {Colors.ENDC}{log_err}") log.warning(f"Could not read Therion log: {Colors.ENDC}{log_err}")
# Analyse du code retour # Analyse du code retour
if result.returncode != 0: if result.returncode != 0 or "press any key" in result.stdout.lower():
log.error(f"Therion compilation failed with return code: {Colors.ENDC}{result.returncode} {Colors.ERROR}{result.stdout}") log.error(f"Therion compilation failed with return code: {Colors.ENDC}{result.returncode}\n{Colors.WHITE}{result.stdout}")
global_data.error_count += 1 global_data.error_count += 1
return "Therion error", tmpdir
else: stat = get_stats_from_log(logfile)
log.info(f"Therion compilation successful")
log.info(f"Therion compilation successful, length: {Colors.ENDC}{stat["length"]}m{Colors.INFO}, depth: {Colors.ENDC}{stat["depth"]}m")
return logfile, tmpdir return logfile, tmpdir
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
log.error(f"Therion process timed out and was terminated {Colors.ENDC}{logfile}") log.error(f"Therion process timed out and was terminated : {Colors.ENDC}{logfile}")
global_data.error_count += 1 global_data.error_count += 1
return "Therion error", tmpdir return "Therion error", tmpdir
@@ -167,53 +173,6 @@ def compile_template(template, template_args, **kwargs):
log.warning(f"Could not delete temp directory: {Colors.ENDC}{cleanup_err}") log.warning(f"Could not delete temp directory: {Colors.ENDC}{cleanup_err}")
#################################################################################################
# Compilation Therion (version avec blocage) #
# Compiler directement un fichier .th déjà existant avec Therion.
#################################################################################################
def compile_fileOld(filename, **kwargs):
try:
tmpdir = os.path.dirname(filename)
log_file = join(tmpdir, "therion.log").replace("\\", "/")
therion_path = kwargs["therion_path"] if "therion_path" in kwargs else "therion"
process = subprocess.Popen(
[therion_path, filename, "-l", log_file],
cwd=tmpdir,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, # fusion stdout + stderr
universal_newlines=True, # décodage automatique en texte
bufsize=1 # ligne par ligne
)
log.info(f"Start therion compilation file : {Colors.ENDC}{safe_relpath(filename)}")
# Lecture en temps réel
for line in process.stdout:
line = line.rstrip()
lower_line = line.lower()
if "error" in lower_line:
log.error(f" [Therion_Compile] {Colors.ENDC}{line}")
elif "warning" in lower_line:
log.warning(f" [Therion_Compile] {Colors.ENDC}{line}")
else:
log.debug(f" [Therion_Compile] {Colors.ENDC}{line}")
process.wait()
# Si la commande échoue, result.returncode sera non nul
if process.returncode != 0:
# Affichage des erreurs et de la sortie standard
log.error(f"Error during Therion compilation, stderr : \n{Colors.ENDC}{process.stderr.decode()}")
global_data.error_count += 1
log.info(f"Therion file : {Colors.ENDC}{safe_relpath(filename)}{Colors.GREEN} succeeded")
except Exception as e:
log.error(f"Therion file {Colors.ENDC}{safe_relpath(filename, os.path.expanduser('~'))}{Colors.ERROR} compilation error: {Colors.ENDC}{e}")
global_data.error_count += 1
################################################################################################# #################################################################################################
# Compilation Therion (version sans blocage) # # Compilation Therion (version sans blocage) #
################################################################################################# #################################################################################################
@@ -243,12 +202,14 @@ def compile_file(filename, **kwargs):
for line in proc.stdout: for line in proc.stdout:
line = line.rstrip() line = line.rstrip()
lower_line = line.lower() lower_line = line.lower()
if "error" in lower_line: if "average loop error" in lower_line:
log.warning(f"[Therion_Compile] {Colors.ENDC}{line}")
elif "error" in lower_line:
log.error(f"[Therion_Compile] {Colors.ENDC}{line}") log.error(f"[Therion_Compile] {Colors.ENDC}{line}")
elif "warning" in lower_line: elif "warning" in lower_line:
log.warning(f" [Therion_Compile] {Colors.ENDC}{line}") log.warning(f"[Therion_Compile] {Colors.ENDC}{line}")
else: else:
log.debug(f" [Therion_Compile] {Colors.ENDC}{line}") log.debug(f"[Therion_Compile] {Colors.ENDC}{line}")
except Exception as e: except Exception as e:
log.warning(f"Reading Therion output: {Colors.ENDC}{e}") log.warning(f"Reading Therion output: {Colors.ENDC}{e}")
@@ -283,7 +244,7 @@ def compile_file(filename, **kwargs):
def compile_file_th(filepath, **kwargs): def compile_file_th(filepath, **kwargs):
template = """source {filepath} template = """source {filepath}
layout test layout test
scale 1 500 scale 1 100
endlayout endlayout
""" """
template_args = {"filepath": filepath} template_args = {"filepath": filepath}
@@ -295,8 +256,6 @@ def compile_file_th(filepath, **kwargs):
lengthre = re.compile(r".*Longueur totale de la topographie = \s*(\S+)m") lengthre = re.compile(r".*Longueur totale de la topographie = \s*(\S+)m")
depthre = re.compile(r".*Longueur totale verticale =\s*(\S+)m") depthre = re.compile(r".*Longueur totale verticale =\s*(\S+)m")
#################################################################################################
def get_stats_from_log(log): def get_stats_from_log(log):
lenmatch = lengthre.findall(log) lenmatch = lengthre.findall(log)
depmatch = depthre.findall(log) depmatch = depthre.findall(log)
@@ -309,7 +268,6 @@ def get_stats_from_log(log):
syscoord = re.compile(r".*output coordinate system: \s*(\S+)") syscoord = re.compile(r".*output coordinate system: \s*(\S+)")
#################################################################################################
def get_syscoord_from_log(log): def get_syscoord_from_log(log):
lenmatch = syscoord.findall(log) lenmatch = syscoord.findall(log)
+1 -2
View File
@@ -1,10 +1,9 @@
encoding utf-8 encoding utf-8
###################################################################################################################################### ######################################################################################################################################
# Version pyCreate_th2.py By Alex 2025 01 02 # Version pyCreateTh.py By Alex MàJ 2025 01 02
###################################################################################################################################### ######################################################################################################################################
###################################################################################################################################### ######################################################################################################################################
# Licence # Licence
###################################################################################################################################### ######################################################################################################################################
+2 -2
View File
@@ -3,11 +3,11 @@ encoding utf-8
{Copyright} {Copyright}
map MP-{fileName}-Plan-tot -title "{fileName}" map MP-{fileName}-Plan-tot -title "{caveName}"
{other_scraps_plan} {other_scraps_plan}
endmap endmap
map MC-{fileName}-Extended-tot -title "{fileName}" map MC-{fileName}-Extended-tot -title "{caveName}"
{other_scraps_extended} {other_scraps_extended}
endmap endmap
@@ -1,9 +1,14 @@
encoding utf-8
{file_info} {file_info}
{Copyright} {Copyright}
to add this survey in a main survey add in your -tot.th file:
input Data/{fileName}/{fileName}-tot.th # Fix point list
equate {fixPointList}
# Survey list :
{readMeList}
# Error list :
{errorList}
+1 -1
View File
@@ -3,6 +3,6 @@ encoding utf-8
{Copyright} {Copyright}
survey {fileName} -title "{fileName}" survey {fileName} -title "{caveName}"
{totData} {totData}
endsurvey endsurvey
+68 -62
View File
@@ -44,19 +44,6 @@ input {configPath}config.thc
## Ici, on peut specifier des choses comme les symboles à utiliser (UIS, etc) ## Ici, on peut specifier des choses comme les symboles à utiliser (UIS, etc)
## ou imprimer des explications des symboles ## ou imprimer des explications des symboles
## Début de la définition du Layout "xviexport"
layout xviexport
#cs UTM32
## echelle à laquelle on veut dessiner la topo
scale 1 {Scale}
#scale 1 1000
## taille de la grille
grid-size 2 2 2 m
## mettre la grille en arrière plan
grid bottom
endlayout
## fin de la définition du layout "xviexport"
## Début de la définition du layout "Layout-Plan" ## Début de la définition du layout "Layout-Plan"
layout layout-Plan layout layout-Plan
## Call the config settings (Layout config inside the config.thc file) ## Call the config settings (Layout config inside the config.thc file)
@@ -120,9 +107,9 @@ layout layout-Plan
## Auteur ## Auteur
doc-author "{Author}" doc-author "{Author}"
## Titre ## Titre
doc-title "{cavename} Plan - 1:{Scale}" doc-title "{caveName} Plan - 1:{Scale}"
doc-subject "{cavename}, topographie en plan" doc-subject "{caveName}, topographie en plan"
doc-keywords "Cave, Survey, {cavename}, Pierre saint Martin - Larra, {map_comment}" doc-keywords "Cave, Survey, {caveName}, {mapComment}"
## Maintenant on spécifie la position de la manchette, dont l'intérieur est occupé par le titre, auteurs, etc. ## Maintenant on spécifie la position de la manchette, dont l'intérieur est occupé par le titre, auteurs, etc.
## Nous pouvons indiquer les cordonnées du point de la topo ou l'on veut la manchette : ## Nous pouvons indiquer les cordonnées du point de la topo ou l'on veut la manchette :
@@ -144,8 +131,8 @@ layout layout-Plan
legend-columns 2 legend-columns 2
## Un commentaire à ajouter au titre, on pourrait indiquer ici la mairie où est placée la cavité ## Un commentaire à ajouter au titre, on pourrait indiquer ici la mairie où est placée la cavité
## dont le nom est probablement le titre de la topo. ## dont le nom est probablement le titre de la topo.
map-comment "{map_comment}" map-comment "{mapComment}"
#map-comment "{map_comment}<br>Coordonnées : ({cs}/WGS84) xxx.xxx xxxx.xxx, Alt.: xxxx m" #map-comment "{mapComment}<br>Coordonnées : ({cs}/WGS84) xxx.xxx xxxx.xxx, Alt.: xxxx m"
## Afficher les statistiques d'explo/topo par équipe/nom. C'est lourd ## Afficher les statistiques d'explo/topo par équipe/nom. C'est lourd
## si la cavité est importante et qu'il y a beaucoup d'explorateurs/topographes. ## si la cavité est importante et qu'il y a beaucoup d'explorateurs/topographes.
@@ -159,7 +146,7 @@ layout layout-Plan
# symbol-hide point station # symbol-hide point station
# symbol-hide line survey # symbol-hide line survey
# symbol-hide group # symbol-hide group
# symbol-show line wall # symbol-show line wall
# symbol-hide point station-name # symbol-hide point station-name
# symbol-hide point u:symbol_plan # symbol-hide point u:symbol_plan
# symbol-hide point u:symbol_extend # symbol-hide point u:symbol_extend
@@ -176,19 +163,19 @@ layout layout-Plan
\legendtextheadersize={\size[28]} %%% Taille du titre \legendtextheadersize={\size[28]} %%% Taille du titre
\legendtextsectionsize={\size[14]} %%% Taille du titre \legendtextsectionsize={\size[14]} %%% Taille du titre
%\legendtextcolor={\color[0 0 110]} %# RGB values 0--100 %\legendtextcolor={\color[0 0 110]} %# RGB values 0--100
% Output map title as determined by Therion is stored in cavename, défini par la une Map. % Output map title as determined by Therion is stored in caveName, défini par la une Map.
% It will be empty if there are multiple maps selected for any one projection % It will be empty if there are multiple maps selected for any one projection
% AND there are multiple source surveys identified in the thconfig file % AND there are multiple source surveys identified in the thconfig file
% ie Therion can not infer a unique title from the input data given. % ie Therion can not infer a unique title from the input data given.
% This code allows you to define an output map title {cavename} if it happens to be empty % This code allows you to define an output map title {caveName} if it happens to be empty
\edef\temp{\the\cavename} % cavename from Therion \edef\temp{\the\caveName} % caveName from Therion
\edef\nostring{} % empty string \edef\nostring{} % empty string
\ifx\temp\nostring % test if cavename is empty \ifx\temp\nostring % test if caveName is empty
% if empty % if empty
reassign cavename to describe selected maps as a group reassign caveName to describe selected maps as a group
\else % if not empty keep the value set by therion, or assign an override cavename here \else % if not empty keep the value set by therion, or assign an override caveName here
\fi \fi
\cavename={{cavename}, Plan 1:{Scale}} % Note Alex : Bug avec certains fichiers ? \caveName={{caveName}, Plan 1:{Scale}} % Note Alex : Bug avec certains fichiers ?
\newtoks\club \club={{club}} \newtoks\club \club={{club}}
%\newtoks\thanksto \thanksto={{thanksto}} %\newtoks\thanksto \thanksto={{thanksto}}
\newtoks\wpage \wpage={{wpage}} \newtoks\wpage \wpage={{wpage}}
@@ -198,6 +185,7 @@ layout layout-Plan
endcode endcode
endlayout endlayout
## fin de la définition du layout
##debut de la definition du layout "layout-Extended" ##debut de la definition du layout "layout-Extended"
layout layout-Extended layout layout-Extended
@@ -261,10 +249,10 @@ layout layout-Extended
## Auteur ## Auteur
doc-author "{Author}" doc-author "{Author}"
## Titre ## Titre
doc-title "{cavename} Coupe développée - 1:{Scale}" doc-title "{caveName} Coupe développée - 1:{Scale}"
doc-subject "{cavename}, topographie en coupe développée" doc-subject "{caveName}, topographie en coupe développée"
doc-keywords "Cave, Survey, {cavename}, Pierre saint Martin - Larra, Coupe développée, {map_comment}" doc-keywords "Cave, Survey, {caveName}, {mapComment}"
## Maintenant on spécifie la position de la manchette, dont l'intérieur est occupé par le titre, auteurs, etc. ## Maintenant on spécifie la position de la manchette, dont l'intérieur est occupé par le titre, auteurs, etc.
## Nous pouvons indiquer les cordonnées du point de la topo ou l'on veut la manchette : ## Nous pouvons indiquer les cordonnées du point de la topo ou l'on veut la manchette :
@@ -285,8 +273,8 @@ layout layout-Extended
legend-columns 2 legend-columns 2
## Un commentaire à ajouter au titre, on pourrait indiquer ici la mairie où est placée la cavité ## Un commentaire à ajouter au titre, on pourrait indiquer ici la mairie où est placée la cavité
## dont le nom est probablement le titre de la topo. ## dont le nom est probablement le titre de la topo.
map-comment "{map_comment}" map-comment "{mapComment}"
#map-comment "{map_comment}<br>Coordonnées : ({cs}/WGS84) xxx.xxx xxxx.xxx, Alt.: xxxx m" #map-comment "{mapComment}<br>Coordonnées : ({cs}/WGS84) xxx.xxx xxxx.xxx, Alt.: xxxx m"
## Afficher les statistiques d'explo/topo par équipe/nom. C'est lourd ## Afficher les statistiques d'explo/topo par équipe/nom. C'est lourd
## si la cavité est importante et qu'il y a beaucoup d'explorateurs/topographes. ## si la cavité est importante et qu'il y a beaucoup d'explorateurs/topographes.
@@ -300,7 +288,7 @@ layout layout-Extended
# symbol-hide point station # symbol-hide point station
# symbol-hide line survey # symbol-hide line survey
# symbol-hide group # symbol-hide group
# symbol-show line wall # symbol-show line wall
# symbol-hide point u:symbol_plan # symbol-hide point u:symbol_plan
# symbol-hide point u:symbol_extend # symbol-hide point u:symbol_extend
# debug scrap-names # debug scrap-names
@@ -317,19 +305,19 @@ layout layout-Extended
\legendtextheadersize={\size[28]} %%% Taille du titre \legendtextheadersize={\size[28]} %%% Taille du titre
\legendtextsectionsize={\size[14]} %%% Taille du titre \legendtextsectionsize={\size[14]} %%% Taille du titre
%\legendtextcolor={\color[0 0 110]} %# RGB values 0--100 %\legendtextcolor={\color[0 0 110]} %# RGB values 0--100
% Output map title as determined by Therion is stored in cavename, défini par la une Map. % Output map title as determined by Therion is stored in caveName, défini par la une Map.
% It will be empty if there are multiple maps selected for any one projection % It will be empty if there are multiple maps selected for any one projection
% AND there are multiple source surveys identified in the thconfig file % AND there are multiple source surveys identified in the thconfig file
% ie Therion can not infer a unique title from the input data given. % ie Therion can not infer a unique title from the input data given.
% This code allows you to define an output map title {cavename} if it happens to be empty % This code allows you to define an output map title {caveName} if it happens to be empty
\edef\temp{\the\cavename} % cavename from Therion \edef\temp{\the\caveName} % caveName from Therion
\edef\nostring{} % empty string \edef\nostring{} % empty string
\ifx\temp\nostring % test if cavename is empty \ifx\temp\nostring % test if caveName is empty
% if empty % if empty
reassign cavename to describe selected maps as a group reassign caveName to describe selected maps as a group
\else % if not empty keep the value set by therion, or assign an override cavename here \else % if not empty keep the value set by therion, or assign an override caveName here
\fi \fi
\cavename={{cavename}, Coupe développée 1:{Scale}} % Note Alex : Bug avec certains fichiers ? \caveName={{caveName}, Coupe développée 1:{Scale}} % Note Alex : Bug avec certains fichiers ?
\newtoks\club \club={{club}} \newtoks\club \club={{club}}
%\newtoks\thanksto \thanksto={{thanksto}} %\newtoks\thanksto \thanksto={{thanksto}}
\newtoks\wpage \wpage={{wpage}} \newtoks\wpage \wpage={{wpage}}
@@ -339,8 +327,9 @@ layout layout-Extended
endcode endcode
endlayout endlayout
## Fin de la definition du Layout "normal" ## Fin de la definition du Layout
## Début de la définition du Layout "layout-kml"
layout layout-kml layout layout-kml
## Définition du système de projection du plan ## Définition du système de projection du plan
cs EPSG:2154 cs EPSG:2154
@@ -352,39 +341,56 @@ layout layout-kml
color map-fg [0 0 100] color map-fg [0 0 100]
endlayout endlayout
## Début de la définition du Layout "xviexport"
layout xviexport
# cs UTM32
## echelle à laquelle on veut dessiner la topo
scale 1 {Scale}
# scale 1 1000
## taille de la grille
grid-size 2 2 2 m
## mettre la grille en arrière plan
grid bottom
endlayout
## fin de la définition du layout
############################################################################################### ###############################################################################################
# 3-EXPORT # 3-EXPORT
############################################################################################### ###############################################################################################
## Export des xvi pour le dessin si besoin ## Export des xvi pour le dessin si besoin
# export map -proj plan -layout xviexport -fmt xvi -o Data/{fileName}-Plan.xvi # export map -proj plan -layout xviexport -fmt xvi -o Data/{fileName}-Plan.xvi
# export map -proj extended -layout xviexport -fmt xvi -o Data/{fileName}-Extended.xvi # export map -proj extended -layout xviexport -fmt xvi -o Data/{fileName}-Extended.xvi
## Selection des Maps à exporter ## Selection des Maps à exporter
# select MP-{fileName}-Plan-tot@{fileName} # select MP-{fileName}-Plan-tot@{fileName}
# select MC-{fileName}-Extended-tot@{fileName} # select MC-{fileName}-Extended-tot@{fileName}
## Export des fichiers pdf, plan et coupe. ## Export des fichiers pdf, plan et coupe.
## ATTENTION, la topo étant énorme, il faut mettre l'option ne traçant pas la centerline ! ## ATTENTION, la topo étant énorme, il faut mettre l'option ne traçant pas la centerline !
# export map -projection plan -fmt pdf -layout layout-Plan -o Outputs/{fileName}-Plan.pdf
# export map -projection extended -fmt pdf -layout layout-Extended -o Outputs/{fileName}-Extended.pdf
# export map -projection plan -fmt pdf -layout layout-Plan -o Outputs/{fileName}-Plan.pdf ## Export du fichier 3d pour Loch
# export map -projection extended -fmt pdf -layout layout-Extended -o Outputs/{fileName}-Extended.pdf export model -enable all -o Outputs/{fileName}.lox
# export model -enable all -o Outputs/{fileName}.kml
# export model -enable all -o Outputs/{fileName}.plt
## Export du fichier 3d pour Loch ## Export des fichiers ESRI
export model -enable all -o Outputs/{fileName}.lox # export map -proj plan -fmt esri -o Outputs/{fileName}
export model -enable all -o Outputs/{fileName}.kml # export model -fmt esri -o Outputs/SHP/therion -enc UTF-8
## Export des fichiers ESRI ## Autres exports
# export map -proj plan -fmt esri -o Outputs/{fileName} # export map -proj plan -fmt kml -o Outputs/{fileName}.kml -layout layout-kml
# export model -fmt kml -o Outputs/{fileName}-model.kml -enable all
# export model -enable all -o Outputs/{fileName}-3D.kml
# export cave-list -location on -o Outputs/{fileName}-Cave-list.html
# export survey-list -location on -o Outputs/{fileName}-Surveys.html
# export database -fmt sql -o Outputs/{fileName}-database.sql
# export continuation-list -o Outputs/{fileName}-Continuations.html
## Export des fichiers kml
# export map -proj plan -fmt kml -o Outputs/{fileName}.kml -layout layout-kml
# export model -fmt kml -o Outputs/{fileName}-model.kml -enable all
# export model -enable all -o Outputs/{fileName}-3D.kml
# export cave-list -location on -o Outputs/{fileName}-Cave-list.html
# export survey-list -location on -o Outputs/{fileName}-Surveys.html
############################################################################################### ###############################################################################################
## END ## END FILE
############################################################################################### ###############################################################################################
+3 -3
View File
@@ -1,4 +1,4 @@
# Configuration values for pyCreate_th2.ph # Configuration values for pyCreateTh.ph
[Survey_Data] [Survey_Data]
Author = Alexandre Pont Author = Alexandre Pont
Copyright1 = # Copyright (C) ARSIP 2025 Copyright1 = # Copyright (C) ARSIP 2025
@@ -7,7 +7,7 @@ Copyright3 = # <http://creativecommons.org/licenses/by-nc-nd/4.0/>
Copyright_Short = Licence CC by-nc-nd : http://creativecommons.org/licenses/by-nc-nd/4.0/ Copyright_Short = Licence CC by-nc-nd : http://creativecommons.org/licenses/by-nc-nd/4.0/
map_comment = Massif de la Pierre Saint Martin - Larra map_comment = Massif de la Pierre Saint Martin - Larra
club = ARSIP club = ARSIP
thanksto = Merçi à tout le monde thanksto = Merci à tout le monde
datat = https://github.com/Alex38Lyon/Synthese-PSM_LARRA datat = https://github.com/Alex38Lyon/Synthese-PSM_LARRA
wpage = https://www.arsip.fr/ wpage = https://www.arsip.fr/
cs = UTM30 cs = UTM30
@@ -18,5 +18,5 @@ template_path = ./template
station_by_scrap = 30 station_by_scrap = 30
final_therion_exe = True final_therion_exe = True
therion_path = C:\Program Files\Therion\therion.exe therion_path = C:\Program Files\Therion\therion.exe
shot_lines_in_th2_files = True shot_lines_in_th2_files = False
station_name_in_th2_files = True station_name_in_th2_files = True
File diff suppressed because it is too large Load Diff
-15
View File
@@ -1,15 +0,0 @@
numpy
ttkthemes
matplotlib
pandas
Shapely
Fiona
pyproj
scipy
netCDF4
xarray
joblib
geopandas
motionless
salem
configparser