Exchange Interface¶
- exception antelope.interfaces.iexchange.ExchangeRequired¶
Bases:
Exception
- class antelope.interfaces.iexchange.ExchangeInterface¶
Bases:
AbstractQuery
- The Exchange Interface implements the Exchange Relation:
given a process, a reference flow, and a query flow, report the quantity of the query flow that is exchanged with respect to a unit of the reference flow.
- exchanges(process, **kwargs)¶
Retrieve process’s full exchange list, without values :param process: :return: list of exchanges without values
- ev(process, flow, direction=None, termination=None, ref_flow=None, **kwargs)¶
Return a float. Symmetric to quantity.cf
- Parameters:
process
flow
direction – [None] if none, if flows exist with both directions, raise an error
termination – [None] if none, return sum of flows across all terminations
ref_flow – [None] if none, return unallocated value. Otherwise, return value allocated to a unit of the specified reference
- Returns:
a float
- exchange_values(process, flow, direction=None, termination=None, reference=None, **kwargs)¶
Leftover from earlier implementation; deprecated. 2022-12-27: is this really deprecated? it’s used in computing reference_value and I don’t see any other way… perhaps we should add reference_value() to the API but for now let’s keep this around
Return a list of exchanges with values matching the specification.
- Parameters:
process
flow
direction – [None] if none,
termination – [None] if none, return all terminations
reference – [None] if True, only find reference exchanges. If false- maybe omit reference exchanges?
- Returns:
list of exchanges with values matching the specification
- inventory(process, ref_flow=None, scenario=None, **kwargs)¶
Return a list of exchanges with values. If no reference is supplied, return all unallocated exchanges, including reference exchanges.
- If a reference flow is supplied, expected behavior depends on a number of factors.
If the supplied reference flow is part of the process’s reference entity, the inventory should return all non-reference exchanges, appropriately allocated to the specified flow, and normalized to a unit of the specified flow.
If the supplied reference flow is not part of the reference entity, NO allocation should be performed. Instead, the inventory should return ALL exchanges except for the specified flow, un-allocated, normalized to a unit of the specified flow. This query is only valid if the specified flow is a cut-off (i.e. un-terminated) exchange (i.e. it could be treated as a “silent reference” or effective co-product)
If the supplied reference flow is a non-reference, non-cutoff flow (i.e. it is a terminated exchange), then the appropriate behavior is undefined. The default implementation raises an ExchangeError.
Note: if this is called on a fragment, the signature is the same but the ‘ref_flow’ argument is ignored and the alternative ‘scenario’ kwarg is accepted
- Parameters:
process
ref_flow – used only for processes
scenario – used only for fragments (antelope_foreground)
- Returns:
a list of unallocated or allocated exchange refs
- exchange_relation(process, ref_flow, exch_flow, direction, termination=None, **kwargs)¶
should return some sort of exchange relation result, analogous to quantity.quantity_relation
- Parameters:
process
ref_flow
exch_flow
direction
termination
- Returns:
- contrib_lcia(process, quantity=None, ref_flow=None, **kwargs)¶
exchange interface provides the ability to perform a contribution analysis of a process’s LCIA scores. In core, this is accomplished with ephemeral fragments.
- Parameters:
process
quantity – if omitted, a catalog may select a default LCIA method
ref_flow
kwargs
- Returns: