Skip to content

Commit

Permalink
scenario.clear()
Browse files Browse the repository at this point in the history
resets scenario.

This is useful because the Scenario object stores its data in local files outside of the python script.
        This causes issues when two unique scenario instances are created in the same directory, they appear to be seperate instances to python but share the same data. Changes made to one are reflected in both.
  • Loading branch information
tobin-ford committed Feb 29, 2024
1 parent 347cf81 commit 34020b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pvdeg/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,24 @@ def __init__(
os.makedirs(self.path)
os.chdir(self.path)

# this could be renamed ``reset`` or ``wipe``?
def clear(self):
"""
Wipe the Scenario object. This is useful because the Scenario object stores its data in local files outside of the python script.
This causes issues when two unique scenario instances are created in the same directory, they appear to be seperate instances
to python but share the same data. Changes made to one are reflected in both.
Parameters:
-----------
None
Returns:
--------
None
"""
return pvdeg.Scenario()


def addLocation(
self, weather_fp=None, region=None, region_col="state", lat_long=None, gids=None
):
Expand Down

0 comments on commit 34020b0

Please sign in to comment.