Utilities Class

TOUGHREACT Utilities

class pytoughreact.utilities.t2_tough_react_utilities.T2UtilitiesToughReact(location, word, mesh_file_name='MESH')[source]

This class prepares the output files from TOUGHREACT for plot visualizations and analysis

__init__(location, word, mesh_file_name='MESH')[source]

Initialization of Parameters An instance of this class takes in five parameters the last of which is optional;

Parameters:
  • location (string) – The current file location where the simulations have been carried out

  • word (string) – The word where the truncation in the MESH file is to begin. Typically this should be ‘CONNE’

  • mesh_file_name (string) – The name of the mesh file

copy_all_files(filenames)[source]

This method copies all files given in the instance of the class to the destination folder. It makes use of the copyfile() method in achieving this

Parameters:

filenames (list) – list of all filename

copy_file(filename, destination)[source]

This method copies single file from the location to the destination folder. it takes in a a single argument

Parameters:
  • filename (str) – the name of the file to be transferred

  • destination (str) – the name of the file to receive it

find_word()[source]

This method finds the word where the truncation of the MESH file is to occur.

Returns:

point – point where MESH word is found

Return type:

int

slice_off_file()[source]

This method slices off all parameters below the word stated in the instance of the class

Returns:

point – point where MESH word is found

Return type:

int

slice_off_line()[source]

This method slices off all grid parameter such as the volume, distance betweeen grids as stated in the TOUGHREACT flow.inp file

The aim of the findword(), sliceofffile() and this method is to provide us with a list of all gridblocks in the simulation

Returns:

output – list of grids

Return type:

list

write_to_file()[source]

This method writes all gridblocks to a separate file called ‘test.txt’ for easy location and onward manipulations

The aim of the find_word(), slice_off_file() and this method is to provide us with a list of all gridblocks in the simulation

TOUGH3 Utilities

class pytoughreact.utilities.t2_utilities.T2Utilities[source]
__init__()[source]
chop_list(input_list, step_increase=3)[source]

Reduce the length of the list

Parameters:
  • input_list (list[float]) – List for which its size is to be reduced

  • step_increase (int) – Step increase to used in the length reduction

Returns:

final_processed_list – List data after reduction

Return type:

list

convert_parameter_name(param)[source]

Convert Parameters to conventional names

Parameters:

param (string) – Parameter to be derived from data

Returns:

converted_output – parameter after conversion

Return type:

string

convert_times(arraylist, format_of_date)[source]

Convert times to second/minute/hour/day/year

Parameters:
  • arraylist (list) – Array of the time to be converted

  • format_of_date (str) – Provides information to the method on format of the date. For example. year, hour, min or seconds

Returns:

processed_time_data – Time data after conversion

Return type:

list

cust_range(*args, rtol=1e-05, atol=1e-08, include=[True, False])[source]

Combines numpy.arange and numpy.isclose to mimic open, half-open and closed intervals. Avoids also floating point rounding errors as with >>> numpy.arange(1, 1.3, 0.1) array([1. , 1.1, 1.2, 1.3])

args: [start, ]stop, [step, ]

as in numpy.arange

rtol, atol: floats

floating point tolerance as in numpy.isclose

include: boolean list-like, length 2

if start and end point are included

fmt(x, pos)[source]

Format string

Parameters:

x (string) – String to be formatted

Returns:

output – String after formatting

Return type:

string

get_grid_number(data_frame, direction)[source]

Get today number of grids in a particular direction

Parameters:
  • data_frame (pd.Dataframe) – Dataframe containing coordinate info

  • direction (string) – Direction in which the get grid number

Returns:

grid_details – Grid information

Return type:

list

get_number_of_grids(input_list)[source]

Get number of grids in simulation

Parameters:

input_list (list) – List to determine number of grids

Returns:

total_number_of_grids – Total number of grids

Return type:

int

param_label_full(param)[source]

Get Full Names of TOUGHREACT and TMVIO parameters to be embedded in graphs

Parameters:

param (string) – Parameter to be derived from data

Returns:

output – Full name of parameter

Return type:

string

remove_repetiting(time_list, value_list)[source]

Remove repetiting values

Parameters:
  • time_list (list[float]) – Time data list

  • value_list (list[float]) – Result data list

Returns:

final_time_list, final_value_list – List data after removing repetiting values

Return type:

list , list

trim_data_points(time_data, result_data, slice_value)[source]

Trim the result output to avoid too many points on a graph

Parameters:
  • time_data (list[float]) – Time data list

  • result_data (list[float]) – Result data list

  • slice_value (float) – Number at which to trim the data

Returns:

time_data, result_data – List data after trimming

Return type:

list , list