# Pywr-Scenarios

Pywr Scenarios offer a more advanced and comprehensive approach to water management modeling, particularly when working with uncertainty and asessing various combinations of data and system behaviors and data inputs. Unlike WaterStrategy Scenarios, which focus on localized adjustments, Pywr Scenarios allow you to experiment with a wide range of possibilities by varying multiple inputs and combinations simultaneously.

In Pywr Scenarios:

* Users can define multiple scenarios, with each scenario containing multiple variations (or sizes).
* The system will simulate all combinations of these variations unless a specific combination is selected for simulation.

For example, if two Pywr Scenarios are defined, each with three variations (size = 3), the total number of simulations will be 9 (3 x 3). This approach enables users to explore a wide range of potential outcomes and interactions between different factors in the model.

## 1.  Activating Pywr Scenarios

In a Network, click on *View Network Data* icon <img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FIcFhMfJWCrvp6B16aGfa%2Fimage.png?alt=media&#x26;token=40fa29d4-8258-4895-b4e9-dd78d762d1e4" alt="" data-size="line">

This will open the right panel. In the section **Inputs**, type "*scenarios"* and click on *Add an Input* icon <img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FBOPd5wjs350BSyo5psSA%2Fimage.png?alt=media&#x26;token=68053907-c2cd-48a0-ad54-13137fec4b4c" alt="" data-size="line">

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2Fkxps636PAXqYYhJPEFdA%2Fimage.png?alt=media&#x26;token=a2a8d845-5512-47c1-af34-3c768359ef42" alt=""><figcaption></figcaption></figure>

A window will be displayed, type "*scenarios"*, select the **scenarios** attribute and click **Save** as shown in the following image

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FDpZi15t7rkdKZ5Kbea2Z%2Fimage.png?alt=media&#x26;token=8a9d656d-3f14-4a37-9d1d-6ebfcaa84d16" alt=""><figcaption></figcaption></figure>

A new window will pop up, select **PYWR\_SCENARIOS** and click **Save**

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2F4qDCeYmzCkYiB9cPqfSt%2Fimage.png?alt=media&#x26;token=927c6021-6a86-4edf-bcb8-3ef2717f0565" alt=""><figcaption></figcaption></figure>

## 2.  Creating pywr-scenarios

Once the scenario customization panel is open, you can define as many Pywr Scenarios as needed. To create a new Pywr Scenario, follow these steps:

Click <img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FmhgYtGk7jub3Aob9kfeJ%2Fimage.png?alt=media&#x26;token=2f2e59c4-3907-4aa5-b08a-7d055936c550" alt="" data-size="line">

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FXzwbGcKknxF4OmKRd0TP%2Fimage.png?alt=media&#x26;token=9ca357f0-83d3-46a2-912d-7911cdabad46" alt=""><figcaption></figcaption></figure>

Edit the current default scenario by clicking on <img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FYD6QqTQ6KvkF1IUSHouI%2Fimage.png?alt=media&#x26;token=20aec23e-b6ce-4174-8de3-43f64ef114b1" alt="" data-size="line">

Enter a **Name** for the Pywr-Scenario and specify the **Size** (number of variations).

The **Ensembles** attribute is optional and helps keep track of specific index scenarios within the Pywr Scenario

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2F7HCW7aOecOtHAjjhTrMO%2Fimage.png?alt=media&#x26;token=8206c401-b42e-498c-97f1-e6615a956988" alt=""><figcaption></figcaption></figure>

After creating the pywr-scenarios, the system will display the following information:

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FYdlAWOdPMeYkyX07Ffhr%2Fimage.png?alt=media&#x26;token=a0138c0c-a998-447d-a225-e85f22ca5028" alt=""><figcaption></figcaption></figure>

Clicking on the **JSON** tab will display the automatic JSON version of the **Pywr-Scenario** definition

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FLbSseWujAUSQozDvX6Wi%2Fimage.png?alt=media&#x26;token=7e76a0f2-e260-4f64-9985-b4f7e90d4672" alt="" width="409"><figcaption></figcaption></figure>

To load the data as h5 DataFrameParameter, please refer to [HDF5 Parameter section](https://water-strategy.gitbook.io/waterstrategy/modeling-basics/parameters/hdf5-parameter) in order to access properly to the scenario data
