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

# Escenarios de PyWR que leen un DataFrame externo y agregan reglas personalizadas

En este tutorial, trabajaremos con **Red Thames**, de la que recibe una copia automáticamente cuando crea una cuenta WaterStrategy.

Los pasos cubiertos incluyen:

1. **Actualización de la demanda de Lee Valley**: Leeremos y actualizaremos los datos de Lee Valley Demand a partir de un archivo CSV externo que contiene una serie temporal.
2. **Aplicando la incertidumbre del cambio climático**: Las incertidumbres sobre el cambio climático se introducirán mediante la activación **escenarios de pywr**. Estas incertidumbres se aplicarán a dos nodos de captación (entradas), ajustando las condiciones de entrada en función de los escenarios especificados.
3. **Agregar una regla personalizada**: Aprenderá a crear una regla personalizada, una poderosa herramienta que permite la expansión e integración de la funcionalidad WaterStrategy. En este ejemplo, se creará un nuevo parámetro para aumentar dinámicamente el volumen máximo de un depósito en una fecha específica, según lo defina el usuario.

Al final de este tutorial, estará equipado para administrar y personalizar varios aspectos de la red del Támesis en WaterStrategy, utilizando datos de series temporales, escenarios de incertidumbre y reglas personalizadas.

Subirás manualmente los archivos necesarios, así que asegúrate de guardarlos en tu ordenador para acceder fácilmente a ellos durante el tutorial

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

Para empezar, en **Material de capacitación del proyecto**, abrir **Támesis** red

<figure><img src="/files/J6ftHiZBgb2pJI8HVBd0" alt=""><figcaption></figcaption></figure>

Clon **Escenario 1**

<figure><img src="/files/Dj9HNZExajfH8adE1o8t" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/2Wk6aI09uQ0TiHLYWwMT" 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 current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
