txt2sqlite

txt2sqlite.checktable(table_name, c)[source]

It verifies the existance of a table on the sqlite database

Parameters
  • table_name (str) – Table name

  • c (cursor) – Conection to the database

Returns

check: if table exists returns 1

Return type

int

Examples

>>>  checktable(table_name,c)
txt2sqlite.db_creation(input_dictionary)[source]

It creates a sqlite databa base

Parameters

input_dictionary (dictionary) – Dictionary contaning the path and name of database on keyword ‘db_path’, usually on ‘../input/’

Returns

name: database on desire path

Return type

database

Note

The tables: wells, survey, PT, mh, drawdown, cooling, wellfeedzone, t2wellblock, t2wellsource, layers and t2PTout are generated

Examples

>>> db_creation(input_dictionary)
txt2sqlite.insert_PT_to_sqlite(input_dictionary)[source]

It stores all the data contain on the subfolder PT from the input file folder.

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

The PT for every well must have the next headers MD,P,T. The file name must be well_MDPT.dat

Examples

>>>  insert_PT_to_sqlite(input_dictionary)
txt2sqlite.insert_cooling_to_sqlite(input_dictionary)[source]

It stores all the data contain on the subfolder cooling from the input file folder.

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

The cooling register on every well must have the next headers datetime,TVD,temperature. The file name must be well_C.dat

Examples

>>>  insert_cooling_to_sqlite(input_dictionary)
txt2sqlite.insert_drawdown_to_sqlite(input_dictionary)[source]

It stores all the data contain on the subfolder drawdown from the input file folder.

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

The drawdown register on every well must have the next headers datetime,TVD,pressure. The file name must be well_DD.dat

Examples

>>>  insert_drawdown_to_sqlite(input_dictionary)
txt2sqlite.insert_feedzone_to_sqlite(input_dictionary)[source]

It stores the data contain on the ubication.csv file and stores it on the database

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Examples

>>>  insert_feedzone_to_sqlite(input_dictionary)
txt2sqlite.insert_filtered_mh_to_sqlite(input_dictionary, single_well=None)[source]

It stores all the data contain on the subfolder mh from the input file folder.

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

Every file contains information about the flow rate and flowing enthalpy of the wells. Every register must contain the next headers: type,date-time,steam,liquid,enthalpy,WHPabs. The file name must be name well_mh.dat

Examples

>>>  insert_mh_to_sqlite(input_dictionary)
txt2sqlite.insert_layers_to_sqlite(input_dictionary)[source]

It stores layers and elevations

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

The data information comes from the input_dictionary which must have a keyword layer with a similar structure as following: ‘LAYERS’:{1:[‘A’,100],2:[‘B’, 100]}. Some print output are expected.

Examples

>>>  insert_layers_to_sqlite(input_dictionary)
txt2sqlite.insert_raw_mh_to_sqlite(input_dictionary)[source]

It stores all the data contain on the subfolder mh from the input file folder.

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

Every file contains information about the flow rate and flowing enthalpy of the wells. Every register must contain the next headers: type,date-time,steam,liquid,enthalpy,WHPabs. The file name must be name well_mh.dat

Examples

>>>  insert_mh_to_sqlite(input_dictionary)
txt2sqlite.insert_survey_to_sqlite(input_dictionary)[source]

It stores all the data contain on the subfolder survey from the input file folder.

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

The survey for every well must have the next headers MeasuredDepth,Delta_north,Delta_east

Examples

>>>  insert_survey_to_sqlite(input_dictionary)
txt2sqlite.insert_wellblock_to_sqlite(input_dictionary)[source]

It stores the file wells_correlative.txt coming from regeo_mesh on the table t2wellblock

Parameters

input_dictionary (dictionary) – A dictionary containing the name and path of database ans well types WELLS, MAKE_UP_WELLS and NOT_PRODUCING_WELLS

Note

The correlative from each wells just contains four characthers. Some print output are expected.

Examples

>>>  insert_wellblock_to_sqlite(input_dictionary)
txt2sqlite.insert_wells_sqlite(input_dictionary)[source]

It stores the data contain on the ubication.csv file and stores it on the database

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

The well name is written as primary key. Thus, if the coordinates of the file ubication.csv change, it is better to eliminate the records and rerun this function again. Some print are expected.

Examples

>>>  insert_wells_sqlite(input_dictionary)
txt2sqlite.replace_mh(wells_to_replace, input_dictionary)[source]

It stores all the data contain on the subfolder mh from the input file folder from some selected wells

Parameters
  • input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

  • wells_to_replace (list) – Contains the data from the wells which flow data will be replace

Note

Every file contains information about the flow rate and flowing enthalpy of the wells. Every register must contain the next headers: type,date-time,steam,liquid,enthalpy,WHPabs. The file name must be name well_mh.dat

Examples

>>>  replace_mh(wells_to_replace=['WELL-1','WELL-2'],input_dictionary)
txt2sqlite.sqlite_to_json(input_dictionary)[source]

It exports the database into a single json file

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file

Note

It creates from the tables wells, survey, PT, mh, drawdown, wellfeedzone, t2wellblock and t2wellsource a json file, using as ID the field well

Other Parameters

dictionary – levels : configuration dictionary, indicates the table name, the ID to use and the field to use on each table

Examples

>>>  sqlite_to_json(input_dictionary)
txt2sqlite.src_rocktype(input_dictionary)[source]

It sets the rocktype for each source on the table t2wellsource, based on the data on ELEME.json

Parameters

input_dictionary (dictionary) – Dictionary containing the path and name of database