NatLabRockies / NatLabRockies/H2Integrate

Bug report: TypeError when converting OpenMDAO input arrays to float in finances.py

Open Beginner friendly
#465 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
26
Forks
44
Avg merge
3d 22h
Merged PRs (30d)
16

Description

Bug: TypeError when converting OpenMDAO input arrays to float in finances.py

Description

Running the example
examples/18_pyomo_heuristic_dispatch/run_pyomo_heuristic_dispatch.py
fails during the finance subsystem due to an invalid scalar conversion in finances.py.

Error

TypeError: only 0-dimensional arrays can be converted to Python scalars

Root cause

OpenMDAO inputs are passed as NumPy arrays (even for scalar values), but the code attempts to cast them directly using float(...), which fails for 1-D arrays. Could update to inputs[f"capex_{tech}"][0].

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with finances.py and the finance subsystem reached by examples/18_pyomo_heuristic_dispatch/run_pyomo_heuristic_dispatch.py. Run the example to reproduce the TypeError, inspect how the OpenMDAO inputs are converted, and verify that the example completes without the scalar-conversion failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.