Skip to content

Commit

Permalink
Added some configs
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamsTravis committed Jun 30, 2023
1 parent df35145 commit 058088f
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 26 deletions.
18 changes: 18 additions & 0 deletions configs/green_steel_fy23.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"project_name": "Green Steel Hydrogen - FY23",
"directory": "~/review_datasets/green_steel_fy23/",
"units": {
"wind_lcoh_component": "USD/kg",
"solar_lcoh_component": "USD/kg",
"h2_lcoh_component": "USD/kg",
"pipe_lcoh_component": "USD/kg",
"water_lcoh_component": "USD/kg",
"no_pipe_lcoh_fcr": "USD/kg",
"total_lcoh_fcr": "USD/kg"
},
"characterizations_cols": [
"usa_mrlc_nlcd2011",
"fed_land_owner",
"2016_30m_cdls_rev90m"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"project_name": "PR100 - Forecasts",
"directory": "~/review_datasets/pr100_forecasts",
"project_name": "PR100 - Round 1 - Profiles",
"directory": "~/review_datasets/pr100_round1_profiles",
"variables": {
"00_solar_upv_one_day_limited_22_rep-profiles_2018": {
"run_number": "00",
Expand Down Expand Up @@ -635,4 +635,4 @@
"resource_year": "2019"
}
}
}
}
5 changes: 3 additions & 2 deletions configs/pr100_round2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"project_name": "PR100 - Utility-scale Round 2",
"directory": "~/review_datasets/pr100_utility_scale_round2"
"project_name": "PR100 - Round 2",
"directory": "~/review_datasets/pr100_round2/",
"var_options": "~/review_datasets/pr100_round2/variable_options.csv"
}
5 changes: 5 additions & 0 deletions configs/pr100_round2_profiles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"project_name": "PR100 - Round 2 - Profiles",
"directory": "~/review_datasets/pr100_round2_profiles/",
"var_options": "~/review_datasets/pr100_round2_profiles/variable_options.csv"
}
66 changes: 50 additions & 16 deletions reView/components/divs/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def above_chart_options_div(id_prefix, class_name="row"):
children=[
# Submit Button to avoid repeated callbacks
html.Div(
className="ten columns",
className="eight columns",
style={"margin-right": "-50px"},
children=dcc.Dropdown(
id=f"{id_prefix}_additional_scenarios",
clearable=False,
Expand All @@ -120,21 +121,54 @@ def above_chart_options_div(id_prefix, class_name="row"):
),
),
html.Div(
className="two columns",
children=dbc.Button(
id=f"{id_prefix}_submit_additional_scenarios",
children="Submit",
color="white",
n_clicks=0,
size="lg",
title="Click to submit options",
className="mb-1",
style={
"height": "91%",
"width": "135%",
"margin-left": "-50px"
}
)
className="four columns",
children=[
dbc.Button(
id=f"{id_prefix}_select_all_scenarios",
children="ALL",
color="white",
n_clicks=0,
size="lg",
title="Click to select all available options",
className="mb-1",
style={
"height": "91%",
# "width": "100%",
"padding": "5px",
"margin-right": "50px",
}
),
dbc.Button(
id=f"{id_prefix}_clear_all_scenarios",
children="CLEAR",
color="white",
n_clicks=0,
size="lg",
title="Click to clear all selected options",
className="mb-1",
style={
"height": "91%",
# "width": "100%",
"padding": "5px",
"margin-right": "50px"
}
),
dbc.Button(
id=f"{id_prefix}_submit_additional_scenarios",
children="Submit",
color="white",
n_clicks=0,
size="lg",
title="Click to submit options",
className="mb-1",
style={
"height": "91%",
# "width": "100%",
"padding": "5px",
# "margin-left": "-50px"
}
)
]
)
]
)
Expand Down
29 changes: 27 additions & 2 deletions reView/pages/rev/controller/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def build_scenario_dropdowns(groups, dropid=None, multi=False, dynamic=False,
dcc.Dropdown(
id=dropid,
options=options,
value=values[0],
# value=values[0],
value="all",
optionHeight=50,
multi=multi,
style={
Expand Down Expand Up @@ -306,7 +307,14 @@ def filter_files(project, filters, options):
if value != "all":
options = options[options[col] == value]

return list(options["file"].values)
# Expand relative paths
files = []
for file in options["file"].values:
if file.startswith("./"):
file = str(config.directory.joinpath(file))
files.append(file)

return files


def files_to_dropdown(files):
Expand Down Expand Up @@ -724,6 +732,23 @@ def dropdown_scenarios(
return return_package


@app.callback(
Output("rev_additional_scenarios", "value"),
Input("rev_clear_all_scenarios", "n_clicks"),
Input("rev_select_all_scenarios", "n_clicks"),
State("rev_additional_scenarios", "options")
)
@calls.log
def dropdown_scenarios_adjust_additional(clear_all, select_all, options):
"""Add all or clear the additional dropdown scenarios."""
# Catcht the triggering element
trigger = callback_trigger()
values = []
if "select" in trigger:
values = [op["value"] for op in options]
return values


@app.callback(
Output("variable", "options"),
Output("variable", "value"),
Expand Down
3 changes: 2 additions & 1 deletion reView/pages/rev/controller/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ def choose_scenario(scenario_options, config):
return file_for_selections(selected_options, config)


# pylint: disable=dangerous-default-value
def get_variable_options(
project,
scenario_a,
scenario_b,
b_div={"display": "none"}
): # pylint: disable=dangerous-default-value
):
"""Retrieve appropriate variable list."""
# Initialize lists
config = Config(project)
Expand Down
2 changes: 1 addition & 1 deletion reView/pages/rev/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from reView.utils.config import Config


DEFAULT_PROJECT = "PR100 - Forecasts"
DEFAULT_PROJECT = "PR100 - Round 2"
if DEFAULT_PROJECT not in list(Config.projects):
DEFAULT_PROJECT = sorted(Config.projects)[0]
DEFAULT_CONFIG = Config(DEFAULT_PROJECT)
Expand Down
5 changes: 4 additions & 1 deletion reView/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ def all_files(self):
""":obj:`generator`: Generator of raw project files."""
if self.options is not None and "file" in self.options:
for file in self.options.file:
yield Path(file).expanduser().resolve()
if file.startswith("./"):
yield self.directory.joinpath(file).expanduser()
else:
yield Path(file).expanduser()
else:
cfiles = self.directory.rglob("*.csv")
pfiles = self.directory.rglob("*.parquet")
Expand Down

0 comments on commit 058088f

Please sign in to comment.