Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
57c1ce1
Add gaps version to version record
ppinchuk Jul 22, 2025
47562d6
Update citation
ppinchuk Jul 22, 2025
84b4726
Merge remote-tracking branch 'origin/main' into pp/config_in_meta
ppinchuk Aug 8, 2025
a1b42a5
Add optional `config_file` and `project_dir` parameters
ppinchuk Aug 8, 2025
1722554
Accept `module` parameter
ppinchuk Aug 8, 2025
3029044
Add new key to attrs
ppinchuk Aug 8, 2025
81b3001
Now pass down config file and project dir inputs for attrs
ppinchuk Aug 8, 2025
ea23c9c
Test for new attrs in gen file
ppinchuk Aug 8, 2025
0f1dad8
Break out functionality into utility function
ppinchuk Aug 8, 2025
e548cd7
Hybrids now stores config
ppinchuk Aug 8, 2025
4fce62f
Deprecate project dir in favor of config dir
ppinchuk Aug 8, 2025
43b6317
Add extra hybrids attrs
ppinchuk Aug 8, 2025
0e4b435
Minor test update
ppinchuk Aug 8, 2025
1defad5
Fix bug when not giving `cf_dset`
ppinchuk Aug 8, 2025
2c0bd7f
Add attrs to rep profiles run
ppinchuk Aug 8, 2025
2adf5e9
Actually pass the module name down
ppinchuk Aug 11, 2025
0fcd838
Minor docstring fix
ppinchuk Aug 11, 2025
a9a11b0
Bump gaps dep
ppinchuk Aug 12, 2025
b05c2c4
Add tests for output attributes in econ file
ppinchuk Aug 12, 2025
a7f1b14
Handler now can store info about config file for multi-year
ppinchuk Aug 12, 2025
78254de
Add tests for config in attrs
ppinchuk Aug 12, 2025
311a292
Add config file as option
ppinchuk Aug 13, 2025
c13ceff
Config in bespoke supply curve
ppinchuk Aug 13, 2025
01aa187
Try fix mac tests
ppinchuk Aug 25, 2025
4b2c802
Linter fixes
ppinchuk Aug 25, 2025
c59521a
Try fix windows test
ppinchuk Aug 26, 2025
aa8a977
Try to fix windows tests
ppinchuk Aug 26, 2025
fda1e80
Add logger clear
ppinchuk Aug 26, 2025
5d68619
Add tool links
ppinchuk Aug 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,21 @@ Option 2: Clone repo (recommended for developers)
- ``reV``


reV Ecosystem
=============
The reV model suite comes with a set of tools that can be used alongside the core model
to assist with data preparation and analysis:

- `reVX <https://nrel.github.io/reVX/>`_ - Collection of helper methods to pre- and post- process geospatial reV data (e.g. setback layers, inclusion masks, etc.)
- `rex <https://nrel.github.io/rex/>`_ - Library to assist with reV-style data I/O, especially resource data
- reVRt (Coming soon!) - reV routing tool used to compute transmission costs
- `reVReports <https://github.com/NREL/reVReports>`_ - Tool for generating publication-ready maps of reV supply curve outputs
- `reView <https://github.com/NREL/reView>`_ - Dashboard for interactive visualization of reV supply curve outputs
- `reV tutorial <https://github.com/NREL/reV-tutorial>`_ - Collection of tutorials for learning how to use reV
- `gaps <https://nrel.github.io/gaps/>`_ - Underlying reV pipeline job submission and management system



reV command line tools
======================

Expand Down Expand Up @@ -218,6 +233,6 @@ Potential (reV) Model: A Geospatial Platform for Technical Potential and Supply
Curve Modeling.” Golden, Colorado, United States: National Renewable Energy
Laboratory. NREL/TP-6A20-73067. https://doi.org/10.2172/1563140.

