toughanimator 0.1.10__py3-none-any.whl → 0.1.12__py3-none-any.whl

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/run.py CHANGED
@@ -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 = "2D_Utransport_MINC"
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
- #reader.write_eleme_conne()
22
- #reader.write_geometry()
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
 
@@ -107,11 +107,39 @@ class vis_reader:
107
107
  if os.path.isdir(case_dir):
108
108
  config_path = os.path.join(case_dir, "config.json")
109
109
  if os.path.exists(config_path):
110
- with open(config_path, "r", encoding="utf-8") as config_file:
110
+ with open(config_path, "r", encoding="latin-1") as config_file:
111
111
  config = json.load(config_file)
112
+
112
113
  else:
113
- print(f"Config file:({config_path}) not found. Please create it.")
114
- sys.exit(1)
114
+
115
+ # find if INFILE or flow.inp under case_dir
116
+ input_files = []
117
+ output_files = []
118
+ corners_file = ""
119
+ for file_name in os.listdir(case_dir):
120
+ if file_name.upper() == "INFILE" or file_name.lower() == "flow.inp":
121
+ input_files.append(file_name)
122
+ if file_name.lower().endswith(".tec"):
123
+ output_files.append(file_name)
124
+
125
+ # if the file name contains "corners"
126
+ if "corners" in file_name.lower():
127
+ corners_file = file_name
128
+
129
+ # atomatically create a config.json file
130
+ config = {
131
+ "case_name": case_dir.split(os.sep)[-1],
132
+ "input_files": input_files,
133
+ "output_files": output_files,
134
+ "corners_file": corners_file
135
+ }
136
+
137
+ # save the file
138
+ with open(config_path, "w", encoding="latin-1") as config_file:
139
+ json.dump(config, config_file, indent=4)
140
+
141
+ #print(f"Config file:({config_path}) not found. Please create it.")
142
+ #sys.exit(1)
115
143
  else:
116
144
  print(f"Case directory:({case_dir}) not found. Please check it.")
117
145
  sys.exit(1)
@@ -276,7 +304,8 @@ class vis_reader:
276
304
  has_elem = False
277
305
  for input_file_path in self.setting.input_file_paths:
278
306
  line_counter = 0
279
- with open(input_file_path, encoding="utf-8") as f:
307
+ with open(input_file_path, "r", encoding="latin-1") as f:
308
+
280
309
  reading_elem = False
281
310
 
282
311
  for line in f:
@@ -302,7 +331,7 @@ class vis_reader:
302
331
  def __check_num_of_minc(self):
303
332
  #self.minc_buffer = io.StringIO()
304
333
  minc_num = 0
305
- with open(self.minc_file, encoding="utf-8") as f:
334
+ with open(self.minc_file, "r", encoding="latin-1") as f:
306
335
  reading_minc = False
307
336
  for line in f:
308
337
  if line.startswith('ELEME-') or line.startswith('ELEME'):
@@ -326,7 +355,7 @@ class vis_reader:
326
355
  has_conne = False
327
356
  for input_file_path in self.setting.input_file_paths:
328
357
  line_counter = 0
329
- with open(input_file_path, encoding="utf-8") as f:
358
+ with open(input_file_path, "r", encoding="latin-1") as f:
330
359
 
331
360
  reading_conne = False
332
361
  for line in f:
@@ -356,7 +385,7 @@ class vis_reader:
356
385
 
357
386
  for input_file_path in self.setting.input_file_paths:
358
387
  line_counter = 0
359
- with open(input_file_path, encoding="utf-8") as f:
388
+ with open(input_file_path, "r", encoding="latin-1") as f:
360
389
  reading_rocks = False
361
390
  for line in f:
362
391
  if line.startswith('ROCKS-'):
@@ -397,7 +426,7 @@ class vis_reader:
397
426
 
398
427
  for input_file_path in self.setting.input_file_paths:
399
428
  line_counter = 0
400
- with open(input_file_path, encoding="utf-8") as f:
429
+ with open(input_file_path, "r", encoding="latin-1") as f:
401
430
 
402
431
  reading_incon = False
403
432
  for line in f:
@@ -430,7 +459,7 @@ class vis_reader:
430
459
  reading_pram = False
431
460
  for input_file_path in self.setting.input_file_paths:
432
461
  line_counter = 0
433
- with open(input_file_path, encoding="utf-8") as f:
462
+ with open(input_file_path, "r", encoding="latin-1") as f:
434
463
  reading_pram = False
435
464
  for line in f:
436
465
  if line.startswith('PARAM-'):
@@ -531,7 +560,7 @@ class vis_reader:
531
560
  buffer.flush()
532
561
  buffer.close()
533
562
 
534
- with open(self.current_out_file, encoding="utf-8") as f:
563
+ with open(self.current_out_file, "r", encoding="latin-1") as f:
535
564
  for line in f:
536
565
  line_number = line_number + 1
537
566
  values = line.strip().split(',')
@@ -587,7 +616,7 @@ class vis_reader:
587
616
  start_index = -1
588
617
  self.time_steps_list = []
589
618
 
590
- with open(self.current_out_file, encoding="utf-8") as f:
619
+ with open(self.current_out_file, "r", encoding="latin-1") as f:
591
620
  for line in f:
592
621
  line_number = line_number + 1
593
622
  values = line.strip().split(',')
@@ -673,8 +702,8 @@ class vis_reader:
673
702
  value_type = ValueType.Unknown
674
703
  start_index = -1
675
704
  self.time_steps_list = []
676
-
677
- with open(self.current_out_file, encoding="utf-8") as f:
705
+
706
+ with open(self.current_out_file, "r", encoding="latin-1") as f:
678
707
  for line in f:
679
708
  line_number = line_number + 1
