Skip to content

Commit

Permalink
Merge pull request #199 from NREL/bnb/dev
Browse files Browse the repository at this point in the history
Sup3rWind examples - Merging this since it is low stakes and referenced in slides that are about to be published.
  • Loading branch information
bnb32 committed Mar 21, 2024
2 parents dc1e555 + d985a80 commit abca254
Show file tree
Hide file tree
Showing 16 changed files with 619 additions and 13 deletions.
8 changes: 8 additions & 0 deletions docs/source/examples/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _examples:

Examples
========
.. toctree::

sup3rcc
sup3rwind
5 changes: 5 additions & 0 deletions docs/source/examples/sup3rcc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Sup3rCC Examples
===============

.. include:: ../../../examples/sup3rcc/README.rst
:start-line: 2
5 changes: 5 additions & 0 deletions docs/source/examples/sup3rwind.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Sup3rWind Examples
=================

.. include:: ../../../examples/sup3rwind/README.rst
:start-line: 2
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

Home page <self>
Installation and Usage <misc/installation_usage>
Examples <examples/examples>
API reference <_autosummary/sup3r>
CLI reference <_cli/cli>

Expand Down
60 changes: 60 additions & 0 deletions examples/sup3rwind/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
################
Sup3rWind Examples
################

Super-Resolution for Renewable Energy Resource Data with Wind from Reanalysis Data (Sup3rWind) is one application of the sup3r software. In this work, we train generative models to create high-resolution (2km 5-minute) wind data based on coarse (30km hourly) ERA5 data. The high-resolution output data is publicly available via the `Open Energy Data Initiative (OEDI) <https://data.openei.org/s3_viewer?bucket=nrel-pds-wtk&prefix=sup3rwind%2F>`_ and via HSDS at the bucket ``nrel-pds-hsds`` and path ``/nrel/wtk/sup3rwind``. This data covers recent historical time periods for an expanding selection of countries.

Sup3rWind Data Access
===================

The Sup3rWind data and models are publicly available in a public AWS S3 bucket. The data files can be downloaded directly from there to your local machine or an EC2 instance using the `OEDI data explorer <https://data.openei.org/s3_viewer?bucket=nrel-pds-wtk&prefix=sup3rwind%2F>`_ or the `AWS CLI <https://aws.amazon.com/cli/>`_. A word of caution: there's a lot of data here. The smallest Sup3rWind file for just a single variable at 2-km 5-minute resolution is 130 GB.

The Sup3rWind data is also loaded into `HSDS <https://www.hdfgroup.org/solutions/highly-scalable-data-service-hsds/>`_ so that you may stream the data via the `NREL developer API <https://developer.nrel.gov/signup/>`_ or your own HSDS server. This is the best option if you're not going to want a full annual dataset. See these `rex instructions <https://nrel.github.io/rex/misc/examples.hsds.html>`_ for more details on how to access this data with HSDS and rex.

Example Sup3rWind Data Usage
==========================

Sup3rWind data can be used in generally the same way as Sup3rCC data, with the condition that Sup3rWind includes only wind data and ancillary variables for modeling wind energy generation. Refer to the Sup3rCC example notebook `here <https://github.com/NREL/sup3r/tree/main/examples/sup3rcc/using_the_data.ipynb>`_ for usage patterns.

Running Sup3rWind Models
======================

The process for running the Sup3rWind models is much the same as for Sup3rCC (``sup3r/examples/sup3rcc/README.rst``).

#. Download the Sup3rWind models to your hardware using the AWS CLI: ``$ aws s3 cp s3:https://nrel-pds-wtk/sup3rwind/models/``
#. Download the ERA5 data that you want to downscale from `ERA5-single-levels <https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels?tab=overview/>`_ and/or `ERA5-pressure-levels <https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-pressure-levels?tab=overview/>`_.
#. Setup the Sup3rWind software. We recommend using `miniconda <https://docs.conda.io/en/latest/miniconda.html>`_ to manage your python environments. You can create a sup3r environment with the conda file in this example directory: ``$ conda env create -n sup3rwind --file env.yml``
#. Copy this examples directory to your hardware. You're going to be using the folder structure in ``/sup3r/examples/sup3rwind/run_configs`` as your project directories (``/sup3r/`` is a git clone of the sup3r software repo).
#. Navigate to ``/sup3r/examples/sup3rwind/run_configs/wind/`` and/or ``sup3r/examples/sup3rwind/run_configs/trhp`` and update all of the filepaths in the config files for the source ERA5 data, Sup3rWind models, and exogenous data sources (e.g. the ``topography`` source file).
#. Update the execution control parameters in the ``config_fwp_spatial.json`` file based on the hardware you're running on.
#. Run ``sup3r-pipeline`` to run just one job. There are also batch options for running multiple jobs, but we recommend starting with ``sup3r-pipeline`` (more on the sup3r CLIs `here <https://nrel.github.io/sup3r/_cli/sup3r.html>`_).
#. To run ``sup3r-pipeline``, make sure you are in the directory with the ``config_pipeline.json`` and ``config_fwp_spatial.json`` files, and then run this command: ``python -m sup3r.cli -c config_pipeline.json pipeline``
#. If you're running on a slurm cluster, this will kick off a number of jobs that you can see with the ``squeue`` command. If you're running locally, your terminal should now be running the Sup3rWind models. The software will create a ``./logs/`` directory in which you can monitor the progress of your jobs.
#. The ``sup3r-pipeline`` is designed to run several modules in serial, with each module running multiple chunks in parallel. Once the first module (forward-pass) finishes, you'll want to run ``python -m sup3r.cli -c config_pipeline.json pipeline`` again. This will clean up status files and kick off the next step in the pipeline (if the current step was successful).