Grant Buster, Michael Rossol, Paul Pinchuk, Brandon N Benton, Robert Spencer,
Mike Bannister, & Travis Williams. (2023).
NREL/reV: reV 0.8.0 (v0.8.0). Zenodo. https://doi.org/10.5281/zenodo.8247528
Buster, G., Pinchuk, P., Rossol, M., Benton, B., Gleason, M., Stanley, A. P.,
Spencer, R., Bannister, M., & Williams, T. (2020). reV (Version 0.14.5)
[Computer software]. https://github.com/NREL/reV
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers=[
"Programming Language :: Python :: 3.13",
]
dependencies = [
"NREL-gaps>=0.8.0",
"NREL-gaps>=0.8.11",
"NREL-NRWAL>=0.0.11",
"NREL-PySAM~=7.0.0",
"NREL-rex>=0.4.0",
Expand Down
28 changes: 23 additions & 5 deletions reV/bespoke/bespoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
SupplyCurveField,
log_versions,
)
from reV.utilities.cli_functions import add_to_run_attrs
from reV.utilities.exceptions import EmptySupplyCurvePointError, FileInputError

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -2381,7 +2382,7 @@ def sam_sys_inputs_with_site_data(self, gid):
)
return site_sys_inputs

def _init_fout(self, out_fpath, sample):
def _init_fout(self, out_fpath, sample, config_file=None):
"""Initialize the bespoke output h5 file with meta and time index dsets

Parameters
Expand All @@ -2392,12 +2393,21 @@ def _init_fout(self, out_fpath, sample):
sample : dict
A single sample BespokeSinglePlant output dict that has been run
and has output data.
config_file : str, optional
Path to config file used for this bespoke run (if
applicable). This is used to store information about the run
in the output file attrs. By default, ``None``.
"""
out_dir = os.path.dirname(out_fpath)
if not os.path.exists(out_dir):
create_dirs(out_dir)

global_attrs = add_to_run_attrs(config_file=config_file,
module=ModuleName.BESPOKE)

with Outputs(out_fpath, mode="w") as f:
for key, value in global_attrs.items():
f.h5.attrs[key] = value
f._set_meta("meta", self.meta, attrs={})
ti_dsets = [
d for d in sample.keys() if d.startswith("time_index-")
Expand Down Expand Up @@ -2459,14 +2469,18 @@ def _collect_out_arr(self, dset, sample):

return full_arr

def save_outputs(self, out_fpath):
def save_outputs(self, out_fpath, config_file=None):
"""Save Bespoke Wind Plant optimization outputs to disk.

Parameters
----------
out_fpath : str
Full filepath to an output .h5 file to save Bespoke data to. The
parent directories will be created if they do not already exist.
config_file : str, optional
Path to config file used for this bespoke run (if
applicable). This is used to store information about the run
in the output file attrs. By default, ``None``.

Returns
-------
Expand All @@ -2491,7 +2505,7 @@ def save_outputs(self, out_fpath):
return out_fpath

sample = self.outputs[self.completed_gids[0]]
self._init_fout(out_fpath, sample)
self._init_fout(out_fpath, sample, config_file=config_file)

dsets = [
d
Expand Down Expand Up @@ -2725,7 +2739,7 @@ def run_parallel(self, max_workers=None):

return out

def run(self, out_fpath=None, max_workers=None):
def run(self, out_fpath=None, max_workers=None, config_file=None):
"""Run the bespoke wind plant optimization in serial or parallel.

Parameters
Expand All @@ -2738,6 +2752,10 @@ def run(self, out_fpath=None, max_workers=None):
max_workers : int, optional
Number of local workers to run on. If ``None``, uses all
available cores (typically 36). By default, ``None``.
config_file : str, optional
Path to config file used for this bespoke run (if
applicable). This is used to store information about the run
in the output file attrs. By default, ``None``.

Returns
-------
Expand Down Expand Up @@ -2800,6 +2818,6 @@ def run(self, out_fpath=None, max_workers=None):
self._outputs = self.run_parallel(max_workers=max_workers)

if out_fpath is not None:
out_fpath = self.save_outputs(out_fpath)
out_fpath = self.save_outputs(out_fpath, config_file=config_file)

return out_fpath
10 changes: 8 additions & 2 deletions reV/econ/econ.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ def _get_data_shape(self, dset, n_sites):

return data_shape

def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None):
def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None,
config_file=None):
"""Execute a parallel reV econ run with smart data flushing.

Parameters
Expand All @@ -519,6 +520,10 @@ def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None):
Number of futures to submit to a single process pool for
parallel futures. If ``None``, the pool size is set to
``os.cpu_count() * 2``. By default, ``None``.
config_file : str, optional
Path to config file used for this econ run (if applicable).
This is used to store information about the run in the
output file attrs. By default, ``None``.

Returns
-------
Expand All @@ -535,7 +540,8 @@ def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None):
else:
self._init_fpath(out_fpath, ModuleName.ECON)

self._init_h5(mode="a" if self._append else "w")
self._init_h5(mode="a" if self._append else "w",
config_file=config_file, module=ModuleName.ECON)
self._init_out_arrays()

diff = list(set(self.points_control.sites)
Expand Down
9 changes: 7 additions & 2 deletions reV/generation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
OutputWarning,
ParallelExecutionWarning,
)
from reV.utilities.cli_functions import add_to_run_attrs

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -994,7 +995,8 @@ def _init_fpath(self, out_fpath, module):
self._out_fpath = os.path.join(project_dir, out_fn)
self._run_attrs["out_fpath"] = out_fpath

def _init_h5(self, mode="w"):
def _init_h5(self, mode="w", config_file=None,
module=ModuleName.GENERATION):
"""Initialize the single h5 output file with all output requests.

Parameters
Expand Down Expand Up @@ -1048,6 +1050,9 @@ def _init_h5(self, mode="w"):
else:
ti = None

run_attrs = add_to_run_attrs(run_attrs=self.run_attrs,
config_file=config_file, module=module)

Outputs.init_h5(
self._out_fpath,
self.output_request,
Expand All @@ -1058,7 +1063,7 @@ def _init_h5(self, mode="w"):
self.meta,
time_index=ti,
configs=self.sam_metas,
run_attrs=self.run_attrs,
run_attrs=run_attrs,
mode=mode,
)

Expand Down
10 changes: 8 additions & 2 deletions reV/generation/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ def __init__(
self._sam_module = self.OPTIONS[self.tech]
self._run_attrs["sam_module"] = self._sam_module.MODULE
self._run_attrs["res_file"] = resource_file
self._run_attrs["low_res_resource_file"] = str(low_res_resource_file)

self._multi_h5_res, self._hsds = check_res_file(resource_file)
self._gid_map = self._parse_gid_map(gid_map)
Expand Down Expand Up @@ -1043,7 +1044,8 @@ def _reduce_kwargs(self, pc, **kwargs):

return kwargs

def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None):
def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None,
config_file=None):
"""Execute a parallel reV generation run with smart data flushing.

Parameters
Expand All @@ -1067,6 +1069,10 @@ def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None):
Number of futures to submit to a single process pool for
parallel futures. If ``None``, the pool size is set to
``os.cpu_count() * 2``. By default, ``None``.
config_file : str, optional
Path to config file used for this generation run (if
applicable). This is used to store information about the run
in the output file attrs. By default, ``None``.

Returns
-------
Expand All @@ -1076,7 +1082,7 @@ def run(self, out_fpath=None, max_workers=1, timeout=1800, pool_size=None):
"""
# initialize output file
self._init_fpath(out_fpath, module=ModuleName.GENERATION)
self._init_h5()
self._init_h5(config_file=config_file, module=ModuleName.GENERATION)
self._init_out_arrays()
if pool_size is None:
pool_size = os.cpu_count() * 2
Expand Down
Loading
Loading