Sequent Peak Algorithm for the design and simulation of water reservoirs
Project description
sequent-peak-algorithm
Python implementation of the Sequent Peak Algorithm for the design and simulation of water reservoirs in hydrology.
Installation with requirements
pip install sequent-peak-algorithm==0.0.5
Usage example
# 0. Create random input data
q_in = np.random.rand(100) * 10
q_out = np.random.rand(100) * 10
# 1. Run sequent peak algorithm
res_cap = spa.spa(q_in=q_in, q_out=q_out)
print("Capacity: ", res_cap.capacity)
# 2. Plot results from sequent peak algorithm
fig_cap = spa.spa_plot(res_cap)
plt.savefig("example_2_spa.png", dpi=300)
# 3. Run storage simulation and explore results
res_sim = spa.sim(
q_in=q_in,
q_out=q_out,
initial_storage=0.0,
capacity=res_cap.capacity
)
# Plot results from storage simulation
fig_sim = spa.sim_plot(res_sim)
plt.savefig("example_2_sim.png", dpi=300)
Sequent Peak Algorithm Visualization
Simulation Visualization
Documentation
spa
Parameters
q_in: list[float]: discharge input valuesq_out: list[float]: discharge output values
Returns
Result: collections.namedtuple: Result of the sequent peak algorithm with the following attributes:q_in: list[float]: discharge input valuesq_out: list[float]: discharge output valuesstorage: list[float]: storage values, calculated with_storagecumulative_storage: list[float]: cumulative storage values, calculated with_cumulative_storagemax_vals: list[float]: discharge values of the maxima, calculated with_maximamax_indices: list[int]: indices of the maxima, calculated with_maximamin_vals: list[float]: discharge values of the minima, calculated with_minimamin_indices: list[int]: indices of the minima, calculated with_minimacapacity: list[float]: capacity, calculated with_capacitycapacity_indices: list[int]: indices of the capacity (multiple positions possible), calculated with_capacitycapacity_max_vals: list[float]: preceeding maxima of the capacity, calculated with_capacitycapacity_max_indices: list[int]: indices of the preceeding maxima of the capacity, calculated with_capacitycapacity_min_vals: list[float]: succeeding minima of the capacity, calculated with_capacitycapacity_min_indices: list[int]: indices of the succeeding minima of the capacity, calculated with_capacity
sim
Parameters
q_in: list[float]: discharge input valuesq_out: list[float]: discharge output valuesinitial_storage: float: initial storage value, chosen by the usercapacity: float: capacity values, calculated withspaor chosen by the user
Returns
Result: collections.namedtuple: Result of the sequent peak algorithm with the following attributes:q_in: list[float]: discharge input valuesq_out: list[float]: discharge output valuesinitial_storage: float: initial storage value, chosen by the usercapacity: list[float]: capacity values, calculated withspaor chosen by the userq_out_real: list[float]: real discharge output accounting for the capacity (deficit and overflow situations)storage: list[float]: storage valuesdeficit: list[float]: deficit valuesoverflow: list[float]: overflow values
spa_plot
Parameters
Result: collections.namedtuple: Result of the sequent peak algorithm
Returns
fig: matplotlib.figure.Figure: Figure object of the plot
sim_plot
Parameters
Result: collections.namedtuple: Result of the storage simulation
Returns
fig: matplotlib.figure.Figure: Figure object of the plot
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sequent_peak_algorithm-0.0.5.tar.gz.
File metadata
- Download URL: sequent_peak_algorithm-0.0.5.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfa39f0e5154b82f22d5eaa416cff2ed73233c0994ccb8378e9820fc6a8d0f64
|
|
| MD5 |
d6f379c0eafa3fd7b73fb8e76ad880e6
|
|
| BLAKE2b-256 |
5a9b601310a156e948eaa2c43666e8215c9de48cc43f81bc0674aeba0e52f066
|
File details
Details for the file sequent_peak_algorithm-0.0.5-py3-none-any.whl.
File metadata
- Download URL: sequent_peak_algorithm-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85e14493440e7dafde91bc88f2d250869d0d5a0ff64813a5704b3984de016845
|
|
| MD5 |
9e23605e5fbc5495ab6894d42270ab0e
|
|
| BLAKE2b-256 |
f84b537d556cc06df09cc157222a7cf94d6b3f76f066c48e02bc0a7c9ac2672b
|