You are on page 1of 12

Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

Question 1
A Unit Hydrograph is a hydrological model that represents the relationship between rainfall
input and resulting runoff output from a drainage basin or watershed. It is a simplified
representation of the hydrological response of a catchment to a unit of rainfall over a specific
duration.

Unit Hydrograph use cases: 1.Flood prediction. 2.Watershed management. 3.Reservoir design.
4.Stormwater management. 5.Environmental impact assessment.

Question 4

1 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

In [1]: import matplotlib.pyplot as plt


import scienceplots
import numpy as np
# Example data
time = [0,6, 12, 18, 24,30,36,42,48] # Time in hours
flow = [14, 75, 185, 140.3, 120.7, 48.8, 32.2, 24.4, 14]# Flow values in cubic meters per sec
base_flow = 12
c_area = 6000000
ordinates = []
drh = []
uh = []
for i in range(1, len(time)+1):
delta_t = 6
runoff = (flow[i-1]-base_flow)
drh.append(runoff)
sum_drh = sum(drh)
erd=(sum_drh*6*60*60*100)/c_area
unit_value = ((drh[i-1])/(erd))
uh.append(unit_value)
print('The Hydrograph values are: \n',flow,'\n The Direct Runoff Hydrograph are: \n

with plt.style.context(['science']):
plt.figure( figsize=(5,5) )
plt.plot(time, flow, marker='o')
plt.xlabel('Time (hours)')
plt.ylabel('Flood (m3/s)')
plt.title('Flood Discharge Hydrograph')
plt.show()

with plt.style.context(['science']):
plt.figure( figsize=(5,5) )
plt.plot(time, drh, marker='o')
plt.xlabel('Time (hours)')
plt.ylabel('DRH (m3/s)')
plt.title('Direct Runoff Hydrograph')
plt.show()

with plt.style.context(['science']):
plt.figure( figsize=(5,5) )
plt.plot(time, uh, marker='o')
plt.xlabel('Time (hours)')
plt.ylabel('UH (m3/s)')
plt.title('Unit Hydrograph')
plt.show()

2 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

The Hydrograph values are:


[14, 75, 185, 140.3, 120.7, 48.8, 32.2, 24.4, 14]
The Direct Runoff Hydrograph are:
[2, 63, 173, 128.3, 108.7, 36.8, 20.200000000000003, 12.399999999999999, 2]
The value of the total runoff:
546.4
The values for the Unit Hydrograph :
[2.7777777777777777, 2.6923076923076925, 2.019140989729225, 0.9729426396093064, 0.
6356725146198831, 0.1997307976205983, 0.10547201336675022, 0.06327047105886195, 0.0
10167561412070932]
The ERD:
196.70399999999995

3 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

4 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

Question 5

5 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

In [5]: import matplotlib.pyplot as plt


import os
os.getcwd()

# Prepare the data


time = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]
drh_ordinates = [0, 15.2, 75.3, 121.3, 108.5, 88.5, 50.8, 26.1, 13.2, 0]

fig, ax = plt.subplots()
ax.annotate(
os.getcwd().replace('\\', '/'),
xy=(1.0, -0.2),
xycoords='axes fraction',
ha='right',
va='center',
fontsize=5)
# Plot the DRH
plt.plot(time, drh_ordinates)
plt.xlabel('Time (hours)')
plt.ylabel('Discharge (m^3/s)')
plt.title('Direct Runoff Hydrograph (DRH)')
plt.show()

# Derive the 5-hour UH ordinates


total_eff_rainfall = sum(drh_ordinates)
uh_ordinates = [ordinate / total_eff_rainfall for ordinate in drh_ordinates]

fig, ax = plt.subplots()
ax.annotate(
os.getcwd().replace('\\', '/'),
xy=(1.0, -0.2),
xycoords='axes fraction',
ha='right',
va='center',
fontsize=5)
# Plot the UH
plt.plot(time, uh_ordinates)
plt.xlabel('Time (hours)')
plt.ylabel('Normalized Discharge (m^3/s)')
plt.title('Unit Hydrograph (UH)')
plt.show()

# Determine the highest discharge and time to peak for DRH


drh_highest_discharge = max(drh_ordinates)
drh_time_to_peak = time[drh_ordinates.index(drh_highest_discharge)]

