Skip to content

Commit

Permalink
formatter cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Feb 8, 2024
1 parent 0d91d47 commit ffc71dd
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 61 deletions.
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Documenter, PowerGraphics

makedocs(
makedocs(;
modules = [PowerGraphics],
format = Documenter.HTML(),
sitename = "PowerGraphics.jl",
Expand All @@ -12,7 +12,7 @@ makedocs(
],
)

Documenter.deploydocs(
Documenter.deploydocs(;
repo = "github.com/NREL-Sienna/PowerGraphics.jl.git",
target = "build",
branch = "gh-pages",
Expand Down
3 changes: 0 additions & 3 deletions src/call_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ plot = plot_dataframe(df, time_range)
- `nofill::Bool` : force empty area fill
- `stair::Bool`: Make a stair plot instead of a stack plot
"""

function plot_dataframe(df::DataFrames.DataFrame; kwargs...)
return plot_dataframe!(_empty_plot(), PA.no_datetime(df), df.DateTime; kwargs...)
end
Expand Down Expand Up @@ -213,7 +212,6 @@ If only the dataframe is provided, it must have a column of `DateTime` values.
- `nofill::Bool` : force empty area fill
- `stair::Bool`: Make a stair plot instead of a stack plot
"""

function plot_dataframe!(p, df::DataFrames.DataFrame; kwargs...)
return plot_dataframe!(p, PA.no_datetime(df), df.DateTime; kwargs...)
end
Expand Down Expand Up @@ -404,7 +402,6 @@ plot = plot_fuel(res)
- `stair::Bool`: Make a stair plot instead of a stack plot
- `filter_func::Function = PowerSystems.get_available` : filter components included in plot
"""

function plot_fuel(result::IS.Results; kwargs...)
return plot_fuel!(_empty_plot(), result; kwargs...)
end
Expand Down
4 changes: 2 additions & 2 deletions src/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function load_palette(file)
for (k, v) in palette_config
push!(palette_colors, PaletteColor(k, v["RGB"], v["order"]))
end
sort!(palette_colors, by = x -> x.order)
sort!(palette_colors; by = x -> x.order)
return palette_colors
end

Expand Down Expand Up @@ -117,7 +117,7 @@ function match_fuel_colors(data::DataFrames.DataFrame, backend; palette = PALETT
color_range = get_palette_fuel(palette)
end
color_fuel =
DataFrames.DataFrame(fuels = get_palette_category(palette), colors = color_range)
DataFrames.DataFrame(; fuels = get_palette_category(palette), colors = color_range)
names = DataFrames.names(data)
default =
[(color_fuel[findall(in(["$(names[1])"]), color_fuel.fuels), :][:, :colors])[1]]
Expand Down
2 changes: 1 addition & 1 deletion src/make_report.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function report(res::IS.Results, out_path::String, design_template::String; kwar
throw(ArgumentError("The provided template file is invalid"))
args = Dict("results" => res, "backend" => backend)
Weave.weave(
design_template,
design_template;
out_path = out_path,
latex_cmd = ["xelatex"],
doctype = doctype,
Expand Down
4 changes: 2 additions & 2 deletions src/plot_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function _dataframe_plots_internal(
data = Matrix(PA.no_datetime(variable))
labels = DataFrames.names(PA.no_datetime(variable))
if stack
plot_data = cumsum(data, dims = 2)
plot_data = cumsum(data; dims = 2)
if !nofill
plot_kwargs[:fillrange] = hcat(zeros(length(time_range)), plot_data)
end
Expand Down Expand Up @@ -75,7 +75,7 @@ function _dataframe_plots_internal(
plot_kwargs[:grid] = false

if bar
plot_data = sum(plot_data, dims = 1) ./ interval
plot_data = sum(plot_data; dims = 1) ./ interval
if stack
x = nothing
plot_data = plot_data[end:-1:1, end:-1:1]
Expand Down
2 changes: 1 addition & 1 deletion src/plotly_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function _dataframe_plots_internal(

plot_kwargs = Dict()
if bar
plot_data = sum(plot_data, dims = 1) ./ interval
plot_data = sum(plot_data; dims = 1) ./ interval
showtxicklabels = false
if nofill
plot_kwargs[:type] = "scatter"
Expand Down
28 changes: 14 additions & 14 deletions test/test_data/results_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function add_re!(sys)

for g in get_components(HydroEnergyReservoir, sys)
tpc = get_operation_cost(g)
smc = StorageManagementCost(
smc = StorageManagementCost(;
variable = get_variable(tpc),
fixed = get_fixed(tpc),
start_up = 0.0,
Expand Down Expand Up @@ -68,12 +68,12 @@ function run_test_sim(result_dir::String)
if ispath(sim_path)
@info "Reading UC system from" sim_path
c_sys5_hy_uc = System(
joinpath(sim_path, "..", "c_sys5_hy_uc.json"),
joinpath(sim_path, "..", "c_sys5_hy_uc.json");
time_series_read_only = true,
)
@info "Reading ED system from" sim_path
c_sys5_hy_ed = System(
joinpath(sim_path, "..", "c_sys5_hy_ed.json"),
joinpath(sim_path, "..", "c_sys5_hy_ed.json");
time_series_read_only = true,
)
results_folders = filter!(x -> occursin("results_sim", x), readdir(result_dir))
Expand All @@ -89,8 +89,8 @@ function run_test_sim(result_dir::String)
@info "Adding extra RE"
add_re!(c_sys5_hy_uc)
add_re!(c_sys5_hy_ed)
to_json(c_sys5_hy_uc, joinpath(sim_path, "..", "c_sys5_hy_uc.json"), force = true)
to_json(c_sys5_hy_ed, joinpath(sim_path, "..", "c_sys5_hy_ed.json"), force = true)
to_json(c_sys5_hy_uc, joinpath(sim_path, "..", "c_sys5_hy_uc.json"); force = true)
to_json(c_sys5_hy_ed, joinpath(sim_path, "..", "c_sys5_hy_ed.json"); force = true)

mkpath(result_dir)
GLPK_optimizer =
Expand All @@ -105,7 +105,7 @@ function run_test_sim(result_dir::String)
)
set_device_model!(template_hydro_st_uc, GenericBattery, StorageDispatchWithReserves)

template_hydro_st_ed = template_economic_dispatch(
template_hydro_st_ed = template_economic_dispatch(;
network = CopperPlatePowerModel,
use_slacks = true,
duals = [CopperPlateBalanceConstraint],
Expand All @@ -118,30 +118,30 @@ function run_test_sim(result_dir::String)
)
set_device_model!(template_hydro_st_ed, GenericBattery, StorageDispatchWithReserves)
template_hydro_st_ed.services = Dict() #remove ed services
models = SimulationModels(
models = SimulationModels(;
decision_models = [
DecisionModel(
template_hydro_st_uc,
c_sys5_hy_uc,
c_sys5_hy_uc;
optimizer = GLPK_optimizer,
name = "UC",
system_to_file = false,
),
DecisionModel(
template_hydro_st_ed,
c_sys5_hy_ed,
c_sys5_hy_ed;
optimizer = GLPK_optimizer,
name = "ED",
system_to_file = false,
),
],
)

sequence = SimulationSequence(
sequence = SimulationSequence(;
models = models,
feedforwards = feedforward = Dict(
"ED" => [
SemiContinuousFeedforward(
SemiContinuousFeedforward(;
component_type = ThermalStandard,
source = OnVariable,
affected_values = [ActivePowerVariable],
Expand All @@ -150,7 +150,7 @@ function run_test_sim(result_dir::String)
),
ini_cond_chronology = InterProblemChronology(),
)
sim = Simulation(
sim = Simulation(;
name = "results_sim",
steps = 2,
models = models,
Expand Down Expand Up @@ -186,11 +186,11 @@ function run_test_prob()

prob = DecisionModel(
template_hydro_st_uc,
c_sys5_hy_uc,
c_sys5_hy_uc;
optimizer = GLPK_optimizer,
horizon = 12,
)
build!(prob, output_dir = mktempdir())
build!(prob; output_dir = mktempdir())
solve!(prob)
res = ProblemResults(prob)
return res
Expand Down
Loading

0 comments on commit ffc71dd

Please sign in to comment.