bw2data.data_store#
Classes#
Base class for all Brightway2 data stores. Subclasses should define: |
|
Brightway2 data stores that can be processed to NumPy arrays. |
Module Contents#
- class bw2data.data_store.DataStore(name)[source]#
Base class for all Brightway2 data stores. Subclasses should define:
metadata: A serialized-dict instance, e.g.
databases
ormethods
. The custom is that each type of data store has a new metadata store, so the data storeFoo
would have a metadata storefoos
.validator: A data validator. Optional. See bw2data.validate.
- copy(name)[source]#
Make a copy of this object with a new
name
.This method only changes the name, but not any of the data or metadata.
- Parameters:
name (*) – Name of the new object.
- Returns:
The new object.
- register(**kwargs)[source]#
Register an object with the metadata store. Takes any number of keyword arguments.
- class bw2data.data_store.ProcessedDataStore(name)[source]#
Bases:
DataStore
Brightway2 data stores that can be processed to NumPy arrays.
In addition to
metadata
and (optionally)validator
, subclasses should overrideadd_geomappings
. This method takes the entire dataset, and loads objects to geomapping as needed.- add_geomappings(data)[source]#
Add objects to
geomapping
, if necessary.- Parameters:
data (*) – The data
- process(**extra_metadata)[source]#
Process intermediate data from a Python dictionary to a stats_arrays array, which is a NumPy Structured Array. A structured array (also called record array) is a heterogeneous array, where each column has a different label and data type.
Processed arrays are saved in the
processed
directory.If the uncertainty type is no uncertainty, undefined, or not specified, then the ‘amount’ value is used for ‘loc’ as well. This is needed for the random number generator.
Doesn’t return anything, but writes a file to disk.