
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gat_plot_examples/08_load_heatmap.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gat_plot_examples_08_load_heatmap.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gat_plot_examples_08_load_heatmap.py:


Load Heatmap and Duration Curve
-------------------------------

Two complementary views of the load shape:

1. **Heatmap** — hour-of-day × day-of-year, showing when load peaks
   typically occur (e.g., evening ramps, weekday vs. weekend).
2. **Sorted (load duration curve)** — load values sorted descending,
   showing how often demand exceeds a given level. Useful for sizing
   peaking capacity.

Both functions take a single ``pd.Series`` indexed by timestamp, so
you can apply them to any timeseries (load, net load, individual
generator output, etc.).

.. GENERATED FROM PYTHON SOURCE LINES 17-42



.. image-sg:: /gat_plot_examples/images/sphx_glr_08_load_heatmap_001.png
   :alt: Load Heatmap, Load Duration Curve
   :srcset: /gat_plot_examples/images/sphx_glr_08_load_heatmap_001.png
   :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/datahelpers/sienna.py:381: UserWarning: StandardLoad was not found. Use one of the following components
      warnings.warn(message, UserWarning)
    ----- Available Components -----
    RenewableNonDispatch
    LoadZone
    RenewableDispatch
    FixedAdmittance
    ACBus
    Area
    VariableReserve
    TwoTerminalHVDCLine
    ThermalStandard
    Arc
    PowerLoad
    TapTransformer
    Line
    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/scenariohandlers/sienna.py:508: UserWarning: Could not find dataset with pattern ActivePowerTimeSeriesParameter__StandardLoad, consider updating the configuration or removing this pattern to avoid a warning.
      warnings.warn(message, UserWarning)
    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/scenariohandlers/sienna.py:508: UserWarning: Could not find dataset with pattern ActivePowerInVariable*, consider updating the configuration or removing this pattern to avoid a warning.
      warnings.warn(message, UserWarning)
    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/scenariohandlers/sienna.py:523: UserWarning: No matching datasets found for ['ActivePowerInVariable*'], consider updating the configuration.
      warnings.warn(message, UserWarning)
    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/scenariohandlers/sienna.py:706: UserWarning: Unable to create storage load timeseries data, additional calculated loads may not be available.
      warnings.warn(
    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/scenariohandlers/sienna.py:508: UserWarning: Could not find dataset with pattern ActivePowerOutVariable*, consider updating the configuration or removing this pattern to avoid a warning.
      warnings.warn(message, UserWarning)
    /home/runner/work/GridAnalysisToolkit/GridAnalysisToolkit/src/gat/scenariohandlers/sienna.py:508: UserWarning: Could not find dataset with pattern ActivePowerTimeSeriesParameter__StandardLoad, consider updating the configuration or removing this pattern to avoid a warning.
      warnings.warn(message, UserWarning)






|

.. code-block:: Python

    import warnings
    warnings.filterwarnings("ignore", category=DeprecationWarning)

    import matplotlib.pyplot as plt
    from gat.scenariohandlers import SiennaScenario
    from gat.quickplots.core import plot_series_heatmap, plot_series_sorted

    sienna_v4 = "../../example_data/sienna/v4"
    scenario = SiennaScenario(
        simulation_files=f"{sienna_v4}/simulation_store.h5",
        system_file=f"{sienna_v4}/sys.json",
    )

    # Build a system-wide load series by summing the area-aggregated load
    dispatch = scenario.get_area_dispatch(include_charging=False, include_use=False)
    load_cols = [c for c in dispatch.columns if c[1] == "Native Demand"]
    total_load = dispatch[load_cols].sum(axis=1)
    total_load.name = "system_load_mw"

    fig, axs = plt.subplots(1, 2, figsize=(14, 5))
    plt.sca(axs[0]); plot_series_heatmap(total_load); axs[0].set_title("Load Heatmap")
    plt.sca(axs[1]); plot_series_sorted(total_load); axs[1].set_title("Load Duration Curve")

    plt.tight_layout()
    plt.show()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.267 seconds)


.. _sphx_glr_download_gat_plot_examples_08_load_heatmap.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: 08_load_heatmap.ipynb <08_load_heatmap.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: 08_load_heatmap.py <08_load_heatmap.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: 08_load_heatmap.zip <08_load_heatmap.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
