Skip to content

Deepcopy fix#131

Merged
dmuldrew merged 2 commits intodevelopfrom
deepcopy_fix
Apr 5, 2020
Merged

Deepcopy fix#131
dmuldrew merged 2 commits intodevelopfrom
deepcopy_fix

Conversation

@dmuldrew
Copy link
Copy Markdown
Collaborator

@dmuldrew dmuldrew commented Apr 5, 2020

Generalization of grid property access produced a bug:

>>> scenario.state.prepare_simulation_input()
---------------------------
PREPARING SIMULATION INPUTS
---------------------------
100%|################################################################################################################| 211/211 [00:00<00:00, 3.82kb/s]
--> Creating temporary folder on server for simulation inputs
--> Copying demand base profile into temporary folder
--> Copying hydro base profile into temporary folder
--> Copying solar base profile into temporary folder
--> Copying wind base profile into temporary folder
--> Preparing MPC file
Scaling grid
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/brdo/REM/PowerSimData/powersimdata/scenario/execute.py", line 106, in prepare_simulation_input
    si.prepare_mpc_file()
  File "/Users/brdo/REM/PowerSimData/powersimdata/scenario/execute.py", line 191, in prepare_mpc_file
    grid = self.scaler.get_grid()
  File "/Users/brdo/REM/PowerSimData/powersimdata/input/scaler.py", line 56, in get_grid
    self._grid = copy.deepcopy(self._original_grid)
  File "/Users/brdo/.pyenv/versions/3.6.5/lib/python3.6/copy.py", line 159, in deepcopy
    copier = getattr(x, "__deepcopy__", None)
  File "/Users/brdo/REM/PowerSimData/powersimdata/input/grid.py", line 65, in __getattr__
    return self.fields[field_name]
KeyError: '__deepcopy__'

The solution was to explicitly call these methods in the inherited object class.

@dmuldrew dmuldrew added this to the Cherry Blossom milestone Apr 5, 2020
@dmuldrew dmuldrew requested a review from rouille April 5, 2020 00:47
@dmuldrew dmuldrew requested a review from kasparm April 5, 2020 00:49
Copy link
Copy Markdown
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests pass and test scenario was created and prepared successfully. Thanks for the quick fix.

@dmuldrew dmuldrew merged commit c156460 into develop Apr 5, 2020
@dmuldrew dmuldrew deleted the deepcopy_fix branch April 5, 2020 02:43
@ahurli ahurli mentioned this pull request Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants