Skip to content

Feature request: Option to Save or Not Save Plots #512

@RHammond2

Description

@RHammond2

Optionally Save HOPP plots

Every time HOPP is run, battery_output.png and generation_profile.png are created, which are not universally required. For both testing and docs building, this is unnecessary and requires additional teardown steps. Ideally, this should be a model input parameter.

https://github.com/NatLabRockies/H2Integrate/blob/d51a3cd99389be7b922f1c0329fbb3920cb94be3/h2integrate/converters/hopp/hopp_wrapper.py#L161C13-L168C21

Proposed solution

Include an option in the HOPP config (using https://github.com/NatLabRockies/H2Integrate/blob/main/examples/25_sizing_modes/tech_inputs/hopp_config_tx.yaml#L209) as an example, it could go in the simulation_options like the following, which would allow for the code modifications listed beneath.

#hopp_config_tx.yaml
...
config:
  simulation_options:
    cache: true
    save_figures: false
    wind:
      skip_financial: false
# h2integrate/converters/hopp/hopp_wrapper.py::161
            try:
                system = self.hybrid_interface.system
                save = self.hopp_config["config"]["simulation_options"]["save_figures"]
                plot_battery_output(system, start_day=180, plot_filename="battery_output.png" if save else None)
                plot_generation_profile(
                    system, start_day=180, plot_filename="generation_profile.png" if save else None
                )
            except AttributeError:
                pass

Alternatives considered

Currently these are included in the .gitignore, and to remove them locally I either delete them manually. In a separate testing work, their removal is part of a teardown phase, but the example itself is called in more than one place, so this is required in more than one place.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions