dwind 0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main, dev]
7
+
8
+ jobs:
9
+ pre-commit:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Set up Python
14
+ uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.11"
17
+ - name: Run pre-commit
18
+ uses: pre-commit/action@v3.0.1
@@ -0,0 +1,41 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
+
4
+ name: Deploy to Test PyPI
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - 'v*'
10
+
11
+ jobs:
12
+ release-test-pypi:
13
+ # Upload to Test PyPI on every pushed tag.
14
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: release-pypi
18
+ url: https://test.pypi.org/p/dwind
19
+ permissions:
20
+ id-token: write
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: '3.11'
29
+
30
+ - name: Build package
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install setuptools build wheel twine
34
+ python -m build
35
+ twine check --strict dist/*
36
+
37
+ - name: Publish package to Test PyPI
38
+ uses: pypa/gh-action-pypi-publish@release/v1
39
+ with:
40
+ verbose: True
41
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,39 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
+
4
+ name: Deploy to PyPI
5
+
6
+ on:
7
+ release:
8
+ types: [published]
9
+
10
+ jobs:
11
+ release-pypi:
12
+ # Upload to PyPI on every published release
13
+ if: github.event.action == 'published'
14
+ environment:
15
+ name: release-pypi
16
+ url: https://pypi.org/p/dwind
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ id-token: write
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: '3.11'
28
+
29
+ - name: Build package
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install setuptools build wheel twine
33
+ python -m build
34
+ twine check --strict dist/*
35
+
36
+ - name: Publish package to PyPI
37
+ uses: pypa/gh-action-pypi-publish@release/v1
38
+ with:
39
+ verbose: True
dwind-0.3/.gitignore ADDED
@@ -0,0 +1,131 @@
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ ### Python template
3
+ # Byte-compiled / optimized / DLL files
4
+ *__pycache__/*
5
+ *.py[cod]
6
+ *$py.class
7
+ *.pyc
8
+
9
+ log/
10
+ # needed for h2 test inputs: tests/analysis/results/
11
+ *_disp.txt
12
+
13
+ .idea/*
14
+ .idea/workspace.xml
15
+ .vscode/
16
+
17
+ .vscode/*
18
+
19
+ # Distribution / packaging
20
+ .Python
21
+ env*/*
22
+ build/
23
+ develop-eggs/
24
+ dist/
25
+ downloads/
26
+ eggs/
27
+ .eggs/
28
+ lib/
29
+ lib64/
30
+ parts/
31
+ sdist/
32
+ var/
33
+ *.egg-info/
34
+ .installed.cfg
35
+ *.egg
36
+
37
+ # PyInstaller
38
+ # Usually these files are written by a python script from a template
39
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
40
+ *.manifest
41
+ *.spec
42
+
43
+ # Installer logs
44
+ pip-log.txt
45
+ pip-delete-this-directory.txt
46
+
47
+ # Unit test / coverage reports
48
+ htmlcov/
49
+ .tox/
50
+ .coverage
51
+ .coverage.*
52
+ .cache
53
+ nosetests.xml
54
+ coverage.xml
55
+ *,cover
56
+ .hypothesis/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # pyenv
83
+ .python-version
84
+
85
+ # celery beat schedule file
86
+ celerybeat-schedule
87
+
88
+ # dotenv
89
+ .env
90
+ .envrc
91
+
92
+ # virtualenv
93
+ .venv/
94
+ venv/
95
+ ENV/
96
+
97
+ # Spyder project settings
98
+ .spyderproject
99
+
100
+ # Rope project settings
101
+ .ropeproject
102
+
103
+ # Resource data
104
+ #resource_files/solar/*.csv
105
+ #resource_files/wind/*.srw
106
+
107
+ # Images, datafiles
108
+ *.png
109
+ *.xlsx
110
+
111
+ *.pkl
112
+ .DS_Store
113
+ *.val
114
+ *.db
115
+ *.db-shm
116
+ *.gz
117
+ *.db-wal
118
+
119
+ # credentials
120
+ notebooks/.mapboxtoken
121
+
122
+ # visual studio folder
123
+ .vs/
124
+
125
+ # ipynb checkpoints
126
+ */.ipynb_checkpoints
127
+
128
+ # data
129
+ data/urdb_tariffs/*.json
130
+ data/cambium_csvs/*.csv
131
+ data/geography/block_groups/*
@@ -0,0 +1,33 @@
1
+ default_language_version:
2
+ python: python3
3
+ repos:
4
+ - repo: https://github.com/pycqa/isort
5
+ rev: 5.12.0
6
+ hooks:
7
+ - id: isort
8
+ name: isort
9
+ stages: [pre-commit]
10
+
11
+ - repo: https://github.com/pre-commit/pre-commit-hooks
12
+ rev: v4.5.0
13
+ hooks:
14
+ - id: trailing-whitespace
15
+ - id: end-of-file-fixer
16
+ - id: check-executables-have-shebangs
17
+ - id: check-json
18
+ - id: check-yaml
19
+ args: [--unsafe] # allow Python constructors
20
+ - id: check-merge-conflict
21
+ - id: check-symlinks
22
+ - id: mixed-line-ending
23
+ - id: pretty-format-json
24
+ args: [--autofix]
25
+
26
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
27
+ rev: v0.8.1
28
+ hooks:
29
+ - id: ruff-format
30
+ types_or: [ python, pyi, jupyter ]
31
+ - id: ruff
32
+ types_or: [ python, pyi, jupyter ]
33
+ args: [ --fix, --unsafe-fixes]
dwind-0.3/LICENSE.txt ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2019, Alliance for Sustainable Energy, LLC
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dwind-0.3/PKG-INFO ADDED
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: dwind
3
+ Version: 0.3
4
+ Summary: Distributed Wind Generation Model
5
+ Author-email: Jane Lockshin <jane.lockshin@nrel.gov>, Paritosh Das <paritosh.das@nrel.gov>, Rob Hammond <rob.hammond@nrel.gov>
6
+ Project-URL: source, https://github.com/NREL/dwind
7
+ Project-URL: issues, https://github.com/NREL/dwind/issues
8
+ Keywords: python3,wind-energy,distributed-wind,energy-production
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Natural Language :: English
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE.txt
24
+ Requires-Dist: nrel-rex
25
+ Requires-Dist: numpy
26
+ Requires-Dist: pandas>=2
27
+ Requires-Dist: sqlalchemy
28
+ Requires-Dist: psycopg2
29
+ Requires-Dist: scipy
30
+ Requires-Dist: matplotlib
31
+ Requires-Dist: seaborn
32
+ Requires-Dist: pyarrow==17
33
+ Requires-Dist: fastparquet
34
+ Requires-Dist: h5pyd
35
+ Requires-Dist: typer
36
+ Requires-Dist: tomli>=1.1.0; python_version < "3.11"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pre-commit; extra == "dev"
39
+ Requires-Dist: isort; extra == "dev"
40
+ Requires-Dist: ruff; extra == "dev"
41
+ Requires-Dist: pytest; extra == "dev"
42
+ Requires-Dist: pytest-cov; extra == "dev"
43
+ Dynamic: license-file
44
+
45
+ # Distributed Wind Generation Model (dWind)
46
+
47
+ Please note that at this time the model can only be run on NREL's Kestrel HPC system. Though a
48
+ savvy user could recreate our data in their own computing environment and update the
49
+ internal pointers in the example configuration at `examples/larimer_county_btm_baseline_2025.toml`
50
+ and `examples/model_config.toml`.
51
+
52
+ ## Installing dwind
53
+
54
+ 1. Install Anaconda or Miniconda (recommended) if not already installed.
55
+ 2. Clone the repository
56
+
57
+ ```bash
58
+ git clone https://github.com/NREL/dwind.git
59
+ ```
60
+
61
+ 3. Navigate to the dwind repository.
62
+
63
+ ```bash
64
+ cd /path/to/dwind
65
+ ```
66
+
67
+ 4. Create your dwind environment using our recommended settings and all required dependencies.
68
+
69
+ ```bash
70
+ conda env create -f environment.yml
71
+ ```
72
+
73
+ ## Running
74
+
75
+ ### Configuring
76
+
77
+ `dWind` relies on 2 configuration files: 1) a system-wise setting that can be shared among a team,
78
+ and 2) a run-specific configuration file. Both will be described below.
79
+
80
+ #### Primary model configuration
81
+
82
+ The primary model configuration should look exactly like (or be compatible with)
83
+ `examples/model_config.toml` to ensure varying fields are read correctly throughout the model.
84
+
85
+ Internally, `dWind` is able to convert the following data to adhere to internal usage:
86
+ - Any field with "DIR" is converted to a Python `pathlib.Path` object for robust file handling
87
+ - SQL credentials and constructor strings are automatically formed in the `[sql]` table for easier
88
+ construction of generic connection strings. Specifically the `{USER}` and `{PASSWORD}` fields
89
+ get replaced with their corresponding setting in the same table.
90
+
91
+ `Configuration`, the primary class handling this data allows for dot notation and dictionary-style
92
+ attribute calling at all levels of nesting. This means, `config.pysam.outputs.btm` and
93
+ `config.pysam.outputs["btm"]` are equivalent. This makes for more intuitive dynamic attribute
94
+ fetching when updating the code for varying cases.
95
+
96
+ #### Run configuration
97
+
98
+ The run-specific configuration should look like `examples/larimer_county_btm_baseline_2025.toml`,
99
+ which controls all the dynamic model settings, HPC configurations, and a pointer to the primary
100
+ model configuration described above.
101
+
102
+ ### Run the model
103
+
104
+ `dwind` has a robust CLI interface allowing for the usage of `python path/to/dwind/dwind/run.py` or
105
+ `dwind`. The model currently supports the run prompts:
106
+ - `dwind run-config <run-configuration.toml>
107
+ - `dwind run-hpc --arg1 ... --argn` where the `--arg` parameters are used in place of the run TOML
108
+ file.
109
+
110
+ If at any point, further guidance is needed, pass `--help` to `dwind` or any of the subcommands for
111
+ detailed information on the required and optional inputs.
112
+
113
+ To run the model, it is recommended to use the following workflow from your analysis folder.
114
+ 1. Start a new `screen` session on Kestrel.
115
+
116
+ ```bash
117
+ screen -S <analysis-name>
118
+ ```
119
+
120
+ 2. Load your conda environment with dwind installed.
121
+
122
+ ```bash
123
+ module load conda
124
+ conda activate <env_name>
125
+ ```
126
+
127
+ 3. Navigate to your analysis folder if your relative data locations in your run configuration are
128
+ relative to the analysis folder.
129
+
130
+ ```bash
131
+ cd /path/to/analysis/location
132
+ ```
133
+
134
+ 4. Run the model.
135
+
136
+ ```bash
137
+ dwind run-config examples/larimer_county_btm_baseline_2025.toml
138
+ ```
139
+
140
+ 5. Disconnect your screen `Ctrl` + `a` + `d` and wait for the analysis to complete and view your
141
+ results.
142
+
143
+ ## `dwind` run settings
144
+
145
+ ### `run-config`
146
+
147
+ ```bash
148
+ * config_path TEXT Path to configuration TOML with run and model parameters. [default: None] [required]
149
+ ```
150
+
151
+ ### `run-hpc`
152
+
153
+ ```bash
154
+ * --location TEXT The state, state_county, or priority region to run. [default: None] [required]
155
+ * --sector [fom|btm] One of fom (front of meter) or btm (back-of-the-meter). [default: None] [required]
156
+ * --scenario [baseline] The scenario to run (baseline is the current only option). [default: None] [required]
157
+ * --year INTEGER The assumption year for the analysis. Options are 2022, 2024, and 2025. [default: None] [required]
158
+ * --repository TEXT Path to the dwind repository to use when running the model. [default: None] [required]
159
+ * --nodes INTEGER Number of HPC nodes or CPU nodes to run on. -1 indicates 75% of CPU limit. [default: None] [required]
160
+ * --allocation TEXT HPC allocation name. [default: None] [required]
161
+ * --memory INTEGER Node memory, in GB (HPC only). [default: None] [required]
162
+ * --walltime INTEGER Node walltime request, in hours. [default: None] [required]
163
+ * --feature TEXT Additional flags for the SLURM job, using formatting such as --qos=high or --depend=[state:job_id]. [default: None] [required]
164
+ * --env TEXT The path to the dwind Python environment that should be used to run the model. [default: None] [required]
165
+ * --model-config TEXT Complete file name and path of the model configuration file [default: None] [required]
166
+ * --dir-out TEXT Path to where the chunked outputs should be saved. [default: None] [required]
167
+ * --stdout-path TEXT The path to write stdout logs. [default: None]
168
+ ```
dwind-0.3/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # Distributed Wind Generation Model (dWind)
2
+
3
+ Please note that at this time the model can only be run on NREL's Kestrel HPC system. Though a
4
+ savvy user could recreate our data in their own computing environment and update the
5
+ internal pointers in the example configuration at `examples/larimer_county_btm_baseline_2025.toml`
6
+ and `examples/model_config.toml`.
7
+
8
+ ## Installing dwind
9
+
10
+ 1. Install Anaconda or Miniconda (recommended) if not already installed.
11
+ 2. Clone the repository
12
+
13
+ ```bash
14
+ git clone https://github.com/NREL/dwind.git
15
+ ```
16
+
17
+ 3. Navigate to the dwind repository.
18
+
19
+ ```bash
20
+ cd /path/to/dwind
21
+ ```
22
+
23
+ 4. Create your dwind environment using our recommended settings and all required dependencies.
24
+
25
+ ```bash
26
+ conda env create -f environment.yml
27
+ ```
28
+
29
+ ## Running
30
+
31
+ ### Configuring
32
+
33
+ `dWind` relies on 2 configuration files: 1) a system-wise setting that can be shared among a team,
34
+ and 2) a run-specific configuration file. Both will be described below.
35
+
36
+ #### Primary model configuration
37
+
38
+ The primary model configuration should look exactly like (or be compatible with)
39
+ `examples/model_config.toml` to ensure varying fields are read correctly throughout the model.
40
+
41
+ Internally, `dWind` is able to convert the following data to adhere to internal usage:
42
+ - Any field with "DIR" is converted to a Python `pathlib.Path` object for robust file handling
43
+ - SQL credentials and constructor strings are automatically formed in the `[sql]` table for easier
44
+ construction of generic connection strings. Specifically the `{USER}` and `{PASSWORD}` fields
45
+ get replaced with their corresponding setting in the same table.
46
+
47
+ `Configuration`, the primary class handling this data allows for dot notation and dictionary-style
48
+ attribute calling at all levels of nesting. This means, `config.pysam.outputs.btm` and
49
+ `config.pysam.outputs["btm"]` are equivalent. This makes for more intuitive dynamic attribute
50
+ fetching when updating the code for varying cases.
51
+
52
+ #### Run configuration
53
+
54
+ The run-specific configuration should look like `examples/larimer_county_btm_baseline_2025.toml`,
55
+ which controls all the dynamic model settings, HPC configurations, and a pointer to the primary
56
+ model configuration described above.
57
+
58
+ ### Run the model
59
+
60
+ `dwind` has a robust CLI interface allowing for the usage of `python path/to/dwind/dwind/run.py` or
61
+ `dwind`. The model currently supports the run prompts:
62
+ - `dwind run-config <run-configuration.toml>
63
+ - `dwind run-hpc --arg1 ... --argn` where the `--arg` parameters are used in place of the run TOML
64
+ file.
65
+
66
+ If at any point, further guidance is needed, pass `--help` to `dwind` or any of the subcommands for
67
+ detailed information on the required and optional inputs.
68
+
69
+ To run the model, it is recommended to use the following workflow from your analysis folder.
70
+ 1. Start a new `screen` session on Kestrel.
71
+
72
+ ```bash
73
+ screen -S <analysis-name>
74
+ ```
75
+
76
+ 2. Load your conda environment with dwind installed.
77
+
78
+ ```bash
79
+ module load conda
80
+ conda activate <env_name>
81
+ ```
82
+
83
+ 3. Navigate to your analysis folder if your relative data locations in your run configuration are
84
+ relative to the analysis folder.
85
+
86
+ ```bash
87
+ cd /path/to/analysis/location
88
+ ```
89
+
90
+ 4. Run the model.
91
+
92
+ ```bash
93
+ dwind run-config examples/larimer_county_btm_baseline_2025.toml
94
+ ```
95
+
96
+ 5. Disconnect your screen `Ctrl` + `a` + `d` and wait for the analysis to complete and view your
97
+ results.
98
+
99
+ ## `dwind` run settings
100
+
101
+ ### `run-config`
102
+
103
+ ```bash
104
+ * config_path TEXT Path to configuration TOML with run and model parameters. [default: None] [required]
105
+ ```
106
+
107
+ ### `run-hpc`
108
+
109
+ ```bash
110
+ * --location TEXT The state, state_county, or priority region to run. [default: None] [required]
111
+ * --sector [fom|btm] One of fom (front of meter) or btm (back-of-the-meter). [default: None] [required]
112
+ * --scenario [baseline] The scenario to run (baseline is the current only option). [default: None] [required]
113
+ * --year INTEGER The assumption year for the analysis. Options are 2022, 2024, and 2025. [default: None] [required]
114
+ * --repository TEXT Path to the dwind repository to use when running the model. [default: None] [required]
115
+ * --nodes INTEGER Number of HPC nodes or CPU nodes to run on. -1 indicates 75% of CPU limit. [default: None] [required]
116
+ * --allocation TEXT HPC allocation name. [default: None] [required]
117
+ * --memory INTEGER Node memory, in GB (HPC only). [default: None] [required]
118
+ * --walltime INTEGER Node walltime request, in hours. [default: None] [required]
119
+ * --feature TEXT Additional flags for the SLURM job, using formatting such as --qos=high or --depend=[state:job_id]. [default: None] [required]
120
+ * --env TEXT The path to the dwind Python environment that should be used to run the model. [default: None] [required]
121
+ * --model-config TEXT Complete file name and path of the model configuration file [default: None] [required]
122
+ * --dir-out TEXT Path to where the chunked outputs should be saved. [default: None] [required]
123
+ * --stdout-path TEXT The path to write stdout logs. [default: None]
124
+ ```
@@ -0,0 +1,3 @@
1
+ from .config import Configuration
2
+
3
+ __version__ = "0.3"