Skip to content

parameters

ConditionalParam

Bases: object

Evaluate an expression, and return a if true, b if false this is nuts--- they're even nested. ChatGPT tells me I could use simple regexes to change e.g. IF(expr1; expr2; expr3) to (expr2 if expr1 else expr3) but trying to handle nested expressions with regexp seems foolhardy.

I mean, look at this: IF(auto_calc_wtr=1;IF(0.474454781149916-(pct_fresh_srf-0.167302119871893)(0.4744547811499161/(0.358243098978191+0.474454781149916))>0.0424528301886793;0.474454781149916-(pct_fresh_srf-0.167302119871893)(0.4744547811499161/(0.358243098978191+0.474454781149916));0.0424528301886793);usr_fresh_gnd)

FormulaParser

Bases: _Param

give it a parameter spec; it will act as a dynamic calculator. 'param' api: dict with keys 'name' (str), 'value' (float), 'formula' (str with elementary operations + groups)

dependencies property

Generates input variables that are used to calculate the parameter value

Returns:

Type Description

NodeCalculator

Bases: NodeTransformer

substitutes constant values in for parameter names, and evaluates the expression

NodeIdentifier

Bases: NodeVisitor

identifies all the parameters named in an expression

OlcaParameterResolver

Bases: object

A class to handle and compute parameters in the OLCA framework. Ultimately we want to be able to represent computed parameters involving sums as balance flows (and products as child flows)

outputs property

    parameters that are linked to an exchange

`` :return:

__init__(process_json, noisy=False, v2=True, process_ref=None)

Supply the json object. will: - extract input parameters - extract and order derived parameters - confirm parameter values

Parameters:

Name Type Description Default
process_json
required
noisy

[False] print extensive debugging info

False
v2

[True] whether to use the v2 schema or not

True

param_unit(param)

This is inaccurate because the same param can be used for multiple exchanges regardless of their flow property. This will only capture the units applied to ONE USE of the parameter name (nondeterministically)

Parameters:

Name Type Description Default
param
required

Returns:

Type Description

ParamConstant

Bases: _Param

An input. 'param' API: dict. keys: 'name', 'value' (a float), 'unit' (an optional string)