Sup3rWind Versions
================

The Sup3rWind data has versions that coincide with the sup3r software versions. Note that not every sup3r software version will have a corresponding Sup3rWind data release, but every Sup3rWind data release will have a corresponding sup3r software version.

.. list-table::
:widths: auto
:header-rows: 1

* - Version
- Effective Date
- Notes
* - 0.1.2
- 3/15/2024
- Initial release of Sup3rWind for Ukraine, Moldova, and part of Romania. Includes 2-km 5-minute wind speed and wind direction data and 2-km hourly wind speed, wind direction, pressure, temperature, and relative humidity data for 2000-2023.


Recommended Citation
====================

Brandon Benton, Grant Buster, Pavlo Pinchuk, Andrew Glaws, Ryan King, Galen Maclaurin, Ilya Chernyakhovskiy. "Super-Resolution for Renewable Energy Resource Data with Wind from Reanalysis Data (Sup3rWind)". In Prep.

Acknowledgements
================

This work was authored by the National Renewable Energy Laboratory, operated by Alliance for Sustainable Energy, LLC, for the U.S. Department of Energy (DOE) under Contract No. DE-AC36-08GO28308. Funding provided by the DOE Grid Deployment Office (GDO), the DOE Advanced Scientific Computing Research (ASCR) program, the DOE Solar Energy Technologies Office (SETO), and the Laboratory Directed Research and Development (LDRD) program at the National Renewable Energy Laboratory. The research was performed using computational resources sponsored by the DOE Office of Energy Efficiency and Renewable Energy and located at the National Renewable Energy Laboratory. The views expressed in the article do not necessarily represent the views of the DOE or the U.S. Government. The U.S. Government retains and the publisher, by accepting the article for publication, acknowledges that the U.S. Government retains a nonexclusive, paid-up, irrevocable, worldwide license to publish or reproduce the published form of this work, or allow others to do so, for U.S. Government purposes.
228 changes: 228 additions & 0 deletions examples/sup3rwind/env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
absl-py==1.4.0
addfips==0.4.0
affine==2.4.0
alabaster==0.7.13
alphashape==1.3.1
anyio==4.0.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens @ file:https:///home/conda/feedstock_root/build_artifacts/asttokens_1694046349000/work
astunparse==1.6.3
async-lru==2.0.4
attrs==23.1.0
Babel==2.12.1
backcall @ file:https:///home/conda/feedstock_root/build_artifacts/backcall_1592338393461/work
backports.functools-lru-cache @ file:https:///home/conda/feedstock_root/build_artifacts/backports.functools_lru_cache_1687772187254/work
beautifulsoup4==4.12.2
bleach==6.1.0
cachetools==5.3.1
Cartopy @ file:https:///croot/cartopy_1674677761573/work
cdsapi==0.6.1
certifi @ file:https:///home/conda/feedstock_root/build_artifacts/certifi_1700303426725/work/certifi
cffi==1.16.0
cftime==1.6.2
charset-normalizer==3.2.0
click==8.1.7
click-log==0.4.0
click-plugins==1.1.1
cligj==0.7.2
cloudpickle==2.2.1
colorama==0.4.6
comm @ file:https:///home/conda/feedstock_root/build_artifacts/comm_1691044910542/work
contourpy @ file:https:///opt/conda/conda-bld/contourpy_1663827406301/work
cycler @ file:https:///tmp/build/80754af9/cycler_1637851556182/work
dask==2023.5.0
debugpy @ file:https:///croot/debugpy_1690905042057/work
decorator @ file:https:///home/conda/feedstock_root/build_artifacts/decorator_1641555617451/work
defusedxml==0.7.1
docutils==0.18.1
entrypoints @ file:https:///home/conda/feedstock_root/build_artifacts/entrypoints_1643888246732/work
exceptiongroup==1.1.3
executing @ file:https:///home/conda/feedstock_root/build_artifacts/executing_1667317341051/work
fastjsonschema==2.18.1
fiona==1.9.5
flatbuffers==23.5.26
fonttools==4.25.0
fqdn==1.5.1
fsspec==2023.9.0
gast==0.4.0
geopandas==0.13.2
google-auth==2.23.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
grpcio==1.58.0
h5py==3.9.0
h5pyd==0.15.1
idna==3.4
imageio==2.31.5
imagesize==1.4.1
importlib-metadata==6.8.0
importlib-resources==6.0.1
iniconfig==2.0.0
ipykernel @ file:https:///home/conda/feedstock_root/build_artifacts/ipykernel_1693880262622/work
ipython @ file:https:///home/conda/feedstock_root/build_artifacts/ipython_1680185408135/work
ipywidgets==8.1.1
isoduration==20.11.0
jedi @ file:https:///home/conda/feedstock_root/build_artifacts/jedi_1696326070614/work
Jinja2==3.1.2
joblib==1.3.2
json5==0.9.14
jsonpointer==2.4
jsonschema==4.19.2
jsonschema-specifications==2023.7.1
jupyter-events==0.9.0
jupyter-lsp==2.2.0
jupyter_client==8.6.0
jupyter_core @ file:https:///home/conda/feedstock_root/build_artifacts/jupyter_core_1696972407098/work
jupyter_server==2.10.0
jupyter_server_terminals==0.4.4
jupyterlab==4.0.8
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.9
jupyterlab_server==2.25.0
kaleido==0.2.1
keras==2.8.0
Keras-Preprocessing==1.1.2
kiwisolver @ file:https:///croot/kiwisolver_1672387140495/work
lazy_loader==0.3
libclang==16.0.6
locket==1.0.0
Markdown==3.4.4
MarkupSafe==2.1.3
matplotlib @ file:https:///croot/matplotlib-suite_1693812469450/work
matplotlib-inline @ file:https:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1660814786464/work
-e git+ssh:https://[email protected]/bnb32/misc_tools.git@016334c0fe767158726913ba8a8db2f6811be0b4#egg=misc_tools
mistune==3.0.2
mkl-fft @ file:https:///croot/mkl_fft_1695058164594/work
mkl-random @ file:https:///croot/mkl_random_1695059800811/work
mkl-service==2.4.0
munkres==1.1.4
nbclient==0.8.0
nbconvert==7.11.0
nbformat==5.9.2
nest-asyncio @ file:https:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1697083700168/work
netCDF4==1.5.8
networkx==3.1
notebook==7.0.6
notebook_shim==0.2.3
NREL-farms==1.0.5
NREL-gaps==0.6.1
NREL-NRWAL==0.0.11
-e git+ssh:https://[email protected]/NREL/phygnn.git@da93661077c42f36a2d613a63e1f499994cbc4b0#egg=NREL_phygnn
NREL-PySAM==4.1.0
NREL-reV==0.7.3
NREL-reVX==0.3.53
-e git+ssh:https://[email protected]/NREL/rex.git@7d724b10222c22a81fb9df8834ae8575a28f6ead#egg=NREL_rex
-e git+ssh:https://[email protected]/NREL/sup3r.git@8a02005db703e456c5a7f1879203a3ffb16c3fe9#egg=NREL_sup3r
numpy==1.22.0
numpydoc==1.5.0
oauthlib==3.2.2
opt-einsum==3.3.0
overrides==7.4.0
packaging==23.1
pandas==2.0.3
pandocfilters==1.5.0
parso @ file:https:///home/conda/feedstock_root/build_artifacts/parso_1638334955874/work
partd==1.4.0
pexpect @ file:https:///home/conda/feedstock_root/build_artifacts/pexpect_1667297516076/work
pickleshare @ file:https:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
Pillow==10.0.0
pkgutil_resolve_name==1.3.10
platformdirs @ file:https:///home/conda/feedstock_root/build_artifacts/platformdirs_1696272223550/work
plotly==5.16.1
plotting==0.0.7
pluggy==1.3.0
prometheus-client==0.18.0
prompt-toolkit @ file:https:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1688565951714/work
protobuf==3.20.3
psutil==5.9.5
psycopg2-binary==2.9.9
ptyprocess @ file:https:///home/conda/feedstock_root/build_artifacts/ptyprocess_1609419310487/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pure-eval @ file:https:///home/conda/feedstock_root/build_artifacts/pure_eval_1642875951954/work
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
Pygments @ file:https:///home/conda/feedstock_root/build_artifacts/pygments_1691408637400/work
pyjson5==1.6.4
PyJWT==2.8.0
pyparsing @ file:https:///opt/conda/conda-bld/pyparsing_1661452539315/work
pyproj @ file:https:///croot/pyproj_1675244161691/work
pyshp @ file:https:///tmp/build/80754af9/pyshp_1610641829514/work
pytest==7.4.2
python-dateutil @ file:https:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
python-dotenv==1.0.0
python-json-logger==2.0.7
pytz==2023.3.post1
PyWavelets==1.4.1
PyYAML==6.0.1
pyzmq @ file:https:///croot/pyzmq_1686601365461/work
rasterio==1.3.9
referencing==0.30.2
requests==2.31.0
requests-oauthlib==1.3.1
requests-unixsocket==0.3.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rioxarray==0.13.4
rpds-py==0.12.0
rsa==4.9
Rtree==1.1.0
ruff==0.1.3
scikit-image==0.21.0
scikit-learn==1.3.0
scipy==1.10.1
seaborn==0.12.2
Send2Trash==1.8.2
Shapely==1.8.5.post1
six @ file:https:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
sniffio==1.3.0
snowballstemmer==2.2.0
snuggs==1.4.7
soupsieve==2.5
Sphinx==7.1.2
sphinx-click==5.0.1
sphinx-copybutton==0.5.2
sphinx-tabs==3.4.1
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
stack-data @ file:https:///home/conda/feedstock_root/build_artifacts/stack_data_1669632077133/work
tabulate==0.9.0
tenacity==8.2.3
tensorboard==2.8.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.8.0
tensorflow-estimator==2.13.0
tensorflow-io-gcs-filesystem==0.34.0
termcolor==2.3.0
terminado==0.17.1
tf-estimator-nightly==2.8.0.dev2021122109
threadpoolctl==3.2.0
tifffile==2023.7.10
tinycss2==1.2.1
toml==0.10.2
tomli==2.0.1
toolz==0.12.0
tornado==6.3.3
tqdm==4.66.1
traitlets @ file:https:///home/conda/feedstock_root/build_artifacts/traitlets_1696377679271/work
trimesh==4.0.2
types-python-dateutil==2.8.19.14
typing_extensions==4.5.0
tzdata==2023.3
uri-template==1.3.0
urllib3==1.26.16
wcwidth @ file:https:///home/conda/feedstock_root/build_artifacts/wcwidth_1696255154857/work
webcolors==1.13
webencodings==0.5.1
websocket-client==1.6.4
Werkzeug==2.3.7
widgetsnbextension==4.0.9
wrapt==1.15.0
xarray==2023.1.0
zipp @ file:https:///croot/zipp_1672387121353/work
27 changes: 27 additions & 0 deletions examples/sup3rwind/run_configs/trhp/config_collect_h5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"n_writes": 3,
"dset_split": false,
"join_times": true,
"execution_control": {
"memory": 175,
"option": "kestrel",
"walltime": 40,
"feature": "--qos=normal",
"alloc": "usaiddata"
},
"features": [
"temperature_2m",
"temperature_100m",
"temperature_200m",
"relativehumidity_2m",
"relativehumidity_100m",
"relativehumidity_200m",
"pressure_0m",
"pressure_100m",
"pressure_200m"
],
"file_paths": "./output/fwp_out_*.h5",
"log_file": "./collect_h5.log",
"log_level": "DEBUG",
"out_file": "./output/sup3rwind_ancillary.h5"
}
40 changes: 40 additions & 0 deletions examples/sup3rwind/run_configs/trhp/config_fwp_spatial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"worker_kwargs": {"pass_workers": 5, "ti_workers": 1},
"input_handler_kwargs": {
"worker_kwargs": {"ti_workers": 1},
"res_kwargs": {"concat_dim": "time",
"combine": "nested"}},
"input_handler": "DataHandlerNC",
"max_nodes": 30,
"execution_control": {
"memory": 174,
"option": "kestrel",
"alloc": "usaiddata",
"walltime": 47
},
"file_paths": [
"PLACEHOLDER"
],
"fwp_chunk_shape": [
75,
75,
38
],
"model_class": "SurfaceSpatialMetModel",
"log_level": "DEBUG",
"log_pattern": "./logs/fwp_spatial_log_{node_index}.log",
"model_kwargs": "./sup3rwind_models_202401/sup3rwind_trhp_step1_15x_1x_9f",
"out_pattern": "./output/fwp_out_{file_id}.h5",
"spatial_pad": 0,
"temporal_pad": 5,
"exo_kwargs": {
"topography": {
"file_paths": [
"PLACEHOLDER"
],
"source_file": "PLACEHOLDER",
"exo_resolution": {"spatial": "1km", "temporal": "60min"},
"steps": [{"model": 0, "combine_type": "input"},
{"model": 0, "combine_type": "output"}]}
}
}

0 comments on commit abca254

Please sign in to comment.