6.1.1.7. thyrsis.utilities package¶
6.1.1.7.1. Submodules¶
6.1.1.7.2. Module contents¶
- class thyrsis.utilities.ConsoleLogger¶
Bases:
object
takes the place of QgsMessageBar { INFO = 0, WARNING = 1, CRITICAL = 2, SUCCESS = 3 }
- pushCritical(title, msg)¶
Push critical message
- Parameters
title (string) – title msg
msg (string) – msg
- pushInfo(title, msg)¶
Push info message
- Parameters
title (string) – title msg
msg (string) – msg
- pushWarning(title, msg)¶
Push warning message
- Parameters
title (string) – title msg
msg (string) – msg
- class thyrsis.utilities.Timer¶
Bases:
object
Timer class
- reset(text='')¶
Reset start after displaying the duration since the last reset
- Parameters
text (string) – text to display
- Returns
time to display
- Return type
string
- thyrsis.utilities.available_mpi()¶
- thyrsis.utilities.check_float(s)¶
checks if a string is a float and returns the float, else returns 0
- Parameters
s (undetermined) – value to check
- Returns
converted value or 0
- Return type
float
- thyrsis.utilities.check_sip_api()¶
Check SIP api
- thyrsis.utilities.cleanup_dirname(directory)¶
Return a clean dirname
- Parameters
name (string) – folder path
- Returns
folder path
- Return type
string
- thyrsis.utilities.complete_filename(name)¶
Return the absolute path of a file
- Parameters
name (string) – file name
- Returns
absolute path
- Type
string
- thyrsis.utilities.complete_image_name(name)¶
Return the absolute path of a file in images subfolder
- Parameters
name (string) – file name
- Returns
absolute path
- Type
string
- thyrsis.utilities.convert_nodes(t)¶
Convert an array (dates, mesh element) into an array (dates, nodes) for 1D unsaturated columns
- Parameters
t (numpy.ndarray) – mesh elements array
- Returns
nodes array
- Return type
numpy.ndarray
- thyrsis.utilities.durationCheck(duration, patterns, object_=None)¶
Check duration value
- Parameters
duration (string) – duration
patterns (list) – list of patterns
object (QObject) – qobject
- Returns
duration
- Return type
string
- thyrsis.utilities.format_(min_, max_)¶
Define format (scientific or normal)
- Parameters
min (float) – interval min value
max (float) – interval max value
- Returns
format
- Type
string
- thyrsis.utilities.interpolationWeights(point, element)¶
give interpolation weights for a point in a triangle or quad
- Parameters
point (tuple) – point xy
element (list of vertices coord) – mesh element
- Returns
list of weight
- Return type
list
- thyrsis.utilities.interpolationWeightsQuad(point, element)¶
Interpolation weight in quad mesh, not configured
- Parameters
point (tuple) – point xy
element (list of vertices coord) – mesh element
- Returns
list of weight
- Return type
list
- thyrsis.utilities.interpolationWeightsTri(point, element)¶
Interpolation weight in triangle mesh barycentric interpolation
- Parameters
point (tuple) – point xy
element (list of vertices coord) – mesh element
- Returns
list of weight
- Return type
list
- thyrsis.utilities.number_lines(filename, strg='')¶
Return the number of line per strg. By default, return the total lines in the file
- Parameters
filename (string) – path of the file to read
strg (string) – delimiter
- Returns
number of line
- Return type
integer
- thyrsis.utilities.parse_file(file_name, nb_values_per_elem, nb_of_elem)¶
parse file that contains a list of space separated value returns a list of tuples with the line number in last position
- Parameters
file_name (string) – path of the project folder
nb_values_per_elem (integer) – number of value for a element, used to parse file
nb_of_elem (integer) – number of element, used to parse file
- Returns
list of tuples with the project data
- Return type
list
- thyrsis.utilities.read_one_column_file(filename, exclude=None)¶
reads a one-column file and returns the values as list, excluding void lines
- Parameters
filename (string) – path of the file to read
exclude (list) – list of excluded columns
- Returns
column values
- Return type
list
- thyrsis.utilities.read_site_param(filename)¶
return a dict of parameters
- Parameters
filename (string) – file name
- Returns
dict parameters
- Return type
dict
- thyrsis.utilities.save_read(save_file)¶
unused
- thyrsis.utilities.set_sip_api()¶
Set SIP api
- thyrsis.utilities.suite_geom(height, min_length, max_length, coef)¶
- thyrsis.utilities.toSeconds(duree)¶
Convert day/month/year duration in seconds
- Parameters
duree (string) – duration
- Returns
duration in seconds
- Return type
float
- thyrsis.utilities.unitConversionFactor(sourceUnit, targetUnit, specificActivity=0.0)¶
Return conversion factor between two units
- Parameters
sourceUnit (string) – sourceUnit
targetUnit (string) – targetUnit
specificActivity (float) – specificActivity
- Returns
factor
- Return type
float
- thyrsis.utilities.zns_nodes(position, __height, coef, vgamax)¶
Return a list of nodes (x,y,z,s) of decreasing altitude for the zns s = surface du noeud
- Parameters
position (tuple) – (x,y,z) of the column
height (float) – of the colum
coef (float) – max/min interval length
vgamax – max value of Van Genuchten alpha parameter
- Returns
list of nodes (x,y,z,s) of decreasing altitude for the zns
- Return type
list