6.1.1.7. thyrsis.utilities package

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

Paramètres
  • title (string) – title msg

  • msg (string) – msg

pushInfo(title, msg)

Push info message

Paramètres
  • title (string) – title msg

  • msg (string) – msg

pushWarning(title, msg)

Push warning message

Paramètres
  • 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

Paramètres

text (string) – text to display

Renvoie

time to display

Type renvoyé

string

thyrsis.utilities.available_mpi()
thyrsis.utilities.check_float(s)

checks if a string is a float and returns the float, else returns 0

Paramètres

s (undetermined) – value to check

Renvoie

converted value or 0

Type renvoyé

float

thyrsis.utilities.check_sip_api()

Check SIP api

thyrsis.utilities.cleanup_dirname(directory)

Return a clean dirname

Paramètres

name (string) – folder path

Renvoie

folder path

Type renvoyé

string

thyrsis.utilities.complete_filename(name)

Return the absolute path of a file

Paramètres

name (string) – file name

Renvoie

absolute path

Type

string

thyrsis.utilities.complete_image_name(name)

Return the absolute path of a file in images subfolder

Paramètres

name (string) – file name

Renvoie

absolute path

Type

string

thyrsis.utilities.convert_nodes(t)

Convert an array (dates, mesh element) into an array (dates, nodes) for 1D unsaturated columns

Paramètres

t (numpy.ndarray) – mesh elements array

Renvoie

nodes array

Type renvoyé

numpy.ndarray

thyrsis.utilities.durationCheck(duration, patterns, object_=None)

Check duration value

Paramètres
  • duration (string) – duration

  • patterns (list) – list of patterns

  • object (QObject) – qobject

Renvoie

duration

Type renvoyé

string

thyrsis.utilities.format_(min_, max_)

Define format (scientific or normal)

Paramètres
  • min (float) – interval min value

  • max (float) – interval max value

Renvoie

format

Type

string

thyrsis.utilities.interpolationWeights(point, element)

give interpolation weights for a point in a triangle or quad

Paramètres
  • point (tuple) – point xy

  • element (list of vertices coord) – mesh element

Renvoie

list of weight

Type renvoyé

list

thyrsis.utilities.interpolationWeightsQuad(point, element)

Interpolation weight in quad mesh, not configured

Paramètres
  • point (tuple) – point xy

  • element (list of vertices coord) – mesh element

Renvoie

list of weight

Type renvoyé

list

thyrsis.utilities.interpolationWeightsTri(point, element)

Interpolation weight in triangle mesh barycentric interpolation

Paramètres
  • point (tuple) – point xy

  • element (list of vertices coord) – mesh element

Renvoie

list of weight

Type renvoyé

list

thyrsis.utilities.number_lines(filename, strg='')

Return the number of line per strg. By default, return the total lines in the file

Paramètres
  • filename (string) – path of the file to read

  • strg (string) – delimiter

Renvoie

number of line

Type renvoyé

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

Paramètres
  • 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

Renvoie

list of tuples with the project data

Type renvoyé

list

thyrsis.utilities.read_one_column_file(filename, exclude=None)

reads a one-column file and returns the values as list, excluding void lines

Paramètres
  • filename (string) – path of the file to read

  • exclude (list) – list of excluded columns

Renvoie

column values

Type renvoyé

list

thyrsis.utilities.read_site_param(filename)

return a dict of parameters

Paramètres

filename (string) – file name

Renvoie

dict parameters

Type renvoyé

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

Paramètres

duree (string) – duration

Renvoie

duration in seconds

Type renvoyé

float

thyrsis.utilities.unitConversionFactor(sourceUnit, targetUnit, specificActivity=0.0)

Return conversion factor between two units

Paramètres
  • sourceUnit (string) – sourceUnit

  • targetUnit (string) – targetUnit

  • specificActivity (float) – specificActivity

Renvoie

factor

Type renvoyé

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

Paramètres
  • 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

Renvoie

list of nodes (x,y,z,s) of decreasing altitude for the zns

Type renvoyé

list