-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move arg parser to separate file
- Loading branch information
Jon Hagg
committed
Dec 14, 2020
1 parent
814a3b2
commit 88e5c72
Showing
3 changed files
with
85 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
__all__ = ["const", "extract_data"] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import argparse | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser(description="Run REISE.jl simulation.") | ||
|
||
# Arguments needed to run REISE.jl | ||
parser.add_argument( | ||
"-s", | ||
"--start-date", | ||
help="The start date for the simulation in format 'YYYY-MM-DD'. 'YYYY-MM-DD HH'. " | ||
"'YYYY-MM-DD HH:MM', or 'YYYY-MM-DD HH:MM:SS'.", | ||
) | ||
parser.add_argument( | ||
"-e", | ||
"--end-date", | ||
help="The end date for the simulation in format 'YYYY-MM-DD'. 'YYYY-MM-DD HH'. " | ||
"'YYYY-MM-DD HH:MM', or 'YYYY-MM-DD HH:MM:SS'. If only the date is specified " | ||
"(without any hours), the entire end-date will be included in the simulation.", | ||
) | ||
parser.add_argument( | ||
"-int", "--interval", help="The length of each interval in hours.", type=int | ||
) | ||
parser.add_argument( | ||
"-i", | ||
"--input-dir", | ||
help="The directory containing the input data files. " | ||
"Required files are 'case.mat', 'demand.csv', " | ||
"'hydro.csv', 'solar.csv', and 'wind.csv'.", | ||
) | ||
parser.add_argument( | ||
"-x", | ||
"--execute-dir", | ||
help="The directory to store the results. This is optional and defaults " | ||
"to an execute folder that will be created in the input directory " | ||
"if it does not exist.", | ||
) | ||
parser.add_argument( | ||
"-t", | ||
"--threads", | ||
type=int, | ||
help="The number of threads to run the simulation with. " | ||
"This is optional and defaults to Auto.", | ||
) | ||
parser.add_argument( | ||
"-d", | ||
"--extract-data", | ||
action="store_true", | ||
help="If this flag is used, the data generated by the simulation after the engine " | ||
"has finished running will be automatically extracted into .pkl files, " | ||
"and the result.mat files will be deleted. " | ||
"The extraction process can be memory intensive. " | ||
"This is optional and defaults to False.", | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--output-dir", | ||
help="The directory to store the extracted data. This is optional and defaults " | ||
"to the execute directory. This flag is only used if the extract-data flag is set.", | ||
) | ||
parser.add_argument( | ||
"-m", | ||
"--matlab-dir", | ||
help="The directory to store the modified case.mat used by the engine. " | ||
"This is optional and defaults to the execute directory. " | ||
"This flag is only used if the extract-data flag is set.", | ||
) | ||
parser.add_argument( | ||
"-k", | ||
"--keep-matlab", | ||
action="store_true", | ||
help="The result.mat files found in the execute directory will be kept " | ||
"instead of deleted after extraction. " | ||
"This flag is only used if the extract-data flag is set.", | ||
) | ||
|
||
# For backwards compatability with PowerSimData | ||
parser.add_argument( | ||
"scenario_id", | ||
nargs="?", | ||
default=None, | ||
help="Scenario ID only if using PowerSimData. ", | ||
) | ||
return parser.parse_args() |