> 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/italiano/tutorial/pywr-scenarios-reading-external-dataframe-and-adding-custom-rules.md).

# Scenari PyWR che leggono DataFrame esterni e aggiungono regole personalizzate

In questo tutorial, lavoreremo con **Rete Thames**, di cui ricevi una copia automaticamente quando crei un account WaterStrategy.

Le fasi coperte includono:

1. **Aggiornamento della domanda di Lee Valley**: leggeremo e aggiorneremo i dati di Lee Valley Demand da un file CSV esterno contenente una serie temporale.
2. **Applicazione dell'incertezza sui cambiamenti climatici**: Le incertezze sui cambiamenti climatici verranno introdotte attivando **scenari pywr**. Queste incertezze verranno applicate a due nodi di bacino (afflussi), regolando le condizioni di afflusso in base a scenari specifici.
3. **Aggiungere una regola personalizzata**: Imparerai come creare una regola personalizzata, un potente strumento che consente l'espansione e l'integrazione della funzionalità WaterStrategy. In questo esempio, verrà creato un nuovo parametro per aumentare dinamicamente il volume massimo di un serbatoio in una data specifica, come definita dall'utente.

Alla fine di questo tutorial, sarai in grado di gestire e personalizzare vari aspetti della rete del Tamigi all'interno di WaterStrategy, utilizzando dati di serie temporali, scenari di incertezza e regole personalizzate.

Caricherai manualmente i file richiesti, quindi assicurati di salvarli sul tuo computer per accedervi facilmente durante il tutorial

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

Per iniziare, in **Materiale per la formazione del progetto**, aperto **Tamigi** rete

<figure><img src="https://2382307583-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBg8BcxZRxPP2vxAwzrhK%2Fuploads%2Fgit-blob-b4c7e0cfddce6b09a343bf0faf44c97cd0c47b91%2Fimage%20(29).png?alt=media" alt=""><figcaption></figcaption></figure>

Clona **Scenario 1**

<figure><img src="https://2382307583-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBg8BcxZRxPP2vxAwzrhK%2Fuploads%2Fgit-blob-dd671f64eae3427748517fbcc7192ea4b7e2d14d%2Fimage%20(27).png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://2382307583-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBg8BcxZRxPP2vxAwzrhK%2Fuploads%2Fgit-blob-e7698d7acd98322487738c85907812450a0e2b7e%2Fimage%20(28).png?alt=media" 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 dynamically 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/italiano/tutorial/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 `build a script that syncs our docs to a CMS` 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.
