bw_temporalis.lca ================= .. py:module:: bw_temporalis.lca Exceptions ---------- .. autoapisummary:: bw_temporalis.lca.MultipleTechnosphereExchanges Classes ------- .. autoapisummary:: bw_temporalis.lca.NoExchange bw_temporalis.lca.TemporalisLCA Module Contents --------------- .. py:exception:: MultipleTechnosphereExchanges Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. Initialize self. See help(type(self)) for accurate signature. .. py:class:: NoExchange The edge was created dynamically via a datapackage. There is no edge in the database. .. py:class:: TemporalisLCA(lca_object: bw2calc.LCA, starting_datetime: datetime.datetime | str = 'now', cutoff: float | None = 0.0005, biosphere_cutoff: float | None = 1e-06, max_calc: int | None = 2000, static_activity_indices: set[int] | None = None, skip_coproducts: bool | None = False, functional_unit_unique_id: int | None = -1, graph_traversal: bw_graph_tools.NewNodeEachVisitGraphTraversal | None = NewNodeEachVisitGraphTraversal) Calculate an LCA using graph traversal, with edges using temporal distributions. Edges with temporal distributions should store this information using `"temporal_distributions"`: ```python exchange["temporal_distribution"] = bw_temporalis.TemporalDistribution( times=numpy.array([-2, -1, 0, 1, 2], dtype="timedelta64[s]"), values=numpy.ones(5) ) ``` Temporal distribution times must always have the data type `timedelta64[s]`. Not all edges need to have temporal distributions. Temporal distributions are **not density functions** - their values should sum to the exchange amount. As graph traversal is much slower than matrix calculations, we can limit which nodes get traversed in several ways: * All activities in a database marked as `static` * Any activity ids passed in `static_activity_indices` * Any activities whose cumulative impact is below the cutoff score The output of a Temporalis LCA calculation is a `bw_temporalis.Timeline`, which can be characterized. :param lca_object: The already instantiated and calculated LCA class (i.e. `.lci()` and `.lcia()` have already been done) :type lca_object: bw2calc.LCA :param starting_datetime: When the functional unit happens. Must be a point in time. Normally something like `"now"` or `"2023-01-01"`. :type starting_datetime: datetime.datetime | str :param cutoff: The fraction of the total score below which graph traversal should stop. In range `(0, 1)`. :type cutoff: float :param biosphere_cutoff: The fraction of the total score below which we don't include separate biosphere nodes to be characterized in the `Timeline`. In range `(0, 1)`. :type biosphere_cutoff: float :param max_calc: Total number of LCA inventory calculations to perform during graph traversal :type max_calc: int :param static_activity_indices: Activity database node `id` values where graph traversal will stop :type static_activity_indices: set[int] :param skip_coproducts: Should we also traverse edges for the other products in multioutput activities? :type skip_coproducts: bool :param functional_unit_unique_id: The unique id of the functional unit. Strongly recommended to leave as default. :type functional_unit_unique_id: int :param graph_traversal: Optional subclass of `NewNodeEachVisitGraphTraversal` for advanced usage :type graph_traversal: bw_graph_tools.NewNodeEachVisitGraphTraversal .. py:method:: _exchange_iterator(input_id: int, output_id: int) -> list[bw2data.backends.ExchangeDataset] .. py:method:: _exchange_value(exchange: Union[bw2data.backends.ExchangeDataset, NoExchange], row_id: int, col_id: int, matrix_label: str) -> Union[float, bw_temporalis.temporal_distribution.TemporalDistribution] .. py:method:: build_timeline(node_timeline: bool | None = False) -> bw_temporalis.timeline.Timeline .. py:method:: get_biosphere_exchanges(flow_id: int, activity_id: int) -> collections.abc.Iterable[bw2data.backends.ExchangeDataset] .. py:method:: get_technosphere_exchange(input_id: int, output_id: int) -> bw2data.backends.ExchangeDataset .. py:attribute:: edge_mapping .. py:attribute:: edges .. py:attribute:: flow_mapping .. py:attribute:: flows .. py:attribute:: lca_object .. py:attribute:: nodes .. py:attribute:: t0 .. py:attribute:: unique_id :value: -1