dwind 0.3.1__tar.gz → 0.3.2__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.
Files changed (45) hide show
  1. {dwind-0.3.1 → dwind-0.3.2}/PKG-INFO +2 -1
  2. {dwind-0.3.1 → dwind-0.3.2}/dwind/__init__.py +1 -1
  3. {dwind-0.3.1 → dwind-0.3.2}/dwind/btm_sizing.py +1 -2
  4. dwind-0.3.2/dwind/cli/collect.py +114 -0
  5. dwind-0.3.2/dwind/cli/debug.py +137 -0
  6. dwind-0.3.2/dwind/cli/run.py +288 -0
  7. dwind-0.3.2/dwind/cli/utils.py +166 -0
  8. dwind-0.3.2/dwind/config.py +269 -0
  9. dwind-0.3.2/dwind/main.py +20 -0
  10. {dwind-0.3.1 → dwind-0.3.2}/dwind/model.py +128 -63
  11. {dwind-0.3.1 → dwind-0.3.2}/dwind/mp.py +30 -35
  12. dwind-0.3.2/dwind/resource.py +248 -0
  13. {dwind-0.3.1 → dwind-0.3.2}/dwind/scenarios.py +73 -36
  14. dwind-0.3.2/dwind/utils/__init__.py +0 -0
  15. dwind-0.3.2/dwind/utils/array.py +99 -0
  16. {dwind-0.3.1 → dwind-0.3.2}/dwind/utils/hpc.py +44 -2
  17. dwind-0.3.2/dwind/utils/loader.py +63 -0
  18. dwind-0.3.2/dwind/utils/progress.py +60 -0
  19. {dwind-0.3.1 → dwind-0.3.2}/dwind/valuation.py +368 -239
  20. {dwind-0.3.1 → dwind-0.3.2}/dwind.egg-info/PKG-INFO +2 -1
  21. {dwind-0.3.1 → dwind-0.3.2}/dwind.egg-info/SOURCES.txt +8 -0
  22. dwind-0.3.2/dwind.egg-info/entry_points.txt +2 -0
  23. {dwind-0.3.1 → dwind-0.3.2}/dwind.egg-info/requires.txt +1 -0
  24. {dwind-0.3.1 → dwind-0.3.2}/pyproject.toml +3 -2
  25. dwind-0.3.1/dwind/config.py +0 -128
  26. dwind-0.3.1/dwind/resource.py +0 -169
  27. dwind-0.3.1/dwind/utils/array.py +0 -172
  28. dwind-0.3.1/dwind.egg-info/entry_points.txt +0 -2
  29. {dwind-0.3.1 → dwind-0.3.2}/.github/workflows/pre-commit.yml +0 -0
  30. {dwind-0.3.1 → dwind-0.3.2}/.github/workflows/python-publish-test.yml +0 -0
  31. {dwind-0.3.1 → dwind-0.3.2}/.github/workflows/python-publish.yml +0 -0
  32. {dwind-0.3.1 → dwind-0.3.2}/.gitignore +0 -0
  33. {dwind-0.3.1 → dwind-0.3.2}/.pre-commit-config.yaml +0 -0
  34. {dwind-0.3.1 → dwind-0.3.2}/LICENSE.txt +0 -0
  35. {dwind-0.3.1 → dwind-0.3.2}/README.md +0 -0
  36. {dwind-0.3.1/dwind/utils → dwind-0.3.2/dwind/cli}/__init__.py +0 -0
  37. {dwind-0.3.1 → dwind-0.3.2}/dwind/helper.py +0 -0
  38. {dwind-0.3.1 → dwind-0.3.2}/dwind/loader.py +0 -0
  39. {dwind-0.3.1 → dwind-0.3.2}/dwind/run.py +0 -0
  40. {dwind-0.3.1 → dwind-0.3.2}/dwind.egg-info/dependency_links.txt +0 -0
  41. {dwind-0.3.1 → dwind-0.3.2}/dwind.egg-info/top_level.txt +0 -0
  42. {dwind-0.3.1 → dwind-0.3.2}/environment.yml +0 -0
  43. {dwind-0.3.1 → dwind-0.3.2}/examples/larimer_county_btm_baseline_2025.toml +0 -0
  44. {dwind-0.3.1 → dwind-0.3.2}/examples/model_config.toml +0 -0
  45. {dwind-0.3.1 → dwind-0.3.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dwind
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Distributed Wind Generation Model
5
5
  Author-email: Jane Lockshin <jane.lockshin@nrel.gov>, Paritosh Das <paritosh.das@nrel.gov>, Rob Hammond <rob.hammond@nrel.gov>
6
6
  Project-URL: source, https://github.com/NREL/dwind
@@ -33,6 +33,7 @@ Requires-Dist: pyarrow==17
33
33
  Requires-Dist: fastparquet
34
34
  Requires-Dist: h5pyd
35
35
  Requires-Dist: typer
36
+ Requires-Dist: rich
36
37
  Requires-Dist: tomli>=1.1.0; python_version < "3.11"
37
38
  Provides-Extra: dev
38
39
  Requires-Dist: pre-commit; extra == "dev"
@@ -1,3 +1,3 @@
1
1
  from .config import Configuration
2
2
 
3
- __version__ = "0.3.1"
3
+ __version__ = "0.3.2"
@@ -6,7 +6,6 @@ import numpy as np
6
6
  import pandas as pd
7
7
 
8
8
  from dwind import Configuration
9
- from dwind.utils import array
10
9
 
11
10
 
12
11
  log = logging.getLogger("dwfs")
@@ -118,7 +117,7 @@ def sizer(agents: pd.DataFrame, config: Configuration):
118
117
  agents.drop_duplicates(subset=["gid"], inplace=True)
119
118
 
120
119
  # make small
121
- agents = array.memory_downcaster(agents)
120
+ # agents = array.memory_downcaster(agents)
122
121
 
123
122
  return agents
124
123
 
@@ -0,0 +1,114 @@
1
+ """Enables running dwind as a CLI tool, the primary interface for working with dwind."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional, Annotated
6
+ from pathlib import Path
7
+
8
+ import typer
9
+ import pandas as pd
10
+
11
+ from dwind.cli import utils
12
+
13
+
14
+ app = typer.Typer()
15
+
16
+ DWIND = Path("/projects/dwind/agents")
17
+
18
+
19
+ @app.command()
20
+ def combine_chunks(
21
+ dir_out: Annotated[
22
+ str,
23
+ typer.Argument(
24
+ help=(
25
+ "Path to where the chunked outputs should be saved. Should be the same that was"
26
+ " passed to the run command."
27
+ )
28
+ ),
29
+ ],
30
+ file_name: Annotated[
31
+ Optional[str], # noqa
32
+ typer.Option(
33
+ "--file-name",
34
+ "-f",
35
+ help="Custom filename, without the extension (e.g. .pqt), for the results data.",
36
+ ),
37
+ ] = None,
38
+ remove_results_chunks: Annotated[
39
+ bool,
40
+ typer.Option(
41
+ "--remove-results-chunks/--no-remove-results-chunks",
42
+ "-rr/-RR",
43
+ help="Delete the individual chunk files after saving the combined results.",
44
+ ),
45
+ ] = True,
46
+ ):
47
+ """Combine the results of a multi-job run based on the run's TOML configuration. Please note
48
+ this has the potential to combine multiple runs as it does not respect the jobs ran during a
49
+ single cycle.
50
+ """
51
+ dir_out = Path.cwd() if dir_out is None else Path(dir_out).resolve()
52
+ out_path = dir_out / "chunk_files"
53
+ result_files = [f for f in out_path.iterdir() if f.suffix == (".pqt")]
54
+
55
+ if len(result_files) > 0:
56
+ file_name = "results" if file_name is None else file_name
57
+ result_agents = pd.concat([pd.read_parquet(f) for f in result_files])
58
+ f_out = dir_out / f"{file_name}.pqt"
59
+ result_agents.to_parquet(f_out)
60
+ print(f"Aggregated results saved to: {f_out}")
61
+ return None
62
+
63
+ if remove_results_chunks:
64
+ for f in result_files:
65
+ f.unlink()
66
+ print(f"Removed: {f}")
67
+ else:
68
+ print(f"No chunked results found in: {out_path}.")
69
+
70
+
71
+ @app.command()
72
+ def cleanup_agents(
73
+ dir_out: Annotated[
74
+ str,
75
+ typer.Argument(
76
+ help=(
77
+ "Path to where the chunked agents were saved. Should be the same that was"
78
+ " passed to the run command."
79
+ )
80
+ ),
81
+ ],
82
+ ):
83
+ """Deletes the temporary agent chunk files generated at runtime.
84
+
85
+ Args:
86
+ dir_out (str): The base output directory, which should be the same as that passed to the
87
+ run command.
88
+ """
89
+ utils.cleanup_chunks(dir_out, which="agents")
90
+
91
+
92
+ @app.command()
93
+ def cleanup_results(
94
+ dir_out: Annotated[
95
+ str,
96
+ typer.Argument(
97
+ help=(
98
+ "Path to where the results agents were saved. Should be the same that was"
99
+ " passed to the run command."
100
+ )
101
+ ),
102
+ ],
103
+ ):
104
+ """Deletes the chunked results files generated at runtime.
105
+
106
+ Args:
107
+ dir_out (str): The base output directory, which should be the same as that passed to the
108
+ run command.
109
+ """
110
+ utils.cleanup_chunks(dir_out, which="results")
111
+
112
+
113
+ if __name__ == "__main__":
114
+ app()
@@ -0,0 +1,137 @@
1
+ """Enables running dwind as a CLI tool, the primary interface for working with dwind."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import itertools
6
+ from typing import Optional, Annotated
7
+ from pathlib import Path
8
+
9
+ import typer
10
+ import pandas as pd
11
+ from rich.console import Console
12
+
13
+ from dwind.cli import utils
14
+ from dwind.utils import hpc
15
+
16
+
17
+ # Create the main app with the primary "run", "debug", and "collect" commands
18
+ app = typer.Typer()
19
+
20
+ console = Console()
21
+
22
+ DWIND = Path("/projects/dwind/agents")
23
+
24
+
25
+ @app.command()
26
+ def job_summary(
27
+ jobs: Annotated[list[str], typer.Argument(help="Job ID(s) to check for the final run status.")],
28
+ chunks: Annotated[
29
+ Optional[list[int]], # noqa
30
+ typer.Option(
31
+ "--chunks",
32
+ "-c",
33
+ help="Corresponding chunk indexes for each job ID.",
34
+ ),
35
+ ] = None,
36
+ ):
37
+ """Print a table summary of the provided job id(s) and their final run status."""
38
+ if chunks is not None:
39
+ N = len(jobs)
40
+ M = len(chunks)
41
+ if N != M:
42
+ raise ValueError(f"Length of inputs to 'jobs' ({N}) not equal to 'chunks' ({M})")
43
+
44
+ jobs = hpc.get_finished_run_status(jobs)
45
+ summary = (
46
+ pd.DataFrame.from_dict(jobs, orient="index", columns=["status"])
47
+ .reset_index()
48
+ .rename(columns={"index": "job"})
49
+ )
50
+ if chunks is None:
51
+ utils.print_status_table(summary)
52
+ else:
53
+ summary["chunk"] = chunks
54
+ utils.print_status_table(summary, chunk_col="chunk")
55
+
56
+
57
+ @app.command()
58
+ def missing_agents_from_chunks(
59
+ dir_out: Annotated[
60
+ str,
61
+ typer.Argument(
62
+ help=(
63
+ "Path to where the chunked outputs were saved. Should match the inputs to the"
64
+ " run command."
65
+ )
66
+ ),
67
+ ],
68
+ chunks: Annotated[
69
+ Optional[list[int]], typer.Option(help="If used, specify chunked indicies to compare.") # noqa
70
+ ] = None,
71
+ ):
72
+ """Compare the agent "gid" field between the chunked agents and results files, and save the
73
+ missing chunk index and agent gid as a 1-column CSV file.
74
+ """
75
+ dir_out = Path(dir_out).resolve()
76
+ results_path = dir_out / "chunk_files"
77
+ agents_path = results_path / "agent_chunks"
78
+
79
+ missing = []
80
+ agent_files = {
81
+ f.name.split("_")[-1]: f
82
+ for f in agents_path.iterdir()
83
+ if f.suffix == ".pqt" and f.name.startswith("agents")
84
+ }
85
+ results_files = {f.name.split("_")[-1]: f for f in results_path.iterdir() if f.suffix == ".pqt"}
86
+ shared_chunks = list({*agent_files}.intersection([*results_files]))
87
+ if chunks is not None:
88
+ shared_chunks = [c for c in shared_chunks if c in chunks]
89
+
90
+ for chunk in shared_chunks:
91
+ agents = pd.read_parquet(agent_files[chunk])[["gid"]]
92
+ results = pd.read_parquet(results_files[chunk])[["gid"]]
93
+ missing_gid = set(agents.gid.values).difference(results.gid.values)
94
+ missing.extend(list(zip(itertools.repeat(chunk), missing_gid)))
95
+
96
+ if missing:
97
+ df = pd.DataFrame(missing, columns=["chunk", "gid"])
98
+ df.to_csv(dir_out / "missing_agents_by_chunk.csv", index=False)
99
+ print(f"Saved missing agents to: {dir_out / 'missing_agents_by_chunk.csv'}")
100
+ else:
101
+ print("All agents produced results.")
102
+
103
+
104
+ @app.command()
105
+ def missing_agents(
106
+ agents_file: Annotated[str, typer.Argument(help="Full file path and name of the agents file.")],
107
+ results_file: Annotated[
108
+ str, typer.Argument(help="Full file path and name of the results file.")
109
+ ],
110
+ dir_out: Annotated[
111
+ str,
112
+ typer.Argument(
113
+ help="Full file path and name for where to save the list of missing agent gids."
114
+ ),
115
+ ],
116
+ ):
117
+ """Compare the agent "gid" field between the chunked agents and results files, and save the
118
+ missing chunk index and agent gid as a 2-column CSV file.
119
+ """
120
+ results_file = Path(results_file).resolve()
121
+ agents_file = Path(agents_file).resolve()
122
+ dir_out = Path(dir_out).resolve()
123
+
124
+ agents = pd.read_parquet(agents_file)[["gid"]]
125
+ results = pd.read_parquet(results_file)[["gid"]]
126
+ missing_gid = set(agents.gid.values).difference(results.gid.values)
127
+
128
+ if missing_gid:
129
+ df = pd.DataFrame(missing_gid, columns=["gid"])
130
+ df.to_csv(dir_out / "missing_agents.csv", index=False)
131
+ print(f"Saved missing agents to: {dir_out / 'missing_agents.csv'}")
132
+ else:
133
+ print("All agents produced results.")
134
+
135
+
136
+ if __name__ == "__main__":
137
+ app()
@@ -0,0 +1,288 @@
1
+ """Enables running dwind as a CLI tool, the primary interface for working with dwind."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from typing import Optional, Annotated
7
+ from pathlib import Path
8
+
9
+ import typer
10
+ from rich.pretty import pprint
11
+
12
+ from dwind.cli import debug, utils, collect
13
+ from dwind.model import Model
14
+ from dwind.config import Sector, Scenario
15
+
16
+
17
+ # fmt: off
18
+ if sys.version_info >= (3, 11): # noqa
19
+ import tomllib
20
+ else:
21
+ import tomli as tomllib
22
+ # fmt: on
23
+
24
+ app = typer.Typer()
25
+
26
+
27
+ @app.command()
28
+ def hpc(
29
+ location: Annotated[
30
+ str, typer.Argument(help="The state, state_county, or priority region to run.")
31
+ ],
32
+ sector: Annotated[
33
+ Sector, typer.Argument(help="One of fom (front of meter) or btm (back-of-the-meter).")
34
+ ],
35
+ scenario: Annotated[
36
+ Scenario,
37
+ typer.Argument(help="The scenario to run (baseline is the current only option)."),
38
+ ],
39
+ year: Annotated[
40
+ int,
41
+ typer.Argument(
42
+ callback=utils.year_callback,
43
+ help="The assumption year for the analysis. Options are 2022, 2024, and 2025.",
44
+ ),
45
+ ],
46
+ repository: Annotated[
47
+ str, typer.Argument(help="Path to the dwind repository to use when running the model.")
48
+ ],
49
+ nodes: Annotated[
50
+ int,
51
+ typer.Argument(
52
+ help="Number of HPC nodes or CPU nodes to run on. -1 indicates 75% of CPU limit."
53
+ ),
54
+ ],
55
+ allocation: Annotated[str, typer.Argument(help="HPC allocation name.")],
56
+ memory: Annotated[int, typer.Argument(help="Node memory, in GB (HPC only).")],
57
+ walltime: Annotated[int, typer.Argument(help="Node walltime request, in hours.")],
58
+ feature: Annotated[
59
+ str,
60
+ typer.Argument(
61
+ help=(
62
+ "Additional flags for the SLURM job, using formatting such as"
63
+ " --qos=high or --depend=[state:job_id]."
64
+ )
65
+ ),
66
+ ],
67
+ env: Annotated[
68
+ str,
69
+ typer.Argument(
70
+ help="The path to the dwind Python environment that should be used to run the model."
71
+ ),
72
+ ],
73
+ model_config: Annotated[
74
+ str, typer.Argument(help="Complete file name and path of the model configuration file")
75
+ ],
76
+ dir_out: Annotated[
77
+ str, typer.Argument(help="Path to where the chunked outputs should be saved.")
78
+ ],
79
+ stdout_path: Annotated[
80
+ Optional[str], typer.Option(help="The path to write stdout logs.") # noqa
81
+ ] = None,
82
+ combine: Annotated[
83
+ bool,
84
+ typer.Option(
85
+ "--combine/--no-combine",
86
+ "-c/-C",
87
+ help="Automatically combine the chunked results after analysis completion.",
88
+ ),
89
+ ] = True,
90
+ remove_agent_chunks: Annotated[
91
+ bool,
92
+ typer.Option(
93
+ "--remove-agent-chunks/--no-remove-agent-chunks",
94
+ "-ra/-RA",
95
+ help="Delete the temporary agent chunk files.",
96
+ ),
97
+ ] = True,
98
+ remove_results_chunks: Annotated[
99
+ bool,
100
+ typer.Option(
101
+ "--remove-results-chunks/--no-remove-results-chunks",
102
+ "-rr/-RR",
103
+ help="Delete the chunked results files. Ignored if --combine is not passed.",
104
+ ),
105
+ ] = True,
106
+ ):
107
+ """Run dwind via the HPC multiprocessing interface."""
108
+ # sys.path.append(repository)
109
+ from dwind.mp import MultiProcess
110
+
111
+ # NOTE: collect_by_priority has been removed but may need to be reinstated
112
+
113
+ mp = MultiProcess(
114
+ location=location,
115
+ sector=sector,
116
+ scenario=scenario,
117
+ year=year,
118
+ env=env,
119
+ n_nodes=nodes,
120
+ memory=memory,
121
+ walltime=walltime,
122
+ allocation=allocation,
123
+ feature=feature,
124
+ repository=repository,
125
+ model_config=model_config,
126
+ dir_out=dir_out,
127
+ stdout_path=stdout_path,
128
+ )
129
+
130
+ agent_df = utils.load_agents(
131
+ location=location, sector=sector, model_config=model_config, prepare=True
132
+ )
133
+ job_chunk_map = mp.run_jobs(agent_df)
134
+ debug.job_summary(jobs=job_chunk_map.keys(), chunks=job_chunk_map.values())
135
+
136
+ if remove_agent_chunks:
137
+ utils.cleanup_chunks(dir_out, which="agents")
138
+
139
+ if combine:
140
+ run_name = f"{location}_{sector}_{scenario}_{year}"
141
+ collect.combine_chunks(
142
+ dir_out=dir_out, file_name=run_name, remove_results_chunks=remove_results_chunks
143
+ )
144
+
145
+
146
+ @app.command()
147
+ def interactive(
148
+ location: Annotated[
149
+ str, typer.Argument(help="The state, state_county, or priority region to run.")
150
+ ],
151
+ sector: Annotated[
152
+ Sector, typer.Argument(help="One of fom (front of meter) or btm (back-of-the-meter).")
153
+ ],
154
+ scenario: Annotated[Scenario, typer.Argument(help="The scenario to run, such as 'baseline'.")],
155
+ year: Annotated[
156
+ int, typer.Argument(callback=utils.year_callback, help="The year basis of the scenario.")
157
+ ],
158
+ dir_out: Annotated[str, typer.Argument(help="save path")],
159
+ repository: Annotated[
160
+ str, typer.Argument(help="Path to the dwind repository to use when running the model.")
161
+ ],
162
+ model_config: Annotated[
163
+ str, typer.Argument(help="Complete file name and path of the model configuration file")
164
+ ],
165
+ **kwargs: Annotated[
166
+ str, typer.Option(help="Do not pass arguments here, this is for internal overflow only.")
167
+ ],
168
+ ):
169
+ """Run dwind locally, or via an interactive session where a SLURM job is not scheduled."""
170
+ agents = utils.load_agents(
171
+ location=location, sector=sector, model_config=model_config, prepare=True
172
+ )
173
+ model = Model(
174
+ agents=agents,
175
+ location=location,
176
+ sector=sector,
177
+ scenario=scenario,
178
+ year=year,
179
+ out_path=dir_out,
180
+ model_config=model_config,
181
+ )
182
+ model.run()
183
+
184
+
185
+ @app.command()
186
+ def config(
187
+ config_path: Annotated[
188
+ str, typer.Argument(help="Path to configuration TOML with run and model parameters.")
189
+ ],
190
+ use_hpc: Annotated[
191
+ bool,
192
+ typer.Option(help="Run via sbatch on the HPC (--use-hpc) or interactively (--no-use-hpc)."),
193
+ ] = True,
194
+ combine: Annotated[
195
+ bool,
196
+ typer.Option(
197
+ "--combine/--no-combine",
198
+ "-c/-C",
199
+ help=(
200
+ "Automatically combine the chunked results after analysis completion. Ignored"
201
+ " if --no-use-hpc."
202
+ ),
203
+ ),
204
+ ] = True,
205
+ remove_agent_chunks: Annotated[
206
+ bool,
207
+ typer.Option(
208
+ "--remove-agent-chunks/--no-remove-agent-chunks",
209
+ "-ra/-RA",
210
+ help="Delete the temporary agent chunk files. Ignored if --no-use-hpc.",
211
+ ),
212
+ ] = True,
213
+ remove_results_chunks: Annotated[
214
+ bool,
215
+ typer.Option(
216
+ "--remove-results-chunks/--no-remove-results-chunks",
217
+ "-rr/-RR",
218
+ help=(
219
+ "Delete the chunked results files. Ignored if --combine is not passed or"
220
+ " --no-use-hpc is passed."
221
+ ),
222
+ ),
223
+ ] = True,
224
+ ):
225
+ """Run dwind via the HPC multiprocessing interface from a configuration file."""
226
+ config_path = Path(config_path).resolve()
227
+ with config_path.open("rb") as f:
228
+ config = tomllib.load(f)
229
+ print("Running the following configuration:")
230
+ pprint(config)
231
+
232
+ if use_hpc:
233
+ hpc(
234
+ combine=combine,
235
+ remove_agent_chunks=remove_agent_chunks,
236
+ remove_results_chunks=remove_results_chunks,
237
+ **config,
238
+ )
239
+ else:
240
+ interactive(**config)
241
+
242
+
243
+ @app.command()
244
+ def chunk(
245
+ chunk_ix: Annotated[int, typer.Argument(help="Chunk number/index. Used for logging.")],
246
+ location: Annotated[
247
+ str, typer.Argument(help="The state, state_county, or priority region to run.")
248
+ ],
249
+ sector: Annotated[
250
+ Sector, typer.Argument(help="One of fom (front of meter) or btm (back-of-the-meter).")
251
+ ],
252
+ scenario: Annotated[Scenario, typer.Argument(help="The scenario to run, such as baseline.")],
253
+ year: Annotated[
254
+ int, typer.Argument(callback=utils.year_callback, help="The year basis of the scenario.")
255
+ ],
256
+ out_path: Annotated[str, typer.Argument(help="save path")],
257
+ repository: Annotated[
258
+ str, typer.Argument(help="Path to the dwind repository to use when running the model.")
259
+ ],
260
+ model_config: Annotated[
261
+ str, typer.Argument(help="Complete file name and path of the model configuration file")
262
+ ],
263
+ ):
264
+ """Run a chunk of a dwind model. Internal only, do not run outside the context of a
265
+ chunked analysis or debugging.
266
+ """
267
+ # Import the correct version of the library
268
+ sys.path.append(repository)
269
+ from dwind.model import Model
270
+
271
+ agent_file = Path(out_path).resolve() / f"agent_chunks/agents_{chunk_ix}.pqt"
272
+ agents = utils.load_agents(file_name=agent_file, prepare=False)
273
+
274
+ model = Model(
275
+ agents=agents,
276
+ location=location,
277
+ sector=sector,
278
+ scenario=scenario,
279
+ year=year,
280
+ chunk_ix=chunk_ix,
281
+ out_path=out_path,
282
+ model_config=model_config,
283
+ )
284
+ model.run()
285
+
286
+
287
+ if __name__ == "__main__":
288
+ app()