Package: sequent-peak-algorithm
sequent-peak-algorithmPython implementation of the Sequent Peak Algorithm for the design and simulation of water reservoirs in hydrology.Installation with requirementspip install sequent-peak-algorithm==0.0.5Usage example# 0. Create random input dataq_in=np.random.rand(100)*10q_out=np.random.rand(100)*10# 1. Run sequent peak algorithmres_cap=spa.spa(q_in=q_in,q_out=q_out)print("Capacity: ",res_cap.capacity)# 2. Plot results from sequent peak algorithmfig_cap=spa.spa_plot(res_cap)plt.savefig("example_2_spa.png",dpi=300)# 3. Run storage simulation and explore resultsres_sim=spa.sim(q_in=q_in,q_out=q_out,initial_storage=0.0,capacity=res_cap.capacity)# Plot results from storage simulationfig_sim=spa.sim_plot(res_sim)plt.savefig("example_2_sim.png",dpi=300)Sequent Peak Algorithm VisualizationSimulation VisualizationDocumentationspaParametersq_in: list[float]: discharge input valuesq_out: list[float]: discharge output valuesReturnsResult: 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_capacitysimParametersq_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 userReturnsResult: 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 valuesspa_plotParametersResult: collections.namedtuple: Result of the sequent peak algorithmReturnsfig: matplotlib.figure.Figure: Figure object of the plotsim_plotParametersResult: collections.namedtuple: Result of the storage simulationReturnsfig: matplotlib.figure.Figure: Figure object of the plot