680
709
  values = line.strip().split(',')
@@ -760,7 +789,7 @@ class vis_reader:
760
789
  scalar_headers = []
761
790
  self.time_steps_list = []
762
791
 
763
- with open(self.current_out_file, encoding="utf-8") as f:
792
+ with open(self.current_out_file, "r", encoding="latin-1") as f:
764
793
  for line in f:
765
794
  if line.strip().lower().startswith('Variables'.lower()):
766
795
  headers_value = line.strip().split('=')[1]
@@ -1188,12 +1217,10 @@ class vis_reader:
1188
1217
  index = self.sequence_dist[i]
1189
1218
  if 'ELEM' in dataframe.columns:
1190
1219
  index = dataframe['ELEM'].tolist().index(elemID)
1191
- #elem_string = dataframe['ELEM'].iloc[index]
1192
- #target_row = dataframe.iloc[index]
1193
- #print(f' Processing ELEM {elem_string} at index {index}')
1220
+ else:
1221
+ index = int(index * minc_ratio)
1194
1222
  for header in headers:
1195
- minc_index = int(index * minc_ratio)
1196
- value = float(self.__parse_float(dataframe[header].iloc[minc_index]))
1223
+ value = float(self.__parse_float(dataframe[header].iloc[index]))
1197
1224
  vtr.GetCellData().GetArray(header).InsertNextValue(value)
1198
1225
 
1199
1226
 
@@ -1752,7 +1779,7 @@ class vis_reader:
1752
1779
  corners_buffer = io.StringIO()
1753
1780
  csv_headers = []
1754
1781
  line_number = -1
1755
- with open(self.setting.corners_file, encoding="utf-8") as f:
1782
+ with open(self.setting.corners_file, "r", encoding="latin-1") as f:
1756
1783
  for line in f:
1757
1784
  line_number = line_number + 1
1758
1785
  values = line.strip().split(',')
@@ -2543,7 +2570,7 @@ class vis_reader:
2543
2570
  elif extension == '.csv':
2544
2571
  self.setting.out_format_type = OutType.CSV
2545
2572
  line_number = 0
2546
- with open(out_file_path, encoding="utf-8") as f:
2573
+ with open(out_file_path, "r", encoding="latin-1") as f:
2547
2574
  for line in f:
2548
2575
  if line_number == 0:
2549
2576
  first_col = line.split(',')[0].strip().lower()
@@ -2623,7 +2650,7 @@ class vis_charting:
2623
2650
 
2624
2651
  variable_list_path = os.path.join(case_dir, "tough_vis", "variable_list.json")
2625
2652
  if os.path.isfile(variable_list_path):
2626
- with open(variable_list_path, "r", encoding="utf-8") as f:
2653
+ with open(variable_list_path, "r", encoding="latin-1") as f:
2627
2654
  self.variable_list = json.load(f)
2628
2655
  else:
2629
2656
  print(f'Case variable_list.json({variable_list_path}) not found.')
@@ -2631,7 +2658,7 @@ class vis_charting:
2631
2658
 
2632
2659
  timestep_list_path = os.path.join(case_dir, "tough_vis", "timestep_list.json")
2633
2660
  if os.path.isfile(timestep_list_path):
2634
- with open(timestep_list_path, "r", encoding="utf-8") as f:
2661
+ with open(timestep_list_path, "r", encoding="latin-1") as f:
2635
2662
  self.time_steps_list = json.load(f)
2636
2663
  else:
2637
2664
  print(f'Case timestep_list.json({timestep_list_path}) not found.')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toughanimator
3
- Version: 0.1.10
3
+ Version: 0.1.12
4
4
  Summary: A tool for visualizing TOUGH simulation outputs.
5
5
  Home-page: https://github.com/scarletref/toughanimator
6
6
  Author: scarletref
@@ -0,0 +1,7 @@
1
+ toughanimator/__init__.py,sha256=m1f3fJ1SNGLNKxHlS0pLNHwaHlN6UUTh5GpS_8hC8kw,30
2
+ toughanimator/run.py,sha256=20BqrpQyNxdGPlcKFYoiQ8nFGamjDhUYhdmWlQOnIok,1038
3
+ toughanimator/tough_classes.py,sha256=kCXuw1BhCOoLcSi1gVUexpOn6Ynf5OJ1ooU-kSksQXc,124388
4
+ toughanimator-0.1.12.dist-info/METADATA,sha256=h8shCedbwa0imNa6JQt1x6yC4TpdC9P2pxze3LFrcP4,4571
5
+ toughanimator-0.1.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ toughanimator-0.1.12.dist-info/top_level.txt,sha256=pAT-UflvbjT4lTmBdzHqApZGWbywkSM3Y_qsHyLi4pU,14
7
+ toughanimator-0.1.12.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- toughanimator/__init__.py,sha256=m1f3fJ1SNGLNKxHlS0pLNHwaHlN6UUTh5GpS_8hC8kw,30
2
- toughanimator/run.py,sha256=niOqZDCWYHBzLdZfRyglHRb8mGfduu9mGgs3Jh2-Ohc,921
3
- toughanimator/tough_classes.py,sha256=TJP8B1gGCaSFsrjELd01A0aqSmChEXGxQM-WZyHsu94,123281
4
- toughanimator-0.1.10.dist-info/METADATA,sha256=8sXZSX-4aEuWNG-HlOCgCJX9LwnF50grsRk_j7GStsk,4571
5
- toughanimator-0.1.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- toughanimator-0.1.10.dist-info/top_level.txt,sha256=pAT-UflvbjT4lTmBdzHqApZGWbywkSM3Y_qsHyLi4pU,14
7
- toughanimator-0.1.10.dist-info/RECORD,,