# Determine the highest discharge and time to peak for UH


uh_highest_discharge = max(uh_ordinates)
uh_time_to_peak = time[uh_ordinates.index(uh_highest_discharge)]

# Calculate the catchment area (A)


catchment_area = (drh_highest_discharge * drh_time_to_peak) / uh_highest_discharge

print("DRH Highest Discharge:", drh_highest_discharge, "m^3/s")


print("DRH Time to Peak:", drh_time_to_peak, "hours")
print("UH Highest Discharge:", uh_highest_discharge, "m^3/s")
print("UH Time to Peak:", uh_time_to_peak, "hours")
print("Catchment Area:" catchment_area "square meters")

6 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

print("Catchment Area:", catchment_area, "square meters")

7 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

DRH Highest Discharge: 121.3 m^3/s


DRH Time to Peak: 15 hours
UH Highest Discharge: 0.24313489677290037 m^3/s
UH Time to Peak: 15 hours
Catchment Area: 7483.5 square meters

In [ ]:

Question 6

8 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

In [23]: import matplotlib.pyplot as plt

def derive_unit_hydrograph(flood_hydrograph, baseflow, catchment_area):


# Calculate the peak discharge
peak_discharge = max(flood_hydrograph) - baseflow

# Normalize the flood hydrograph by dividing by the peak discharge


normalized_hydrograph = [q / peak_discharge for q in flood_hydrograph]

# Calculate the time interval


time_interval = 1 # Assuming the data is given in hourly intervals

# Calculate the unit hydrograph ordinates


unit_hydrograph = [q * time_interval * catchment_area for q in normalized_hydrograph

return unit_hydrograph

# Test the function using the data from Question 2


flood_hydrograph = [10, 28, 93.5, 119, 100, 85, 69.4, 55, 44, 37, 27, 25, 17, 16, 14
baseflow = 10
catchment_area = 318

unit_hydrograph = derive_unit_hydrograph(flood_hydrograph, baseflow, catchment_area


# Add a footnote
fig, ax = plt.subplots()
ax.annotate(os.getcwd().replace("\\", "/"), xy=(1.0, -0.3), xycoords='axes fraction'

# Plot the unit hydrograph


plt.plot(unit_hydrograph)
plt.xlabel('Time (hours)')
plt.ylabel('Unit Hydrograph Ordinates')
plt.title('Unit Hydrograph')
plt.show()

9 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

In [ ]:

In [ ]:

In [26]: import numpy as np

g = np.array([0.25, 0.75, 0.30])


h = np.array([3.2, 5.1, 8, 4.1])

f = np.convolve(g, h)

print(f)

[0.8 3.675 6.785 8.555 5.475 1.23 ]

In [ ]:

Question 9

Case 1

10 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

In [27]: import numpy as np


import matplotlib.pyplot as plt

def linear_reservoir_model(p, T, Tp, duration, timestep):


t = np.arange(0, duration, timestep)
q = (p / T) * (1 - np.exp(-t / T))
return t, q

p6 = 1 # Effective precipitation rate in Case I


T6 = 1 # Time constant in Case I
Tp = 4.5 # Input duration in Case I
duration = 30 # Duration of calculation
timestep = 0.5 # Time-step of calculation (30 minutes)

t, q = linear_reservoir_model(p6, T6, Tp, duration, timestep)

# Plotting the results


plt.plot(t, q)
plt.xlabel('Time (hours)')
plt.ylabel('Discharge (units)')
plt.title('Case I: Linear Reservoir Model')
plt.grid(True)
plt.show()

Case 2

11 of 12 9/24/2023, 12:07 PM
Untitled http://localhost:8888/nbconvert/html/Desktop/Hydrology/Unit%20Hydr...

In [28]: p6 = 1 # Effective precipitation rate in Case II


T6 = 6 # Time constant in Case II
Tp = 6.5 # Input duration in Case II

t, q = linear_reservoir_model(p6, T6, Tp, duration, timestep)

# Plotting the results


plt.plot(t, q)
plt.xlabel('Time (hours)')
plt.ylabel('Discharge (units)')
plt.title('Case II: Linear Reservoir Model')
plt.grid(True)
plt.show()

12 of 12 9/24/2023, 12:07 PM

You might also like