diff --git a/configs/green_steel_fy23.json b/configs/green_steel_fy23.json new file mode 100644 index 0000000..0a64d98 --- /dev/null +++ b/configs/green_steel_fy23.json @@ -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" + ] +} diff --git a/configs/pr100_forecasts.json b/configs/pr100_round1_profiles.json similarity index 99% rename from configs/pr100_forecasts.json rename to configs/pr100_round1_profiles.json index d06a0d0..400cf7f 100644 --- a/configs/pr100_forecasts.json +++ b/configs/pr100_round1_profiles.json @@ -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", @@ -635,4 +635,4 @@ "resource_year": "2019" } } -} \ No newline at end of file +} diff --git a/configs/pr100_round2.json b/configs/pr100_round2.json index 46536e4..80df644 100644 --- a/configs/pr100_round2.json +++ b/configs/pr100_round2.json @@ -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" } diff --git a/configs/pr100_round2_profiles.json b/configs/pr100_round2_profiles.json new file mode 100644 index 0000000..9192f43 --- /dev/null +++ b/configs/pr100_round2_profiles.json @@ -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" +} diff --git a/reView/components/divs/chart.py b/reView/components/divs/chart.py index 772cf74..6cfbcfe 100644 --- a/reView/components/divs/chart.py +++ b/reView/components/divs/chart.py @@ -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, @@ -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" + } + ) + ] ) ] ) diff --git a/reView/pages/rev/controller/callbacks.py b/reView/pages/rev/controller/callbacks.py index 4a52ca7..999361a 100644 --- a/reView/pages/rev/controller/callbacks.py +++ b/reView/pages/rev/controller/callbacks.py @@ -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={ @@ -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): @@ -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"), diff --git a/reView/pages/rev/controller/selection.py b/reView/pages/rev/controller/selection.py index 0611416..834b420 100644 --- a/reView/pages/rev/controller/selection.py +++ b/reView/pages/rev/controller/selection.py @@ -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) diff --git a/reView/pages/rev/view.py b/reView/pages/rev/view.py index b9e2dbc..32504b0 100644 --- a/reView/pages/rev/view.py +++ b/reView/pages/rev/view.py @@ -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) diff --git a/reView/utils/config.py b/reView/utils/config.py index b6a08ec..9180329 100644 --- a/reView/utils/config.py +++ b/reView/utils/config.py @@ -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")