From 8a54cbfad4a5817f8d0637da332b0ab85f5467f0 Mon Sep 17 00:00:00 2001 From: Alex38Lyon <55714436+Alex38Lyon@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:05:09 +0100 Subject: [PATCH] pyCreateTh update --- Outputs/Synthese-PSM_LARRA-Plan.pdf | Bin 9383686 -> 9383686 bytes Outputs/Synthese-PSM_LARRA.3d | Bin 2634138 -> 2634138 bytes Scripts/pyCreateTh.log | 33 +++++++ .../general_fonctions.cpython-314.pyc | Bin 24808 -> 25168 bytes .../__pycache__/global_data.cpython-314.pyc | Bin 4559 -> 4559 bytes Scripts/pyCreateTh/Lib/general_fonctions.py | 31 +++--- Scripts/pyCreateTh/Lib/global_data.py | 2 +- .../__pycache__/tro2th.cpython-314.pyc | Bin 22348 -> 22355 bytes .../__pycache__/vtopotools.cpython-314.pyc | Bin 8669 -> 8969 bytes Scripts/pyCreateTh/Lib/pytro2th/tro2th.py | 2 +- Scripts/pyCreateTh/Lib/pytro2th/vtopotools.py | 3 + Scripts/pyCreateTh/pyCreateTh.py | 91 +++++++++++++----- therion.log | 16 +-- 13 files changed, 133 insertions(+), 45 deletions(-) diff --git a/Outputs/Synthese-PSM_LARRA-Plan.pdf b/Outputs/Synthese-PSM_LARRA-Plan.pdf index 3148d553f570699e4efc78120b6d19dc57129db4..88c3b201479f2f8757625fe83567cfc4928d9f88 100644 GIT binary patch delta 392 zcmajVM^Y3406@`F!JHM$fFKyr>1L*BkT}o-h?ujOBbXHf2!iq)BeQkm30Paj#R zIDl4p02jaNEq=cEyCna&DGMyLNQqL5EwR)x%dN1|Dyyxr);jBLuu++En{2klR@-d1 zLxoCJcB)omms)jp+hebN_B){7L5HLSLJiU~B8_5AnjO}nRhxDlI%Rd~mdNSRtIrYr zjv8>xaVMN~%4uhub6Y8>xa*$#h75b)p+_Ej;;Cnzdtt;& zue|ogs4;JioAA!0DerwSjgRs^`Rt3YzWHwES7D@B8U(4Z>BnfXQ1Op*KZ}KlvaW_C n9R*>MO$FIFjxvpLl*@!k80V5W?2c0DwyKu@EpvnOh1upmF_@99 delta 392 zcmajV*;b4J0KoBs3Y8^FWoZ#5S({+v~Nm>x$XCln4o1Vb6bGq>? z^AtS*=Xd}Y|8ss9|6JjBQSNWEmRW9vBE?Fqw90Cw%9LAUt##I`u)#)^s%%oNMy<`Z z*lL?P^%^wVuE`ENHEXd;tKHh{vDZHPwTlVFg%Ub+Iv}abLER4Nao7ni7*I%Oc(NX|G2nN$j?+o rsUQ`m!+5eYkqzQuwj-TMMd@r5i)VsllnG-!4c-4+7KfMeKfC?_NkWoE diff --git a/Outputs/Synthese-PSM_LARRA.3d b/Outputs/Synthese-PSM_LARRA.3d index 03f5d8e19268d4d715221657dae68893d9979463..baea76c1937b2251d325e434a64571a88035cb05 100644 GIT binary patch delta 139 zcmWN=xebB<06@{8c%LZVwB~Td63Ix$63axUGLyM1WGO3I%SN`clf4||D2bfpEU9E4 H@<;Ily&Nh1 delta 139 zcmWN=w-LfX006;}5Ked}JP1$v2}%jB2KphmoLCV}P!Wy5&TRR8N9F(Pp4>tao=7CI zR3wqA)TAyAX-X)2V)JV-|JvvQ6*NW%O59eG4^Y7BdKCXJKT&|iYlsfp=HomSF*m515+c_ z>nqmzh`X}M&<1{u38*|I4;p6bAu!;c(^^J zZU=n)pM1sklgA}19!nv6*rFDF$^gr!7P&5%+wUXjw8F&$MWHRBU0IqA33 zUF?W$drkm+rw;*WJeA^fJNuo@m)iyFHux#8L!3vs+l6e+Hf+CPt5~*GoZ^?dUb3)$ zdr@A~sivi=({-=rUaxHYptNb()y&fN(A-@sXU|>DbuS9@!kWmL^A`Q5_TMm7yl<*F zEx%gvqr`9dH}?F-dVXl7wSP6IVDX8?!^=69^TMjxv0y)8Uwm{)Trrp5g`JMYf<^jb z@#&_Y8h#<36;Ic%8RMbR!{3>YtEIySj@AqnJLnf;}&n8;D~S>+)4BGX@0Nr;0@ zRXG=CV&}o_`RqY2~jR8*xqP+Etu4Y_J~|WN%h|& z7f%MJ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X5&n4yzt+uv0P?RVy#N3J diff --git a/Scripts/pyCreateTh/Lib/__pycache__/global_data.cpython-314.pyc b/Scripts/pyCreateTh/Lib/__pycache__/global_data.cpython-314.pyc index dedb6e047db0f2847ab40f4f761c7f56c6b158c0..4fb56cfc460b381dbc60df0457a3453b2b38ef4e 100644 GIT binary patch delta 27 hcmX@Fd|sJbn~#@^0SI max_name_len: - stem = path.stem[: max_name_len - 6] + stem = path.stem[: max(1, max_name_len - 6)] name = f"{stem}...{path.suffix}" - # 2️⃣ Tentative de chemin relatif + # ── 3. Construction des parties ────────────────────────────────────────── try: if base: rel = path.relative_to(base) @@ -90,17 +91,25 @@ def safe_relpath( path, base_dir=None, max_depth=4, max_name_len=50, prefix="~" except Exception: parts = list(path.parts) - # 3️⃣ Limitation de profondeur - if max_depth is not None and len(parts) > max_depth: + # ── 4. Cas path == base → "." ──────────────────────────────────────────── + if not parts: + parts = ["."] + + # ── 5. Limitation de profondeur ────────────────────────────────────────── + if isinstance(max_depth, int) and max_depth > 0 and len(parts) > max_depth: parts = parts[-max_depth:] parts.insert(0, prefix) - # 4️⃣ Remplacement du nom si tronqué - if parts: + # ── 6. Remplacement du nom final ────────────────────────────────────────── + if parts and parts[-1] not in (".", os.sep): parts[-1] = name - # 5️⃣ Construction finale portable - return os.path.join(*parts) + # ── 7. Construction finale sûre ────────────────────────────────────────── + try: + return os.path.join(*parts) + except Exception: + return name + ################################################################################################# diff --git a/Scripts/pyCreateTh/Lib/global_data.py b/Scripts/pyCreateTh/Lib/global_data.py index 5599ab2..b575ab7 100644 --- a/Scripts/pyCreateTh/Lib/global_data.py +++ b/Scripts/pyCreateTh/Lib/global_data.py @@ -6,7 +6,7 @@ global_data.py for pyCreateTh.py !#############################################################################################! """ -Version = "2026.01.07" +Version = "2026.01.08" ################################################################################################# diff --git a/Scripts/pyCreateTh/Lib/pytro2th/__pycache__/tro2th.cpython-314.pyc b/Scripts/pyCreateTh/Lib/pytro2th/__pycache__/tro2th.cpython-314.pyc index 805906cd1f95593f604e64d6cee50cde3cfad79b..f347d94f9d3936ba5484075b8eed07eb64c1587d 100644 GIT binary patch delta 44 ycmX@Jj`8w3MqX_`UM>b82#Jl)T)mMu$Aj_g<|+?QR(1uA%sho$&CQ2>J2?R>9}Tkr delta 36 rcmcb-j`7SoMqX_`UM>b8$h;qwxnv`6jtAqh%~c+rtea2yc5(s$*>enH diff --git a/Scripts/pyCreateTh/Lib/pytro2th/__pycache__/vtopotools.cpython-314.pyc b/Scripts/pyCreateTh/Lib/pytro2th/__pycache__/vtopotools.cpython-314.pyc index cb69174c46f0d97aa6bb5f42365f20969043b619..1de05b64dd3e028b916f999005cf3794e0c84db4 100644 GIT binary patch delta 881 zcmaiy&ubGw6vt=C?k2n4grpj3wKf6Uv`K1g8WE~hDK$x3DUGotJxG@&*|ZDW?lL=C zsYt7yfyP~j+S_=h19f|fkzG@mFp!b<+1o;FWKR*x5Z1s zAa$PQ0O+76z8MCfBoq@QB&0aHO_O1vJCwBKa(8)mx@Fp%5zc}5`NpEK@9{4Q4=$$$ zY7h1A9stO=6z}03FVZYSt!R#bY>afv;cd&%u_M$>G_PWZuNkIFo=OMO0BzevKYNWl zX))nf@~6cfkx#Bp)+aZzo3ZtYts5UY`uFAZ%B4^Lk;Twzq#oG_zqHp+Z>q04_r>0o z4AJBy{7Ba1u(*Ee*BKBv@w2nBEq~)+nmiBn!x!XzXcQ($uyw3GP5V23q^VWK)-cu= zW^FW1HM48*lTG#W*2xm+<9?r8`sSi6r=mB#kS?%BsMLvo#aSJ-{H&0TLd?D!OAL7mqW#R;;m zcy1BtSi`1i*r>+xXBpKu9#M_GeETf~BoS@%<{`|&-=)TA JbPaN>;xEf3$5#LV delta 553 zcmeBlyX(xS&Bx2d00is?>oX=OZ{%}iVN{wNz!Ji(<imQSpp46XJ%lKVesC-z!1h3q%rw6n;w(*>B+q8 zs)CvYJmIS0ha%s0)2Z`!|2vrcF3nDZ@L=cDw01~&@K~BxjNrAY?4WDw$O6&<0AsC=+yDRo diff --git a/Scripts/pyCreateTh/Lib/pytro2th/tro2th.py b/Scripts/pyCreateTh/Lib/pytro2th/tro2th.py index b65edf2..77ba595 100644 --- a/Scripts/pyCreateTh/Lib/pytro2th/tro2th.py +++ b/Scripts/pyCreateTh/Lib/pytro2th/tro2th.py @@ -381,7 +381,7 @@ def convert_tro(fle_tro_fnme, fle_tro_encoding=None, fle_th_fnme = None, cavenam OUTPUTS: new .th file with surveyed data for Therion cavename : Name of the cave from the .tro file - coordinates : Coordinates of the entrance + coordinates : Coordinates of the entrance (in m) coordsyst : Coordinates system used by the .tro file entrance : Entrance station diff --git a/Scripts/pyCreateTh/Lib/pytro2th/vtopotools.py b/Scripts/pyCreateTh/Lib/pytro2th/vtopotools.py index e8bc064..f4a919f 100644 --- a/Scripts/pyCreateTh/Lib/pytro2th/vtopotools.py +++ b/Scripts/pyCreateTh/Lib/pytro2th/vtopotools.py @@ -88,6 +88,9 @@ def read_vtopo_header(lines): if u'Trou' in line: # read Trou (cavename, xcoord, ycoord, alt, coordtro) = line[5:].replace(u'\n', u'').rstrip(u'\n\r').split(u',') + xcoord = "{:.2f}".format(float(xcoord) * 1000) + ycoord = "{:.2f}".format(float(ycoord) * 1000) + alt = "{:.2f}".format(float(alt) * 1) coordinates = [xcoord, ycoord, alt] # read club if u'Club' in line: club = line[5:].replace(u'\n', u'') diff --git a/Scripts/pyCreateTh/pyCreateTh.py b/Scripts/pyCreateTh/pyCreateTh.py index 485549e..91a9eb6 100644 --- a/Scripts/pyCreateTh/pyCreateTh.py +++ b/Scripts/pyCreateTh/pyCreateTh.py @@ -12,8 +12,8 @@ # # # Définir les différentes variables dans fichier config.ini # # # -# Usage : python pyCreateTh.py # -# Commandes : pyCreateTh.py --help # +# Usage : python pyCreateTh.py # +# Commandes : pyCreateTh.py --help # # # !############################################################################################ @@ -31,9 +31,9 @@ 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 + - pas possible de gérer les fichiers tro avec plusieurs entrées / points fixes car pas sauvegardé dans le format tro - gérer pour ne pas avoir de copie de config.ini - - modifier les coordonnées de km vers m + - modifier les coordonnées de km vers m, ajouter les points fixes dans read-me - Exports TroX - A créer pour avoir notamment les réseaux à plusieurs entrées - Exports DAT/MARK @@ -346,7 +346,6 @@ def mak_to_th_file(ENTRY_FILE) : # Génération du CRS QGIS (format WKT) crs_wkt = f'EPSG:{epsg_code}' - log.info(f"Reading mak file: {Colors.ENDC}{shortCurentFile}{Colors.GREEN}, fixed station: {Colors.ENDC}{len(fixPoints)}{Colors.GREEN}, files : {Colors.ENDC}{len(datFiles)}{Colors.GREEN}, UTM Zone : {Colors.ENDC}{UTM[0]}{Colors.GREEN}, Datum : {Colors.ENDC}{next(iter(Datums))}{Colors.GREEN}, SCR : {Colors.ENDC}{crs_wkt}") totReadMeFixPoint = f"\t* Source mak file : {os.path.basename(ENTRY_FILE)}, fixed station: {len(fixPoints)}, files : {len(datFiles)}, UTM Zone : {UTM[0]}, Datum : {next(iter(Datums))}, SCR : {crs_wkt}\n" @@ -551,7 +550,7 @@ def mak_to_th_file(ENTRY_FILE) : ################################################################################################# -def station_list_dat(data, list, fixPoints, currentSurveyName) : +def station_list_dat(data, list, list_fixed,fixPoints, currentSurveyName) : """Crée une liste de stations à partir des données fournies issues d'un fichier dat. Args: @@ -573,22 +572,31 @@ def station_list_dat(data, list, fixPoints, currentSurveyName) : # stations = pd.concat([dfDATA.iloc[1:, 0], dfDATA.iloc[1:, 1]]).drop_duplicates().str.replace('[', '%').str.replace(']', '%%').str.replace('@', '_._') stations = pd.concat([dfDATA.iloc[1:, 0], dfDATA.iloc[1:, 1]]).drop_duplicates().stationName() + stationsFixed = pd.concat([dfDATA.iloc[1:, 0], dfDATA.iloc[1:, 1]]).drop_duplicates().stationName() + fixed_names = {point[0] for point in fixPoints} stations = stations[~stations.isin(fixed_names)] + stations_fixed = stationsFixed[stationsFixed.isin(fixed_names)] new_entries = pd.DataFrame({ 'StationName': stations, 'Survey_Name_01': currentSurveyName }) - list = pd.concat([list, new_entries], ignore_index=True) + new_fixed = pd.DataFrame({ + 'Station_Fix': stations_fixed, + 'Survey_Name': currentSurveyName + }) - return list, dfDATA + list = pd.concat([list, new_entries], ignore_index=True) + list_fixed = pd.concat([list_fixed, new_fixed], ignore_index=True) + + return list_fixed, list, dfDATA ################################################################################################# -def station_list_th(data, list, fixPoints, currentSurveyName) : +def station_list_th(data, list, list_fixed, fixPoints, currentSurveyName) : """Crée une liste de stations à partir des données fournies issues d'un fichier tro. Args: @@ -611,22 +619,30 @@ def station_list_th(data, list, fixPoints, currentSurveyName) : # stations = pd.concat([dfDATA.iloc[:, 0], dfDATA.iloc[:, 1]]).drop_duplicates().reset_index(drop=True) stations = pd.concat([dfDATA.iloc[:, 0], dfDATA.iloc[:, 1]]).dropna().astype(str).loc[lambda s: ~s.isin(["-", "*"])].drop_duplicates().reset_index(drop=True) + stationsFixed = pd.concat([dfDATA.iloc[:, 0], dfDATA.iloc[:, 1]]).dropna().astype(str).loc[lambda s: ~s.isin(["-", "*"])].drop_duplicates().reset_index(drop=True) # print(stations) fixed_names = {point[0] for point in fixPoints} stations = stations[~stations.isin(fixed_names)] + stations_fixed = stationsFixed[stationsFixed.isin(fixed_names)] new_entries = pd.DataFrame({ 'StationName': stations, 'Survey_Name_01': currentSurveyName }) + new_fixed = pd.DataFrame({ + 'Station_Fix': stations_fixed, + 'Survey_Name': currentSurveyName + }) + list = pd.concat([list, new_entries], ignore_index=True) + list_fixed = pd.concat([list_fixed, new_fixed], ignore_index=True) # print(new_entries) - return list, dfDATA + return list_fixed, list, dfDATA ################################################################################################# @@ -1377,8 +1393,9 @@ def tro_to_th_files(ENTRY_FILE, centerlines = [], totReadMe = "" surveyCount = 0 totReadMeFixPoint = f"\tcs {coordsyst}\n" - totReadMeFixPoint += f"\tFix point: {entrance} [{coordinates[0]} km, {coordinates[1]} km, {coordinates[2]} m]\n" + totReadMeFixPoint += f"\tFix point, station : {entrance}, coordinates: [{coordinates[0]} m, {coordinates[1]} m, {coordinates[2]} m]\n" listStationSection = pd.DataFrame(columns=['StationName', 'Survey_Name']) + listStationSectionFixed = pd.DataFrame(columns=['Station_Fix', 'Survey_Name']) threads = [] fixPoints = [] fixPoints.append([entrance, " ", coordinates[0], coordinates[1], coordinates[2]]) @@ -1430,7 +1447,7 @@ def tro_to_th_files(ENTRY_FILE, centerlines = [], # Ajouter les données de la section à la liste if len(cl['DATA']) > 0 : - listStationSection, dfDATA = station_list_th(cl, listStationSection, fixPoints, currentSurveyName) + listStationSectionFixed, listStationSection, dfDATA = station_list_th(cl, listStationSection, listStationSectionFixed, fixPoints, currentSurveyName) # print(f"Explo {i}, dfDATA : {dfDATA}") # print(listStationSection) @@ -1446,7 +1463,7 @@ def tro_to_th_files(ENTRY_FILE, centerlines = [], proj = args.proj.lower()) threads += thread2 - log.info(f"File: {Colors.ENDC}{currentSurveyName}{Colors.INFO}, compilation successful, length: {Colors.ENDC}{stat["length"]}m{Colors.INFO}, depth: {Colors.ENDC}{stat["depth"]}m") + log.info(f"File: {Colors.ENDC}{currentSurveyName}{Colors.INFO}, compilation successful, length: {Colors.ENDC}{stat["length"]}m{Colors.INFO}, depth: {Colors.ENDC}{stat["depth"]}m") totReadMe += f"\t{currentSurveyName} compilation successful length: {stat["length"]} m, depth: {stat["depth"]} m\n" if not StatCreateFolder : @@ -1518,6 +1535,10 @@ def tro_to_th_files(ENTRY_FILE, centerlines = [], totdata +=f"\n\t## Maps list:\n\t{maps}input {SurveyTitle}-maps.th\n" if totReadMeErrorDat == "" : totReadMeErrorDat += "\tThis file has no errors, perfect!\n" + + for index, row in listStationSectionFixed.iterrows(): + # log.info(f"Fixed station : {Colors.ENDC}{row['Station_Fix']}{Colors.INFO}, Survey : {Colors.ENDC}{row['Survey_Name']}") + totReadMeFixPoint += f"\tFixed station : {row['Station_Fix']}, Survey : {row['Survey_Name']}\n" config_vars = { 'fileName': SurveyTitle, @@ -1638,6 +1659,7 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", # Tableau global pour stocker toutes les stations stationList = pd.DataFrame(columns=['StationName', 'Survey_Name_01', 'Survey_Name_02']) + stationList_Fixed = pd.DataFrame(columns=['StationName', 'Survey_Name']) section0 = True; @@ -1647,6 +1669,7 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", for section in sections: listStationSection = pd.DataFrame(columns=['StationName', 'Survey_Name']) + listStationSection_Fixed = pd.DataFrame(columns=['StationName', 'Survey_Name']) if not section.strip(): continue # ignorer les sections vides @@ -1667,6 +1690,7 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", "PREFIX": None, 'DATA' : [], 'STATION': [], + 'STATION_FIXED': [], 'SOURCE' : [] } @@ -1703,8 +1727,10 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", if jumpLine == True : jumpLine = False line = line.strip() + elif line.startswith('SURVEY NAME:'): section_data['SURVEY_NAME'] = sanitize_filename(line.split(':', 1)[1].strip()) + elif line.startswith('SURVEY DATE:'): # current_field = 'DATE' # Séparer la date et le commentaire @@ -1718,23 +1744,25 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", log.warning(f"Survey {Colors.ENDC}{section_data['SURVEY_NAME']}{Colors.WARNING} with no date, add default date 2000 01 01 ") if len(date_parts) > 1: section_data['COMMENT'] = date_parts[1].strip() + elif line.startswith('SURVEY TEAM:'): NextLineSurveyTeam = True line.strip() + elif NextLineSurveyTeam == True : NextLineSurveyTeam = False 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) if match: section_data[champ] = match.group(1).strip() jumpLine = True # Sauter une ligne après la ligne DECLINATION - - + else : if line.strip() != '' : section_data['DATA'].append(line.strip()) @@ -1743,8 +1771,9 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", # Ajouter les données de la section à la liste if len(section_data['DATA']) > 0 : - listStationSection, dfDATA = station_list_dat(section_data, listStationSection, fixPoints, section_data['SURVEY_NAME']) + listStationSection_Fixed, listStationSection, dfDATA = station_list_dat(section_data, listStationSection, listStationSection_Fixed, fixPoints, section_data['SURVEY_NAME']) section_data['STATION'] = listStationSection + section_data['STATION_FIXED'] = listStationSection_Fixed data.append(section_data) unique_id += 1 @@ -1839,6 +1868,7 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", if all(val == 0.0 for val in _CorrectionValues) : _corrections = "" + else : _corrections = f"\t\t# Corrections: {_CorrectionValues[0]} {_CorrectionValues[1]} {_CorrectionValues[2]}, not yet implemented\n" log.error(f"Corrections: {Colors.ENDC}{_CorrectionValues[0]} {_CorrectionValues[1]} {_CorrectionValues[2]}{Colors.ERROR}, not yet implemented in {Colors.ENDC}{currentSurveyName}") @@ -1849,6 +1879,7 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", _CorrectionValues3 = [float(val) for val in _line['CORRECTIONS2'].strip().split()] if all(val == 0.0 for val in _CorrectionValues) : _CorrectionValues3 = "" + else : log.error(f"Corrections2: {Colors.ENDC}{_CorrectionValues[0]} {_CorrectionValues[1]} {_CorrectionValues[2]}{Colors.ERROR}, not yet implemented in {Colors.ENDC}{currentSurveyName}") totReadMeError += f"\tCorrections2: {_CorrectionValues[0]} {_CorrectionValues[1]} {_CorrectionValues[2]}, not yet implemented in {currentSurveyName}\n" @@ -1858,6 +1889,7 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", date = _line['DISCOVERY'].strip() mois, jour, annee = date.split() discovery = f"{int(annee):04d} {int(mois):02d} {int(jour):02d}" + else : discovery = f"{_line['SURVEY_DATE']} # '????'" @@ -1876,7 +1908,7 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", # gestion des DATA # ################################################################################################# - stationList, dfDATA = station_list_dat(_line, stationList, fixPoints, currentSurveyName) + stationList_Fixed, stationList, dfDATA = station_list_dat(_line, stationList, stationList_Fixed, fixPoints, currentSurveyName) headerData = dfDATA.iloc[0].tolist() @@ -1900,13 +1932,14 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", if len(list_common_points) >= 1 : fixPoint += f"\t\tcs {crs_wkt}\n" for point in list_common_points : - totReadMeFixPoint += f"\tFix point: {point[0]} [{point[2]:.3f} m, {point[3]:.3f} m, {point[4]:.3f} m], in {currentSurveyName}\n" + totReadMeFixPoint += f"\tFix point: {point[0]} [{point[2]:.2f} m, {point[3]:.2f} m, {point[4]:.2f} m], in {currentSurveyName}\n" if point[1] == 'm' : - fixPoint += f"\t\tfix {point[0]} {point[2]:.3f} {point[3]:.3f} {point[4]:.3f}\n" + fixPoint += f"\t\tfix {point[0]} {point[2]:.2f} {point[3]:.2f} {point[4]:.3f}\n" elif point[1] == 'f' : - fixPoint += f"\t\tfix {point[0]} {point[2]*0.3048:.3f} {point[3]*0.3048:.3f} {point[4]*0.3048:.3f} # Conversion feet - meter\n" + fixPoint += f"\t\tfix {point[0]} {point[2]*0.3048:.2f} {point[3]*0.3048:.2f} {point[4]*0.3048:.2f} # Conversion feet - meter\n" fixPoint += f'\t\tstation {point[0]} "{point[0]}" entrance\n' + ################################################################################################# # Gestion des formats @@ -2046,7 +2079,13 @@ def dat_to_th_files (ENTRY_FILE, fixPoints = [], crs_wkt = "", CONFIG_PATH = "", totdata +=f"\n\t## Maps list:\n\t{maps}input {SurveyTitle}-maps.th\n" if totReadMeErrorDat == "" : totReadMeErrorDat += "\tNo errors in the file, that's excellent !\n" + + stationList_Fixed = stationList_Fixed.drop_duplicates() + for index, row in stationList_Fixed.iterrows(): + # log.info(f"Fixed station: {Colors.ENDC}{row['Station_Fix']}{Colors.INFO}, survey: {Colors.ENDC}{row['Survey_Name']}") + totReadMeFixPoint += f"\tFixed station: {row['Station_Fix']}, Survey: {row['Survey_Name']}\n" + config_vars = { 'fileName': SurveyTitle, 'caveName': SurveyTitle.replace("_", " "), @@ -2199,7 +2238,7 @@ if __name__ == u'__main__': ################################################################################################# # titre # ################################################################################################# - titre_largeur = 160 + titre_largeur = 150 bordure = "#" * titre_largeur + Colors.ENDC ansi_escape = re.compile(r'\x1b\[[0-9;]*m') @@ -2217,7 +2256,7 @@ if __name__ == u'__main__': _titre = [ bordure, - pad_line(f"{Colors.BOLD}{Colors.YELLOW}Conversion Th, Dat, Mak, Tro, files to Therion files and folders", center=True), + pad_line(f"{Colors.BOLD}{Colors.YELLOW}Files conversion th, dat, mak, tro and trox to therion files and folders", center=True), pad_line(f"Script pyCreateTh by : {Colors.BLUE}alexandre.pont@yahoo.fr"), pad_line(f"Version : {Colors.ENDC}{globalData.Version}"), pad_line(f"Input file : {Colors.ENDC}{safe_relpath(args.file)}"), @@ -2230,6 +2269,11 @@ if __name__ == u'__main__': for line in _titre: log.info(line) + + + if args.file == "": + log.critical(f"No valid file selected, try again") + exit(0) ################################################################################################# @@ -2263,8 +2307,7 @@ if __name__ == u'__main__': fileTitle, thread2 = mak_to_th_file(abspath(args.file)) threads += thread2 - - + ################################################################################################# # Fichier DAT # ################################################################################################# diff --git a/therion.log b/therion.log index 4d45cf8..cbca394 100644 --- a/therion.log +++ b/therion.log @@ -94,10 +94,10 @@ processing survey data ... ####################### cavern log file ######################## 1> Survex 1.4.17 2> Copyright 1990-2025 Olly Betts - 3> C:\Users\alexa\AppData\Local\Temp\th20128\data.svx:1191:6: warning: Station already fixed at the same coordinates + 3> C:\Users\alexa\AppData\Local\Temp\th26724\data.svx:1191:6: warning: Station already fixed at the same coordinates 4> *fix 1122 680916.000000 4757614.000000 1719.000000 5> ^~~~ - 6> C:\Users\alexa\AppData\Local\Temp\th20128\data.svx:1190: info: Previously fixed or equated here + 6> C:\Users\alexa\AppData\Local\Temp\th26724\data.svx:1190: info: Previously fixed or equated here 7> 8> Survey contains 67389 survey stations, joined by 67542 legs. 9> There are 332 loops. @@ -112,10 +112,10 @@ processing survey data ... 18> There were 1 warning(s). 19> ######################### transcription ######################## - 3> 20128 : LAR_d_436/20@Explo_82_1996_06_30.Explo_82_1996_06_30.Complexe_Arrestelia.Synthese-PSM_LARRA + 3> 26724 : RI122@Explo_45_2018_08_09.Explo_45_2018_08_09.Complexe_BU56_Ilamina.Synthese-PSM_LARRA 3> input:1191 -- Data/AN026/Data/Explo_01_2006_11_04/Data/Explo_01_2006_11_04.th [17] 4> 1122 : AN26@Explo_01_2006_11_04.Explo_01_2006_11_04.AN026.Synthese-PSM_LARRA - 6> 20128 : LAR_d_436/20@Explo_82_1996_06_30.Explo_82_1996_06_30.Complexe_Arrestelia.Synthese-PSM_LARRA + 6> 26724 : RI122@Explo_45_2018_08_09.Explo_45_2018_08_09.Complexe_BU56_Ilamina.Synthese-PSM_LARRA 6> input:1190 -- Data/AN026/Data/Explo_01_2006_11_04/Data/Explo_01_2006_11_04.th [15] 8> 67389 : 27@Z510_Fond.Z510_Fond.Z510.Synthese-PSM_LARRA 9> 332 : AN8_d_455@Explo_03_1992_08_01.Explo_03_1992_08_01.AN008.Synthese-PSM_LARRA @@ -654,7 +654,7 @@ S 1.5e+03 SP-Tobozo_231_01@Tobozo_231.Tobozo.Synthese-PSM_LARRA () writing Outputs/Synthese-PSM_LARRA-Plan.pdf ... processing projection none ... done ####################### metapost log file ######################## -This is MetaPost, version 2.01 (TeX Live 2021/W32TeX) (kpathsea version 6.3.3) 7 JAN 2026 20:54 +This is MetaPost, version 2.01 (TeX Live 2021/W32TeX) (kpathsea version 6.3.3) 7 JAN 2026 21:10 **data.mp (c:/Program Files/Therion/texmf/mpost/mpost.mp (c:/Program Files/Therion/texmf/mpost/plain.mp @@ -891,7 +891,7 @@ Here is how much of MetaPost's memory you used: converting scraps ... done making map ... done ######################## pdftex log file ######################### -This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/W32TeX) (preloaded format=pdfetex 2023.12.2) 7 JAN 2026 20:54 +This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/W32TeX) (preloaded format=pdfetex 2023.12.2) 7 JAN 2026 21:10 entering extended mode **data.tex (./data.tex (./th_enc.tex) (./th_texts.tex) (./th_resources.tex @@ -1004,7 +1004,7 @@ processing projection elevation ... done average distortion: 0.55% done ####################### metapost log file ######################## -This is MetaPost, version 2.01 (TeX Live 2021/W32TeX) (kpathsea version 6.3.3) 7 JAN 2026 21:02 +This is MetaPost, version 2.01 (TeX Live 2021/W32TeX) (kpathsea version 6.3.3) 7 JAN 2026 21:19 **data.mp (c:/Program Files/Therion/texmf/mpost/mpost.mp (c:/Program Files/Therion/texmf/mpost/plain.mp @@ -1021,7 +1021,7 @@ writing Outputs/Synthese-PSM_LARRA-model.kml ... done writing Outputs/Synthese-PSM_LARRA-3D.kml ... done writing Outputs/Synthese-PSM_LARRA-Cave-list.html ... done writing Outputs/Synthese-PSM_LARRA-Surveys.html ... done -compilation time: 565 sec +compilation time: 577 sec ######################### loop errors ##########################