Skip to content

Commit

Permalink
Merge pull request #94 from NREL/gb/plant_builder
Browse files Browse the repository at this point in the history
Gb/plant builder
  • Loading branch information
grantbuster authored Mar 3, 2021
2 parents e2e25bc + 68ccc71 commit dc9817d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion reVX/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from reVX.utilities.exclusions_converter import ExclusionsConverter
from reVX.utilities.forecasts import Forecasts
from reVX.utilities.output_extractor import output_extractor
from reVX.utilities.region import RegionClassifier
from reVX.utilities.region_classifier import RegionClassifier
from reVX.wind_setbacks.setbacks_converter import SetbacksConverter

from reVX import __version__
Expand Down
8 changes: 5 additions & 3 deletions reVX/plexos/rev_reeds_plexos.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from rex.utilities.execution import SpawnProcessPool
from rex.utilities.utilities import parse_table

from reVX.utilities.region import RegionClassifier
from reVX.utilities.region_classifier import RegionClassifier
from reVX.handlers.outputs import Outputs
from reVX.plexos.utilities import (DataCleaner, get_coord_labels,
parse_table_name)
Expand Down Expand Up @@ -575,6 +575,7 @@ def _parse_plexos_nodes(self, plexos_nodes):
if (isinstance(plexos_nodes, str)
and plexos_nodes.endswith(('.csv', '.json'))):
plexos_nodes = parse_table(plexos_nodes)

elif isinstance(plexos_nodes, str) and plexos_nodes.endswith('.shp'):
rc = RegionClassifier(self.sc_build, plexos_nodes,
regions_label=None)
Expand All @@ -583,8 +584,9 @@ def _parse_plexos_nodes(self, plexos_nodes):
plexos_nodes['plexos_id'] = np.arange(len(plexos_nodes))

elif not isinstance(plexos_nodes, pd.DataFrame):
msg = ('Did not recognize plexos_nodes input: {}'
.format(plexos_nodes))
msg = ('Expected a DataFrame or a file path to csv, json, or '
'shp for the plexos_nodes input but received: {} ({})'
.format(plexos_nodes, type(plexos_nodes)))
logger.error(msg)
raise NotImplementedError(msg)

Expand Down
2 changes: 1 addition & 1 deletion reVX/utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .exclusions_converter import ExclusionsConverter
from .forecasts import Forecasts
from .output_extractor import output_extractor
from .region import RegionClassifier
from .region_classifier import RegionClassifier
10 changes: 10 additions & 0 deletions reVX/utilities/region.py → reVX/utilities/region_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ def __init__(self, meta_path, regions, regions_label=None):
self._meta = self._get_meta(meta_path)
self._regions = self._get_regions(regions, self._regions_label)

@property
def regions(self):
"""Get the regions GeoDataFrame
Returns
-------
GeoDataFrame
"""
return self._regions

@staticmethod
def output_to_csv(gdf, path):
""" Export a geopandas dataframe to csv
Expand Down
2 changes: 1 addition & 1 deletion reVX/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
reVX version number
"""

__version__ = "0.3.24"
__version__ = "0.3.25"
2 changes: 1 addition & 1 deletion tests/test_region_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from rex.utilities.loggers import LOGGERS

from reVX import TESTDATADIR
from reVX.utilities.region import RegionClassifier
from reVX.utilities.region_classifier import RegionClassifier
from reVX.cli import main


Expand Down

0 comments on commit dc9817d

Please sign in to comment.