leaspy.io.realizations.realization_factory

realization_factory(realization_or_variable_type: AbstractRealization | VariableType | str, **kws) AbstractRealization

Factory for Realizations.

Parameters:
realization_or_variable_typeAbstractRealization or VariableType or str

If an instance of a subclass of AbstractRealization, returns the instance (no copy). If a VariableType variant (or a valid string keyword for this variant), then returns a new instance of the appropriate class (with optional parameters kws).

**kws

Optional parameters for initializing the requested Realization (not used if input is a subclass of AbstractRealization).

Returns:
AbstractRealization

The desired realization.

Raises:
LeaspyInputError:

If the variable type provided is not supported.