A reservoir is a natural or artificial lake, storage pond, or impoundment from a dam which is used to store water. Reservoirs may result from an avalanche, ice formation or a landslide (natural reservoir) or may be created in river valleys by the construction of a dam or may be built by excavation in the ground or by conventional construction techniques such as brickwork or cast concrete (artificial reservoir). Natural reservoirs often see fractures arising after a certain amount of time, caused by a great accumulation of water. Geological research has evidenced that since the last ice age several major floods were caused by this phenomenon. The major reason for constructing a reservoir usually is to generate green energy, where the great decline that is created in this way is used to drive a water turbine that powers an electric generator. In other cases, a reservoir is made as a regulator and a supply for irrigation or drinking water.

Karibastuwdam
Lake Kariba is the world's largest artificial lake and reservoir by volume. It lies 1300 kilometers upstream from the Indian Ocean, along the border between Zambia and Zimbabwe. Lake Kariba was filled between 1958 and 1963 following the completion of the Kariba Dam at its northeastern end, flooding the Kariba Gorge on the Zambezi River. Lake Kariba is over 223 kilometers long and up to 40 kilometers in width. It covers an area of 5580 square kilometers and its storage capacity is an immense 185 cubic kilometers.

Assignment

If geologists investigate a site for the construction of a new reservoir, they first draw a two-dimensional profile of the elevations and depressions in the landscape. Based on such a profile, they can compute the storage capacity of the reservoir. If the soil on the site primarily consists of coarser materials (e.g. sand and gravel) they must also take into account the some amount of water will penetrate into the soil.

Define a class Reservoir that can be used to investigate the storage capacity of a reservoir based on a given two-dimensional profile of the landscape. The objects of this class must at least support the following methods:

Example

>>> profile = [4, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 5, 6, 5, 2, 2, 2, 3, 3, 3, 4, 5, 3, 2, 2]
>>> lake = Reservoir(profile)
>>> print(lake)
                 #            
                ###       #   
#               ###      ##   
##              ###   ######  
####           ###############
######       #################
>>> lake.fill()
63
>>> print(lake)
                 #            
                ###~~~~~~~#   
#~~~~~~~~~~~~~~~###~~~~~~##   
##~~~~~~~~~~~~~~###~~~######  
####~~~~~~~~~~~###############
######~~~~~~~#################
>>> lake.drain()
63
>>> print(lake)
                 #            
                ###       #   
#               ###      ##   
##              ###   ######  
####           ###############
######       #################
>>> lake.fill()
63
>>> print(lake)
                 #            
                ###~~~~~~~#   
#~~~~~~~~~~~~~~~###~~~~~~##   
##~~~~~~~~~~~~~~###~~~######  
####~~~~~~~~~~~###############
######~~~~~~~#################
>>> lake.penetrate()
47
>>> print(lake)
                 #            
                ###~~~~~~~#   
#               ###~~~~~~##   
##              ###~~~######  
####           ###############
######       #################
>>> lake.fill()
47
>>> print(lake)
                 #            
                ###~~~~~~~#   
#~~~~~~~~~~~~~~~###~~~~~~##   
##~~~~~~~~~~~~~~###~~~######  
####~~~~~~~~~~~###############
######~~~~~~~#################
>>> lake.drain()
63
>>> print(lake)
                 #            
                ###       #   
#               ###      ##   
##              ###   ######  
####           ###############
######       #################