toughanimator 0.1.10__tar.gz → 0.1.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {toughanimator-0.1.10 → toughanimator-0.1.11}/PKG-INFO +1 -1
- {toughanimator-0.1.10 → toughanimator-0.1.11}/setup.py +1 -1
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator/run.py +6 -5
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator/tough_classes.py +51 -23
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator.egg-info/PKG-INFO +1 -1
- {toughanimator-0.1.10 → toughanimator-0.1.11}/README.md +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/pyproject.toml +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/setup.cfg +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/tests/test_all_cases.py +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator/__init__.py +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator.egg-info/SOURCES.txt +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator.egg-info/dependency_links.txt +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator.egg-info/requires.txt +0 -0
- {toughanimator-0.1.10 → toughanimator-0.1.11}/toughanimator.egg-info/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='toughanimator', # Package name on PyPI
|
|
5
|
-
version='0.1.
|
|
5
|
+
version='0.1.11',
|
|
6
6
|
description='A tool for visualizing TOUGH simulation outputs.',
|
|
7
7
|
long_description=open('README.md').read(),
|
|
8
8
|
long_description_content_type='text/markdown',
|
|
@@ -6,11 +6,12 @@ import matplotlib.pyplot as plt
|
|
|
6
6
|
dir_name = "unresolved"
|
|
7
7
|
#dir_name = "test_cases"
|
|
8
8
|
#case_name = "PetraSim_2D_Conceptual"
|
|
9
|
-
case_name = "
|
|
9
|
+
#case_name = "cp950_problem"
|
|
10
|
+
case_name = "3D five spot MINC"
|
|
10
11
|
test_case_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), dir_name)
|
|
11
12
|
|
|
12
13
|
case_dir = os.path.join(test_case_dir, case_name)
|
|
13
|
-
|
|
14
|
+
case_dir = r"D:\Projects\tough-processing\uwc\tough_case\uwc_polygonal_20251231\PetraSim"
|
|
14
15
|
#case_dir = r"D:\Projects\202511\ta-post\0 Base_res_k"
|
|
15
16
|
#case_dir = r"D:\Projects\202504\polygonal\poly_test"
|
|
16
17
|
#case_dir = r"D:\Projects\202507\tough系列output\tough output format\TR_MINC_exe"
|
|
@@ -18,10 +19,10 @@ case_dir = os.path.join(test_case_dir, case_name)
|
|
|
18
19
|
#case_dir = r"D:\Projects\202511\case_TRv4\uwc"
|
|
19
20
|
#case_dir = r"D:\Projects\202501\toughanimator\test_cases\2DCCS 100yrs_RC"
|
|
20
21
|
reader = ta.vis_reader(case_dir)
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
reader.write_eleme_conne()
|
|
23
|
+
reader.write_geometry()
|
|
23
24
|
#reader.write_incon()
|
|
24
25
|
#reader.write_result()
|
|
25
|
-
reader.write_all()
|
|
26
|
+
#reader.write_all()
|
|
26
27
|
|
|
27
28
|
|
|
@@ -9,6 +9,7 @@ import pandas as pd
|
|
|
9
9
|
from vtkmodules.all import *
|
|
10
10
|
import pathlib
|
|
11
11
|
import json
|
|
12
|
+
import chardet
|
|
12
13
|
|
|
13
14
|
from enum import Enum
|
|
14
15
|
|
|
@@ -107,11 +108,39 @@ class vis_reader:
|
|
|
107
108
|
if os.path.isdir(case_dir):
|
|
108
109
|
config_path = os.path.join(case_dir, "config.json")
|
|
109
110
|
if os.path.exists(config_path):
|
|
110
|
-
with open(config_path,
|
|
111
|
+
with open(config_path, "r", encoding="latin-1") as config_file:
|
|
111
112
|
config = json.load(config_file)
|
|
113
|
+
|
|
112
114
|
else:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
|
|
116
|
+
# find if INFILE or flow.inp under case_dir
|
|
117
|
+
input_files = []
|
|
118
|
+
output_files = []
|
|
119
|
+
corners_file = ""
|
|
120
|
+
for file_name in os.listdir(case_dir):
|
|
121
|
+
if file_name.upper() == "INFILE" or file_name.lower() == "flow.inp":
|
|
122
|
+
input_files.append(file_name)
|
|
123
|
+
if file_name.lower().endswith(".tec"):
|
|
124
|
+
output_files.append(file_name)
|
|
125
|
+
|
|
126
|
+
# if the file name contains "corners"
|
|
127
|
+
if "corners" in file_name.lower():
|
|
128
|
+
corners_file = file_name
|
|
129
|
+
|
|
130
|
+
# atomatically create a config.json file
|
|
131
|
+
config = {
|
|
132
|
+
"case_name": case_dir.split(os.sep)[-1],
|
|
133
|
+
"input_files": input_files,
|
|
134
|
+
"output_files": output_files,
|
|
135
|
+
"corners_file": corners_file
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# save the file
|
|
139
|
+
with open(config_path, "w", encoding="latin-1") as config_file:
|
|
140
|
+
json.dump(config, config_file, indent=4)
|
|
141
|
+
|
|
142
|
+
#print(f"Config file:({config_path}) not found. Please create it.")
|
|
143
|
+
#sys.exit(1)
|
|
115
144
|
else:
|
|
116
145
|
print(f"Case directory:({case_dir}) not found. Please check it.")
|
|
117
146
|
sys.exit(1)
|
|
@@ -276,7 +305,8 @@ class vis_reader:
|
|
|
276
305
|
has_elem = False
|
|
277
306
|
for input_file_path in self.setting.input_file_paths:
|
|
278
307
|
line_counter = 0
|
|
279
|
-
with open(input_file_path, encoding="
|
|
308
|
+
with open(input_file_path, "r", encoding="latin-1") as f:
|
|
309
|
+
|
|
280
310
|
reading_elem = False
|
|
281
311
|
|
|
282
312
|
for line in f:
|
|
@@ -302,7 +332,7 @@ class vis_reader:
|
|
|
302
332
|
def __check_num_of_minc(self):
|
|
303
333
|
#self.minc_buffer = io.StringIO()
|
|
304
334
|
minc_num = 0
|
|
305
|
-
with open(self.minc_file, encoding="
|
|
335
|
+
with open(self.minc_file, "r", encoding="latin-1") as f:
|
|
306
336
|
reading_minc = False
|
|
307
337
|
for line in f:
|
|
308
338
|
if line.startswith('ELEME-') or line.startswith('ELEME'):
|
|
@@ -326,7 +356,7 @@ class vis_reader:
|
|
|
326
356
|
has_conne = False
|
|
327
357
|
for input_file_path in self.setting.input_file_paths:
|
|
328
358
|
line_counter = 0
|
|
329
|
-
with open(input_file_path, encoding="
|
|
359
|
+
with open(input_file_path, "r", encoding="latin-1") as f:
|
|
330
360
|
|
|
331
361
|
reading_conne = False
|
|
332
362
|
for line in f:
|
|
@@ -356,7 +386,7 @@ class vis_reader:
|
|
|
356
386
|
|
|
357
387
|
for input_file_path in self.setting.input_file_paths:
|
|
358
388
|
line_counter = 0
|
|
359
|
-
with open(input_file_path, encoding="
|
|
389
|
+
with open(input_file_path, "r", encoding="latin-1") as f:
|
|
360
390
|
reading_rocks = False
|
|
361
391
|
for line in f:
|
|
362
392
|
if line.startswith('ROCKS-'):
|
|
@@ -397,7 +427,7 @@ class vis_reader:
|
|
|
397
427
|
|
|
398
428
|
for input_file_path in self.setting.input_file_paths:
|
|
399
429
|
line_counter = 0
|
|
400
|
-
with open(input_file_path, encoding="
|
|
430
|
+
with open(input_file_path, "r", encoding="latin-1") as f:
|
|
401
431
|
|
|
402
432
|
reading_incon = False
|
|
403
433
|
for line in f:
|
|
@@ -430,7 +460,7 @@ class vis_reader:
|
|
|
430
460
|
reading_pram = False
|
|
431
461
|
for input_file_path in self.setting.input_file_paths:
|
|
432
462
|
line_counter = 0
|
|
433
|
-
with open(input_file_path, encoding="
|
|
463
|
+
with open(input_file_path, "r", encoding="latin-1") as f:
|
|
434
464
|
reading_pram = False
|
|
435
465
|
for line in f:
|
|
436
466
|
if line.startswith('PARAM-'):
|
|
@@ -531,7 +561,7 @@ class vis_reader:
|
|
|
531
561
|
buffer.flush()
|
|
532
562
|
buffer.close()
|
|
533
563
|
|
|
534
|
-
with open(self.current_out_file, encoding="
|
|
564
|
+
with open(self.current_out_file, "r", encoding="latin-1") as f:
|
|
535
565
|
for line in f:
|
|
536
566
|
line_number = line_number + 1
|
|
537
567
|
values = line.strip().split(',')
|
|
@@ -587,7 +617,7 @@ class vis_reader:
|
|
|
587
617
|
start_index = -1
|
|
588
618
|
self.time_steps_list = []
|
|
589
619
|
|
|
590
|
-
with open(self.current_out_file, encoding="
|
|
620
|
+
with open(self.current_out_file, "r", encoding="latin-1") as f:
|
|
591
621
|
for line in f:
|
|
592
622
|
line_number = line_number + 1
|
|
593
623
|
values = line.strip().split(',')
|
|
@@ -673,8 +703,8 @@ class vis_reader:
|
|
|
673
703
|
value_type = ValueType.Unknown
|
|
674
704
|
start_index = -1
|
|
675
705
|
self.time_steps_list = []
|
|
676
|
-
|
|
677
|
-
with open(self.current_out_file, encoding="
|
|
706
|
+
|
|
707
|
+
with open(self.current_out_file, "r", encoding="latin-1") as f:
|
|
678
708
|
for line in f:
|
|
679
709
|
line_number = line_number + 1
|
|
680
710
|
values = line.strip().split(',')
|
|
@@ -760,7 +790,7 @@ class vis_reader:
|
|
|
760
790
|
scalar_headers = []
|
|
761
791
|
self.time_steps_list = []
|
|
762
792
|
|
|
763
|
-
with open(self.current_out_file, encoding="
|
|
793
|
+
with open(self.current_out_file, "r", encoding="latin-1") as f:
|
|
764
794
|
for line in f:
|
|
765
795
|
if line.strip().lower().startswith('Variables'.lower()):
|
|
766
796
|
headers_value = line.strip().split('=')[1]
|
|
@@ -1188,12 +1218,10 @@ class vis_reader:
|
|
|
1188
1218
|
index = self.sequence_dist[i]
|
|
1189
1219
|
if 'ELEM' in dataframe.columns:
|
|
1190
1220
|
index = dataframe['ELEM'].tolist().index(elemID)
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
#print(f' Processing ELEM {elem_string} at index {index}')
|
|
1221
|
+
else:
|
|
1222
|
+
index = int(index * minc_ratio)
|
|
1194
1223
|
for header in headers:
|
|
1195
|
-
|
|
1196
|
-
value = float(self.__parse_float(dataframe[header].iloc[minc_index]))
|
|
1224
|
+
value = float(self.__parse_float(dataframe[header].iloc[index]))
|
|
1197
1225
|
vtr.GetCellData().GetArray(header).InsertNextValue(value)
|
|
1198
1226
|
|
|
1199
1227
|
|
|
@@ -1752,7 +1780,7 @@ class vis_reader:
|
|
|
1752
1780
|
corners_buffer = io.StringIO()
|
|
1753
1781
|
csv_headers = []
|
|
1754
1782
|
line_number = -1
|
|
1755
|
-
with open(self.setting.corners_file, encoding="
|
|
1783
|
+
with open(self.setting.corners_file, "r", encoding="latin-1") as f:
|
|
1756
1784
|
for line in f:
|
|
1757
1785
|
line_number = line_number + 1
|
|
1758
1786
|
values = line.strip().split(',')
|
|
@@ -2543,7 +2571,7 @@ class vis_reader:
|
|
|
2543
2571
|
elif extension == '.csv':
|
|
2544
2572
|
self.setting.out_format_type = OutType.CSV
|
|
2545
2573
|
line_number = 0
|
|
2546
|
-
with open(out_file_path, encoding="
|
|
2574
|
+
with open(out_file_path, "r", encoding="latin-1") as f:
|
|
2547
2575
|
for line in f:
|
|
2548
2576
|
if line_number == 0:
|
|
2549
2577
|
first_col = line.split(',')[0].strip().lower()
|
|
@@ -2623,7 +2651,7 @@ class vis_charting:
|
|
|
2623
2651
|
|
|
2624
2652
|
variable_list_path = os.path.join(case_dir, "tough_vis", "variable_list.json")
|
|
2625
2653
|
if os.path.isfile(variable_list_path):
|
|
2626
|
-
with open(variable_list_path,
|
|
2654
|
+
with open(variable_list_path, "r", encoding="latin-1") as f:
|
|
2627
2655
|
self.variable_list = json.load(f)
|
|
2628
2656
|
else:
|
|
2629
2657
|
print(f'Case variable_list.json({variable_list_path}) not found.')
|
|
@@ -2631,7 +2659,7 @@ class vis_charting:
|
|
|
2631
2659
|
|
|
2632
2660
|
timestep_list_path = os.path.join(case_dir, "tough_vis", "timestep_list.json")
|
|
2633
2661
|
if os.path.isfile(timestep_list_path):
|
|
2634
|
-
with open(timestep_list_path,
|
|
2662
|
+
with open(timestep_list_path, "r", encoding="latin-1") as f:
|
|
2635
2663
|
self.time_steps_list = json.load(f)
|
|
2636
2664
|
else:
|
|
2637
2665
|
print(f'Case timestep_list.json({timestep_list_path}) not found.')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|