Skip to content

[BUG] numpy.float64 not supported in Piece / Piecewise #340

@JonaGL

Description

@JonaGL

Version Confirmation

  • I have confirmed this bug exists on the latest release of FlixOpt

Bug Description

Creating an object of the class Piece in flixOpt by using attributes of the type numpy.float64 throws an error. Converting it to the type float before solves the issue.

Minimal Reproducible Example

# in the Complex example.py 5 was changed with np.float64(5) to get the unsupported type

    piecewise_conversion = fx.PiecewiseConversion(
        {
            P_el.label: fx.Piecewise([fx.Piece(np.float64(5), 30), fx.Piece(40, 60)]),
            Q_th.label: fx.Piecewise([fx.Piece(6, 35), fx.Piece(45, 100)]),
            Q_fu.label: fx.Piecewise([fx.Piece(12, 70), fx.Piece(90, 200)]),
        }
    )

Error Output

flixopt.core.ConversionError: Converting data <class 'numpy.float64'> to xarray.Dataset raised an error: coords is not dict-like, but it has 1 items, which does not match the 0 dimensions of the data

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not in FocusThis seems reasonable, but we are not working on it at the moment.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions