# Adding reservoir bathymetry (Area)

## Background <a href="#background" id="background"></a>

The Area that a Reservoir or Storage node covers depends on how full the reservoir is.

The **Area Rating Curve** <mark style="color:purple;">determines gives</mark> the Area of a reservoir as a function of its Level or Storage. In WaterStrategy and Pywr, the time step storage of a reservoir is known at each time step. We can use this storage with an Area rating cure to calculate the reservoir area and therefore its evaporation at each time-step.

Below is an example Area rating table:

| Volume (Mm3) | Area (Km2) |
| ------------ | ---------- |
| 0            | 1          |
| 7            | 2          |
| 10           | 4          |
| 15           | 6          |
| 25           | 14         |

When plotted it looks like this:

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FbchAnapVwk6shY6tC9vz%2Fimage.png?alt=media&#x26;token=9a9ba5a9-f2d6-4cb9-8a2a-d09830b234c7" alt=""><figcaption><p>Area Rating Curve</p></figcaption></figure>

[Pywr Parameters ](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters)are functions that return a value in the model at each time-step. These values can be a constant, based on time (e.g. on the day or month), a calculation based on the time step reservoir storage and many other calculations. In this case, we are interested in a parameter that returns the Area of a reservoir or storage node as a function of its time-step storage. To do this we use an [Interpolated Volume Parameter](https://water-strategy.gitbook.io/water-strategy/modelling-fundamentals/parameters/interpolated-volume).

The interpolated volume parameter uses an **array** (table) of **Reservoir Volumes** and corresponding values. In this case the associated values are the corresponding **Reservoir Area** for a given **Volume**. In between the given points in the table, the parameter interpolates.

***Please note:** Parameters can be defined directly on a node or they can be defined in the Parameters tab in the interface. Parameters that are defined in the Parameters tab in the interface can be used on multiple nodes and nested within different parameters.*

*This tutorial includes both types of definitions. The area will be defined on the node, while the level parameter (next step) will be defined in the Parameters tab.*

## Tutorial <a href="#tutorial" id="tutorial"></a>

1. Clone the **'Demand with treatment losses'** scenario and call the new one **'Adding reservoir P and E'.** The P stands for Precipitation and E stands for Evaporation.
2. Click on the **Reservoir** and edit the **Area** attribute.

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FWB8nsPZVjjJFuF8cq4rU%2Fimage.png?alt=media&#x26;token=25fd87c7-3195-4b4a-bb79-80e774997f48" alt="" width="375"><figcaption><p>Edit the Area attribute</p></figcaption></figure>

3. The Interpolated Volume Parameter does not currently have a JSON editor in WaterStrategy. In order to define this parameter on this attribute, we need to use the generic **PYWR\_PARAMETER**. This allows us to put in the JSON for any Pywr parameter.

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FJWqQwsNi08CZjuljqbeN%2Fimage.png?alt=media&#x26;token=0e75234d-0f16-4070-b93c-c0d834296cbc" alt="" width="375"><figcaption><p>Selecy PYWR_PARAMETER</p></figcaption></figure>

Press **OK**

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FGQmfrskH3kUDTJlT7CJc%2Fimage.png?alt=media&#x26;token=6f2b658e-839f-4730-b7af-abae8b7faf46" alt="" width="315"><figcaption><p>Allow the change</p></figcaption></figure>

\
4\. Copy and Paste the JSON code below into the text in the **JSON tab**

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FPQYKJvj9JAUCoEuUKTKL%2Fimage.png?alt=media&#x26;token=f8d6fcdf-2b4b-4d6a-bc3f-ec8013d23f89" alt=""><figcaption><p>Paste the JSON code and save</p></figcaption></figure>

```
{
	"type": "InterpolatedVolumeParameter",
	"node": "Example reservoir",
	"volumes": [
		0,
		7,
		10,
		15,
		25
	],
	"values": [
		1,
		2,
		4,
		6,
		14
	],
	"interp_kwargs": {
		"kind": "linear"
	},
	"comment": "volumes: Mm3, values:  Km2"
}
```

5. You can select to record the parameter value as a time series by selecting **Timeseries** in the **Outputs** tab. Then, save it.

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FmBHLRq1uGKlE5qOLhq7I%2Fimage.png?alt=media&#x26;token=f69dc615-e38a-4cb2-948d-eaabe92bb699" alt=""><figcaption><p>Select to record the parameter and save</p></figcaption></figure>

6. Run the model and view the **Simulated\_Area** output

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FX5jPTnZxcImRaitoSZCz%2Fimage.png?alt=media&#x26;token=148d4e56-4006-45b1-b02c-dea3619aaf4b" alt=""><figcaption><p>Simulated_Area output</p></figcaption></figure>

This shows the Area of the reservoir over time.

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FjY5IxdgFQRUm5Z3OXs86%2Fimage.png?alt=media&#x26;token=e3d302cb-3ac6-4505-b975-89180113c243" alt=""><figcaption><p>Area of the reservoir</p></figcaption></figure>

Smaller areas correspond with lower reservoir storage volumes.


---

# 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/tutorials/creating-a-reservoir-system/adding-reservoir-details/adding-reservoir-bathymetry-area.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.
