# PyWR 场景读取外部 DataFrame 并添加自定义规则

在本教程中，我们将使用 **泰晤士网络**，当你创建 WaterStrategy 账户时，你会自动收到该账户的副本。

涵盖的步骤包括：

1。 **更新李谷需求**：我们将从包含时间序列的外部 CSV 文件中读取和更新 Lee Valley 需求数据。 2。 **应用气候变化的不确定性**: 激活将引入气候变化的不确定性 **pywr 场景**。这些不确定性将应用于两个集水节点（流入），根据指定的情景调整流入条件。 3. **添加自定义规则**：您将学习如何创建自定义规则，这是一款强大的工具，允许扩展和集成 WaterStrategy 功能。在此示例中，将创建一个新参数，用于在用户定义的特定日期动态增加水库的最大容量。

在本教程结束时，您将能够利用时间序列数据、不确定性情景和自定义规则，在 WaterStrategy 中管理和自定义泰晤士网络的各个方面。

您将手动上传所需的文件，因此请务必将它们保存在您的计算机上，以便在教程中轻松访问

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

首先，在 **项目培训材料**，打开 **泰晤士河** 网络

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

克隆 **场景 1**

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

<figure><img src="/files/rVWShD9hruQLK2McqsDE" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://water-strategy.gitbook.io/waterstrategy/zhong-guo-ren/jiao-cheng/pywr-scenarios-reading-external-dataframe-and-adding-custom-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
