REGISTER NOW: DdS Autumn School! 🇨🇭 Grosshöchstetten (Switzerland) 🗓️ 6.-11. October 2024

bw2data.backends.utils#

Module Contents#

Functions#

check_exchange(exc)

Check exchange data validity when processing

convert_backend(database_name, backend)

Convert a Database to another backend.

dict_as_activitydataset(ds)

dict_as_exchangedataset(ds)

get_csv_data_dict(ds)

replace_cfs(old_key, new_key)

Replace old_key with new_key in characterization factors.

retupleize_geo_strings(value)

Transform data from SQLite representation to Python objects.

bw2data.backends.utils.check_exchange(exc)[source]#

Check exchange data validity when processing

bw2data.backends.utils.convert_backend(database_name, backend)[source]#

Convert a Database to another backend.

bw2data currently supports the default and json backends.

Args:
  • database_name (unicode): Name of database.

  • backend (unicode): Type of database. backend should be recoginized by DatabaseChooser.

Returns False if the old and new backend are the same. Otherwise returns an instance of the new Database object.

bw2data.backends.utils.dict_as_activitydataset(ds)[source]#
bw2data.backends.utils.dict_as_exchangedataset(ds)[source]#
bw2data.backends.utils.get_csv_data_dict(ds)[source]#
bw2data.backends.utils.replace_cfs(old_key, new_key)[source]#

Replace old_key with new_key in characterization factors.

Returns list of modified methods.

bw2data.backends.utils.retupleize_geo_strings(value)[source]#

Transform data from SQLite representation to Python objects.

We are using a SQLite3 cursor, which means that the Peewee data conversion code is not called. So ('foo', 'bar') is stored as a string, not a tuple. This code tries to do this conversion correctly.

TODO: Adapt what Peewee does in this case?