> For the complete documentation index, see [llms.txt](https://water-strategy.gitbook.io/waterstrategy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://water-strategy.gitbook.io/waterstrategy/tutorials/pywr-scenarios-reading-external-dataframe-and-adding-custom-rules.md).

# Pywr-scenarios reading external DataFrame and adding Custom Rules

In this tutorial, we will be working with the **Thames Network**, which you receive a copy of automatically when you create a WaterStrategy account.

The steps covered include:

1. **Updating Lee Valley Demand**: We will read and update the Lee Valley Demand data from an external CSV file containing a time series.
2. **Applying Climate Change Uncertainty**: Climate change uncertainties will be introduced by activating **pywr-scenarios**. These uncertainties will be applied to two catchment nodes (inflows), adjusting the inflow conditions based on specified scenarios.
3. **Adding a Custom Rule**: You will learn how to create a Custom Rule, a powerful tool that allows for the expansion and integration of WaterStrategy functionality. In this example, a new parameter will be created to dynamically increase the maximum volume of a reservoir on a specific date, as defined by the user.

By the end of this tutorial, you will be equipped to manage and customize various aspects of the Thames network within WaterStrategy, utilizing time series data, uncertainty scenarios, and custom rules.

You will manually upload the required files, so make sure to save them on your computer for easy access during the tutorial

* [Thames\_Lee\_Valley\_demand](https://nexsysanalytics-my.sharepoint.com/:x:/g/personal/jgonzalez_nexsys-analytics_com/ERY5QXJtGQtFpo7PKUUykJEBI9g6adLvCwxG90xhZqgySQ?e=b4brjW)
* [Thames\_inflows\_pywrScenarios.h5](https://nexsysanalytics-my.sharepoint.com/:u:/g/personal/jgonzalez_nexsys-analytics_com/EV7TBf9J_WZDpF3Oy6HyNmoBj3F4Ew216OE9ltOCC1P8pw?e=YV1A3q)

To get started, in **Project Training Material**, open **Thames** network

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FiPoZ1IGXyOLOpyPxQVBD%2Fimage.png?alt=media&amp;token=d9fea858-cba4-4752-8654-15892f168c6e" alt=""><figcaption></figcaption></figure>

Clone **Scenario 1**

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FwFoPFlAg6oyAFcFTKyoB%2Fimage.png?alt=media&amp;token=76f220b2-4073-4946-a312-41ba0962afc4" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2F8uyhnaUekRgOg4VfA2CR%2Fimage.png?alt=media&amp;token=1fb27ae1-0e75-4f90-8d42-95f9fa331dd8" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://water-strategy.gitbook.io/waterstrategy/tutorials/pywr-scenarios-reading-external-dataframe-and-adding-custom-rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
