Breakthrough-Energy / PostREISE

Analyze and plot post simulation data
https://breakthrough-energy.github.io/docs/
MIT License
6 stars 13 forks source link

Fix warnings #374

Closed rouille closed 2 years ago

rouille commented 2 years ago

The following warnings are printed when running tests:

postreise/plot/tests/test_plot_capacity_map.py::test_map_plant_capacity
postreise/plot/tests/test_plot_capacity_map.py::test_map_plant_capacity
postreise/plot/tests/test_plot_capacity_map.py::test_map_plant_capacity
  /Users/brdo/CEM/PostREISE/.tox/pytest/lib/python3.9/site-packages/bokeh/models/plots.py:815: UserWarning: 
  You are attempting to set `plot.legend.label_text_font_size` on a plot that has zero legends added, this will have no effect.

  Before legend properties can be set, you must add a Legend explicitly, or call a glyph method with a legend parameter set.

    warnings.warn(_LEGEND_EMPTY_WARNING % attr)

postreise/plot/tests/test_plot_capacity_map.py::test_map_plant_capacity
postreise/plot/tests/test_plot_capacity_map.py::test_map_plant_capacity
postreise/plot/tests/test_plot_capacity_map.py::test_map_plant_capacity
  /Users/brdo/CEM/PostREISE/.tox/pytest/lib/python3.9/site-packages/bokeh/models/plots.py:815: UserWarning: 
  You are attempting to set `plot.legend.location` on a plot that has zero legends added, this will have no effect.

  Before legend properties can be set, you must add a Legend explicitly, or call a glyph method with a legend parameter set.

    warnings.warn(_LEGEND_EMPTY_WARNING % attr)

postreise/plot/tests/test_plot_scatter_capacity_vs_curtailment.py::test_plot_scatter_capacity_vs_curtailment
postreise/plot/tests/test_plot_scatter_capacity_vs_curtailment.py::test_plot_scatter_capacity_vs_curtailment
  /Users/brdo/CEM/PostREISE/postreise/plot/plot_scatter_capacity_vs_curtailment.py:87: FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version. Use a list instead.
    curtailment = curtailment[set(plant_list) & set(curtailment.columns)]

postreise/plot/tests/test_plot_scatter_capacity_vs_curtailment.py::test_plot_scatter_capacity_vs_curtailment
  /Users/brdo/CEM/PostREISE/postreise/plot/plot_scatter_capacity_vs_curtailment.py:114: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
    _, ax = plt.subplots(figsize=[20, 10])

The last one needs attention. We need to close the plots in each testing module.