6.1.1.1. thyrsis.database package¶
6.1.1.1.1. Submodules¶
- 6.1.1.1.1.1. thyrsis.database.build_model module
- 6.1.1.1.1.2. thyrsis.database.extract_measure module
- 6.1.1.1.1.3. thyrsis.database.load_chemicals module
- 6.1.1.1.1.4. thyrsis.database.load_forages module
- 6.1.1.1.1.5. thyrsis.database.load_measure module
- 6.1.1.1.1.6. thyrsis.database.load_points module
- 6.1.1.1.1.7. thyrsis.database.load_potentiel_reference module
- 6.1.1.1.1.8. thyrsis.database.raster_points module
- 6.1.1.1.1.9. thyrsis.database.sqlite module
6.1.1.1.2. Module contents¶
Thyrsis spatialite database structure
- USAGE
python -m thyrsis.database siteName simulationName ouput.sqlite
create a computation db from template
- class thyrsis.database.DebugCursor(cur)¶
Bases:
object
Unused
- execute(sql)¶
- executemany(sql, arg)¶
- fetchall()¶
- fetchone()¶
- thyrsis.database.add_second_milieu(database)¶
Copy existing table to create a dual-porosity simulation
- Parameters
database (string) – database path
- thyrsis.database.create_computation_database(database, mesh_db=None, simulation_name=None, exp_db=None)¶
Create a computation database from a mesh site
- Parameters
database (string) – database path
mesh_db (string) – mesh database path
simulation_name (string) – simulation name
- thyrsis.database.create_injection_triggers(cur)¶
Create injection triggers in the current database
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- thyrsis.database.create_latin_hypercube(cur, nombre_de_simulations=1)¶
Use latin hypercube to create n simulations
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
nombre_de_simulations (integer) – n simulations
- thyrsis.database.create_mesh_tables(cur, project_SRID=None)¶
create tables for mesh (noeuds and mailles) The spatial index of maille may be corrupted by inserts/update
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
project_SRID (string) – EPSG code
- thyrsis.database.create_metadata_table(cur)¶
Create metadata table in the current database
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- thyrsis.database.create_site_tables(cur, with_cid=False, project_SRID=None)¶
create site tables without cid and sid columns (only one site and one simulation
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
with_cid (bool) – cid option, create a cid column in tables
project_SRID (string) – EPSG code
- thyrsis.database.database_type(cur)¶
return database type
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- Returns
db_type
- Return type
string
- thyrsis.database.db_elem_to_node(cur, column, elem_values)¶
updates nodes table from mesh table
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
column (string) – column name
elem_values (list) – list of element value for a column
- thyrsis.database.db_node_to_elem(cur, column, node_values)¶
updates mesh table from nodes table
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
column (string) – column name
node_values (list) – list of node value for a column
- thyrsis.database.delete_injection_triggers(cur)¶
Delete injection triggers in the current database
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- thyrsis.database.delete_mesh(cur, test=False)¶
Delete mesh data in the current database
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- thyrsis.database.delete_results(cur)¶
Delete result tables in the current database
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- thyrsis.database.elem_to_node(noeuds, mailles, elem_values)¶
returns node values with format ((value, id), …)
- Parameters
noeuds (list) – nodes
mailles (list) – mesh elements
elem_values (list) – list of element value for a column
- Returns
nodes values
- Return type
list
- thyrsis.database.export_simulation(src, dst)¶
export the simulation in src to the site database
- Parameters
src (string) – source database path
dst (string) – destination database path
- thyrsis.database.has_second_milieu(cur)¶
Check if the current database is made for dual-porosity simulation
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- thyrsis.database.mesh_tables_exists(cur)¶
test if mesh tables exist
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- Returns
success state
- Return type
bool
- thyrsis.database.node_to_elem(mailles, node_values)¶
returns mesh values with format ((value, id), …)
- Parameters
mailles (list) – mesh elements
node_values (list) – list of node value for a column
- Returns
mesh values
- Return type
list
- thyrsis.database.parametres_simulation_exists(cur)¶
Check if the simulation parameters exists
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- Returns
success state
- Return type
bool
- thyrsis.database.set_default_param(database)¶
set default parameter
- Parameters
database (string) – database path
- thyrsis.database.simulation_mesh(cur, simulation)¶
Get mesh name from simulation table
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
simulation (string) – simulation name
- Returns
nom_db_maillage
- Return type
string
- thyrsis.database.table_exists(database, table)¶
- thyrsis.database.upgrade(database)¶
upgrade database to current schema version, raise exception if not possible do nothing if the version is already OK
- Parameters
database (string) – database path
- thyrsis.database.upgrade_none_to_180321(src, dst, project_SRID=None)¶
upgrade database to 18.03.21 schema version, raise exception if not possible do nothing if the version is already OK
- Parameters
src (string) – source database path
dst (string) – destination database path
project_SRID (string) – EPSG code
- thyrsis.database.version(cur)¶
return db version, None if metadata is not there
- Parameters
cur (sqlite3.Cursor) – cursor on a sqlite connection
- Returns
db version
- Return type
string