NREL-Sienna / PowerGraphics.jl

A package to generate visualizations from PowerSimulations.jl results. Part of the Scalable Integrated Infrastructure Planning Initiative at the National Renewable Energy Lab.

Home Page:https://www.nrel.gov/analysis/sienna.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug in get_generation_results

claytonpbarrows opened this issue · comments

julia> plot_fuel(res, stack = true)
[ Info: reading variables from data store
[ Info: reading parameters from data store
ERROR: ArgumentError: Duplicate variable names: :DateTime. Pass makeunique=true to make them unique using a suffix automatically.
Stacktrace:
 [1] add_names(::DataFrames.Index, ::DataFrames.Index; makeunique::Bool) at /Users/cbarrows/.julia/packages/DataFrames/oQ5c7/src/other/index.jl:323
 [2] hcat!(::DataFrame, ::DataFrame; makeunique::Bool, copycols::Bool) at /Users/cbarrows/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:919
 [3] #hcat!#189 at /Users/cbarrows/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:928 [inlined]
 [4] hcat(::DataFrame, ::DataFrame; makeunique::Bool, copycols::Bool) at /Users/cbarrows/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:954
 [5] hcat at /Users/cbarrows/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:954 [inlined]
 [6] _filter_curtailment!(::Dict{Symbol,DataFrame}, ::Dict{Symbol,DataFrame}, ::Array{NamedTuple{(:parameter, :variable),Tuple{Symbol,Symbol}},1}) at /Users/cbarrows/.julia/packages/PowerGraphics/ApUZA/src/plot_data.jl:210
 [7] get_generation_data(::PowerSimulations.SimulationProblemResults; kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:stack,),Tuple{Bool}}}) at /Users/cbarrows/.julia/packages/PowerGraphics/ApUZA/src/plot_data.jl:254
 [8] plot_fuel(::PlotlyBase.Plot{Array{PlotlyBase.GenericTrace{Dict{Symbol,Any}},1},PlotlyBase.Layout{Dict{Symbol,Any}},Array{PlotlyBase.PlotlyFrame,1}}, ::PowerSimulations.SimulationProblemResults; kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:stack,),Tuple{Bool}}}) at /Users/cbarrows/.julia/packages/PowerGraphics/ApUZA/src/call_plots.jl:264
 [9] plot_fuel(::PowerSimulations.SimulationProblemResults; kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:stack,),Tuple{Bool}}}) at /Users/cbarrows/.julia/packages/PowerGraphics/ApUZA/src/call_plots.jl:248
 [10] top-level scope at REPL[73]:1

I'm still getting this issue with the update.

@ninamvincent can you post the response from ] st and the stack trace that you are getting? I want to make sure that I can reproduce.

I'm not sure what ] st means, but if I run the .jl file from julia directly, I don't get this error. If I run it from jupyter notebook, I get the following trace. I re-ran 02_sequential_simulations.jl since the update if that makes a difference.

ArgumentError: Duplicate variable names: :DateTime. Pass makeunique=true to make them unique using a suffix automatically.

Stacktrace:
 [1] add_names(::DataFrames.Index, ::DataFrames.Index; makeunique::Bool) at /Users/ninavincent/.julia/packages/DataFrames/oQ5c7/src/other/index.jl:323
 [2] hcat!(::DataFrames.DataFrame, ::DataFrames.DataFrame; makeunique::Bool, copycols::Bool) at /Users/ninavincent/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:919
 [3] #hcat!#189 at /Users/ninavincent/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:928 [inlined]
 [4] hcat(::DataFrames.DataFrame, ::DataFrames.DataFrame; makeunique::Bool, copycols::Bool) at /Users/ninavincent/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:954
 [5] hcat at /Users/ninavincent/.julia/packages/DataFrames/oQ5c7/src/dataframe/dataframe.jl:954 [inlined]
 [6] _filter_curtailment!(::Dict{Symbol,DataFrames.DataFrame}, ::Dict{Symbol,DataFrames.DataFrame}, ::Array{NamedTuple{(:parameter, :variable),Tuple{Symbol,Symbol}},1}) at /Users/ninavincent/.julia/packages/PowerGraphics/3Fcgj/src/plot_data.jl:210
 [7] get_generation_data(::PowerSimulations.SimulationProblemResults; kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:stack,),Tuple{Bool}}}) at /Users/ninavincent/.julia/packages/PowerGraphics/3Fcgj/src/plot_data.jl:254
 [8] plot_fuel(::PlotlyBase.Plot{Array{PlotlyBase.GenericTrace{Dict{Symbol,Any}},1},PlotlyBase.Layout{Dict{Symbol,Any}},Array{PlotlyBase.PlotlyFrame,1}}, ::PowerSimulations.SimulationProblemResults; kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:stack,),Tuple{Bool}}}) at /Users/ninavincent/.julia/packages/PowerGraphics/3Fcgj/src/call_plots.jl:264
 [9] plot_fuel(::PowerSimulations.SimulationProblemResults; kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:stack,),Tuple{Bool}}}) at /Users/ninavincent/.julia/packages/PowerGraphics/3Fcgj/src/call_plots.jl:248
 [10] top-level scope at In[11]:1
 [11] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091

I suspect that there is a discrepancy between the environment that your .jl script is running in, and the environment that your notebook is using. Notebooks try to use the right environment by looking for existing environments (Project.toml files) in their upstream path. Depending on how you are starting Julia, you may not be doing that when you are running the .jl file.
You can check by running the following commands in both the notebook and the .jl script (or in the REPL).

using Pkg
Pkg.status()

I'm guessing that the notebook environment has an older version of power graphics than the script/REPL. If that's the case, you should be able to resolve by:

  1. navigate to your SIIPExamples.jl folder
  2. start Julia
  3. run
using Pkg
Pkg.activate(".")
Pkg.up()
Pkg.status()

Also, ] st is just a shortcut to running Pkg.status(). If you type ] in the Julia REPL, your cursor should turn blue, indicating that you have entered the package manager. Then you can execute add, st, up ... and other commands.

Finally, feel free to ping us on slack if you need help debugging.