ppcpy.io.sql_interaction#

Functions

get_LC_from_sql_db

Accesses the sqlite db table and returns LC for all cloud-free-regions )profiles)

prepare_for_sql_db_writing

Collect all necessary variable and save it to a list of tuples for inserting into a SQLite table.

setup_empty

Create/Initialise an empty database.

write_rows_to_sql_db

Insert multiple rows into a SQLite table.

ppcpy.io.sql_interaction.get_LC_from_sql_db(db_path: str, table_name: str, wavelength: int | str, method: str, telescope: str, timestamp: str) dict[source]#

Accesses the sqlite db table and returns LC for all cloud-free-regions )profiles)

Parameters: - db_path (str): name of the specific sqlite db file. - table_name (str): default ‘lidar_calibration_constant’ - wavelength (int or str): the wavelength - method (str): Klett or Raman - telescope (str): NR or FR - timestamp (str): the date or timestamp to look for Output: - LC (dict): containing all profiles as list

ppcpy.io.sql_interaction.prepare_for_sql_db_writing(data_cube, parameter: str, method: str) list[tuple][source]#

Collect all necessary variable and save it to a list of tuples for inserting into a SQLite table.

Parameters: - data_cube (object) - parameter (str): LC or DC - method (str): klett or raman Output: - rows_to_insert (list of tuples)

ppcpy.io.sql_interaction.setup_empty(db_path: str, table_name: str, column_names: list[str], data_types: list[str])[source]#

Create/Initialise an empty database.

Parameters: - db_path (str): Path to the SQLite database file. - table_name (str): Name of the target table. - column_names (list of str): List of column names to insert values into (e.g. [‘col1’, ‘col2’]). - data_types (list of str): List of SQLite data types for each respective columns (e.g. [‘text’, ‘real’])

ppcpy.io.sql_interaction.write_rows_to_sql_db(db_path: str, table_name: str, column_names: list[str], rows_to_insert: list[str])[source]#

Insert multiple rows into a SQLite table.

Parameters: - db_path (str): Path to the SQLite database file. - table_name (str): Name of the target table. - column_names (list of str): List of column names to insert values into (e.g. [‘col1’, ‘col2’]). - rows_to_insert (list of tuples): Data to insert, e.g. [(‘a’, ‘b’), (‘c’, ‘d’)].