-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHsHvFinder.py
More file actions
39 lines (32 loc) · 1.36 KB
/
Copy pathHsHvFinder.py
File metadata and controls
39 lines (32 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from .uniqueFinder import uniqueFinder
from .velocityProfile import velocityProfile
from .Rxx import Rxx
from .Rxy import Rxy
from .calcUstar import calcUstar
from .outlierRemove import outlierRemove
from .GuoProfileFunction import GuoProfileFunction
from matplotlib.ticker import LogLocator, LogFormatter
import matplotlib.ticker as ticker
import pickle
def HsHvFinder(dataPickle, positionList, plotTitle):
'''
This function is to find the position of water depth at which the shear stress is zero, Hs, and at which the velocity is maximum, Hv.
INPUT : dataPickle - the pickle of different datasets
'''
dataPickle = dataPickle
positionList = positionList
plotTitle = plotTitle
with open(dataPickle, 'rb') as f:
dataList = pickle.load(f)
file = open(plotTitle, 'w') ## Create a file to store results
file.write("Position\tHs[cm]\tHv[cm]\n")
for i, data in reversed(list(enumerate(dataList))):
print('----Program Executing--',i,'---')
Ustar, hs = calcUstar(data, Hs=True) # function calling to get the shear velocity and hs
VelocityOutput = velocityProfile(data)
hv = VelocityOutput[0].reset_index()['depth[cm]'][np.argmax(VelocityOutput[0].reset_index()['U'])]
file.write(f"{positionList[i]}\t{hs}\t{hv}\n")
file.close()