bw2data.backends.json.database#

Module Contents#

Classes#

JSONDatabase

A data store for LCI databases. Stores each dataset in a separate file, serialized to JSON.

class bw2data.backends.json.database.JSONDatabase(name)[source]#

Bases: bw2data.backends.base.LCIBackend

Inheritance diagram of bw2data.backends.json.database.JSONDatabase

A data store for LCI databases. Stores each dataset in a separate file, serialized to JSON.

Instead of loading all the data at once, .load() creates a SynchronousJSONDict, which loads values on demand.

Use this backend by setting "backend":"json" in the database metadata. This is done automatically if you call .register() from this class.

backend = 'json'[source]#
filepath_intermediate()[source]#
get(code)[source]#

Get Activity proxy for this dataset

load(as_dict=False, *args, **kwargs)[source]#

Instantiate SynchronousJSONDict for this database.

register(**kwargs)[source]#

Register a database with the metadata store, using the correct value for backend, and creates database directory.

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

Serialize data to disk. Most of the time, this data has already been saved to disk, so this is a no-op. The only exception is if data is a new database dictionary.

Normalizes units when found.

Parameters

data (*) – Inventory data