Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix capacity title for unpacking bespoke layouts #61

Open
WilliamsTravis opened this issue Oct 17, 2024 · 0 comments
Open

Fix capacity title for unpacking bespoke layouts #61

WilliamsTravis opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@WilliamsTravis
Copy link
Collaborator

Bug Description
Cannot unpack bespoke turbine layouts for the newest supply curve tables because of the capacity field name change.

Full Traceback

[2024-10-17 09:44:23,458] ERROR in app: Exception on /_dash-update-component [POST]
Traceback (most recent call last):
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
    return self._engine.get_loc(casted_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
  File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'capacity'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/dash/dash.py", line 1373, in dispatch
    ctx.run(
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/dash/_callback.py", line 465, in add_context
    output_value = _invoke_callback(func, *func_args, **func_kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/dash/_callback.py", line 40, in _invoke_callback
    return func(*args, **kwargs)  # %% callback invoked %%
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/utils/classes.py", line 181, in _callback_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/pages/rev/controller/callbacks.py", line 1109, in figure_map
    df = unpacker.unpack_turbines()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/utils/bespoke.py", line 156, in unpack_turbines
    new_rows = self.unpack_row(row)
               ^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/utils/bespoke.py", line 121, in unpack_row
    turbine_capacity_mw = row[capacity_col] / len(xs)
                          ~~~^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/series.py", line 1121, in __getitem__
    return self._get_value(key)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/series.py", line 1237, in _get_value
    loc = self.index.get_loc(label)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3812, in get_loc
    raise KeyError(key) from err
KeyError: 'capacity'
reView (ERROR) - [app.py:838] : Exception on /_dash-update-component [POST]
Traceback (most recent call last):
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
    return self._engine.get_loc(casted_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
  File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'capacity'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/dash/dash.py", line 1373, in dispatch
    ctx.run(
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/dash/_callback.py", line 465, in add_context
    output_value = _invoke_callback(func, *func_args, **func_kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/dash/_callback.py", line 40, in _invoke_callback
    return func(*args, **kwargs)  # %% callback invoked %%
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/utils/classes.py", line 181, in _callback_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/pages/rev/controller/callbacks.py", line 1109, in figure_map
    df = unpacker.unpack_turbines()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/utils/bespoke.py", line 156, in unpack_turbines
    new_rows = self.unpack_row(row)
               ^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/github/reView/reView/utils/bespoke.py", line 121, in unpack_row
    turbine_capacity_mw = row[capacity_col] / len(xs)
                          ~~~^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/series.py", line 1121, in __getitem__
    return self._get_value(key)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/series.py", line 1237, in _get_value
    loc = self.index.get_loc(label)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/twillia2/anaconda3/envs/review/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3812, in get_loc
    raise KeyError(key) from err
KeyError: 'capacity'

Charge code
[GDOP.12495.31.01.01] reV Maintenance

@WilliamsTravis WilliamsTravis added the bug Something isn't working label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant