REGISTER NOW: Brightway Spring School! 🇨🇦 Québec City (Canada) 🗓️ 20.-24. May 2024

bw2data.backends.iotable.backend#

Module Contents#

Classes#

IOTableBackend

IO tables have too much data to store each value in a database; instead, we only store the processed data in NumPy arrays.

class bw2data.backends.iotable.backend.IOTableBackend(*args, **kwargs)[source]#

Bases: bw2data.backends.SQLiteBackend

Inheritance diagram of bw2data.backends.iotable.backend.IOTableBackend

IO tables have too much data to store each value in a database; instead, we only store the processed data in NumPy arrays.

Activities will not seem to have any exchanges.

backend = 'iotable'[source]#
node_class[source]#
edges_to_dataframe() pandas.DataFrame[source]#

Return a pandas DataFrame with all database exchanges. DataFrame columns are:

target_id: int, target_database: str, target_code: str, target_name: Optional[str], target_reference_product: Optional[str], target_location: Optional[str], target_unit: Optional[str], target_type: Optional[str] source_id: int, source_database: str, source_code: str, source_name: Optional[str], source_product: Optional[str], # Note different label source_location: Optional[str], source_unit: Optional[str], source_categories: Optional[str] # Tuple concatenated with “::” as in bw2io edge_amount: float, edge_type: str,

Target is the node consuming the edge, source is the node or flow being consumed. The terms target and source were chosen because they also work well for biosphere edges.

As IO Tables are normally quite large, the DataFrame building will operate directly on Numpy arrays, and therefore special formatters are not supported in this function.

Returns a pandas DataFrame.

process()[source]#

No-op; no intermediate data to process

write(data, process=False, searchable=True)[source]#

Write data to database.

data must be a dictionary of the form:

{
    ('database name', 'dataset code'): {dataset}
}

Writing a database will first deletes all existing data.

write_exchanges(technosphere, biosphere, dependents)[source]#

Write IO data directly to processed arrays.

Product data is stored in SQLite as normal activities. Exchange data is written directly to NumPy structured arrays.

Technosphere and biosphere data has format (row id, col id, value, flip).