diff --git a/README.md b/README.md index 08373e8..9d01a47 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # IHSetDean -Miller and Dean (2004) proposed a simple model for shoreline evolution using several field datasets. The model is developed based on the observation that shoreline positions change as a function of an equilibrium position. The model includes three adjustable parameters that represent the baseline conditions under which shoreline displacement is calculated to minimize the error. This model is very efficient because it only represents the shoreline response to the process and only requires input of readily available storm surge and water level data. +Dean (1991) have proposed the concept of an equilibrium beach profile. Dean (1991) derived the equilibrium beach profile model with the wave energy dissipation similar to other previous works (e.g., Bruun, 1954). The equilibrium beach profile equation is very simple, but has been used by many researchers for coastal engineering. ## Installation and use diff --git a/docs/index.md b/docs/index.md index c6779fc..2c203b6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,27 +6,12 @@ Dean (1991) have proposed the concept of an equilibrium beach profile. Dean (199 ## Model formula -Miller and Dean (2004) suggested a simple shoreline evolution model based on the imbalance of shoreline change between an equilibrium shoreline change and shoreline position as follows: +Dean (1991) suggested an equilibrium beach profile model based on the wave energy dissipation as follows: ```text -(∂S(t))/∂t=k(S_eq (t)-S(t)) +h=Ay^(2/3) -S(t) : the shoreline position at time t -S_eq : the equilibrium shoreline position -k : the calibration parameter for the rate at which the shoreline approaches equilibrium (k; k=k_a H_b^2; k=k_a H_b^3; k=k_a Ω) -``` - -Miller and Dean (2004) proposed an equilibrium shoreline change owing to the change of sea level (Fig. 4 1): - -```text -S_eq=-W^* (t)((0.068H_b+S)/(B+1.28H_b )) - -H_b : the breaking wave height -S : the change in local water level -B : the berm wave height -W^* : the width of the active surf zone -``` - -![Definition sketch of shoreline evolution](_static/images/Imagen1.png) - -Fig. 4 1. Definition sketch of shoreline evolution according the change of water level owing to storm surge and wave setup (Miller and Dean, 2004). \ No newline at end of file +h : the water depth +y : the offshore distance +A : the beach scale factor +``` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d027ec8..46735f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ ] dynamic = ["version", "description"] -dependencies = ["numpy", "pytest >=7", "scipy", "xarray", "matplotlib","pandas"] +dependencies = ["numpy", "pytest >=7", "scipy", "xarray", "matplotlib","pandas", "netCDF4"] [project.optional-dependencies] diff --git a/src/IHSetDean/IHSetDean.py b/src/IHSetDean/IHSetDean.py index 29eca19..f3cb5b1 100644 --- a/src/IHSetDean/IHSetDean.py +++ b/src/IHSetDean/IHSetDean.py @@ -12,7 +12,7 @@ class cal_Dean(object): This class reads input datasets, performs its calibration. """ - def __init__(self, path_prof, path_wav, Switch_Calibrate, Switch_Cal_DoC, **kwargs): + def __init__(self, path_prof, path_wav, Switch_Plot_prof, Switch_Calibrate, Switch_Cal_DoC, **kwargs): self.path_prof = path_prof self.path_wav = path_wav prof = pd.read_csv(path_prof) @@ -20,16 +20,17 @@ def __init__(self, path_prof, path_wav, Switch_Calibrate, Switch_Cal_DoC, **kwar self.MSL = -kwargs['MSL'] self.xm = np.linspace(kwargs['Xm'][0], kwargs['Xm'][1], 1000).reshape(-1, 1) + self.Switch_Plot_prof = Switch_Plot_prof self.Switch_Calibrate = Switch_Calibrate # Calibrate Dean parameter using profile data [0: no without obs (using D50); 1: no with obs (using D50); 2: yes (using Obs)] - if Switch_Calibrate == 1 or Switch_Calibrate == 2: + if Switch_Plot_prof == 1: self.xp = prof.iloc[:, 0] self.zp = prof.iloc[:, 1] self.zp = abs(self.zp) xp_inx = self.xp[(self.zp >= self.MSL)] self.xp = self.xp - min(xp_inx) - if Switch_Calibrate == 2: + if Switch_Calibrate == 1: self.Zmin = kwargs['Zmin'] self.Zmax = kwargs['Zmax'] @@ -43,7 +44,7 @@ def __init__(self, path_prof, path_wav, Switch_Calibrate, Switch_Cal_DoC, **kwar H12,T12 = Hs12Calc(Hs,Tp) self.DoC = depthOfClosure(H12,T12) - # self.DoC = self.DoC[0] + self.DoC = self.DoC[0] def calibrate(self): diff --git a/src/IHSetDean/__pycache__/IHSetDean.cpython-312.pyc b/src/IHSetDean/__pycache__/IHSetDean.cpython-312.pyc index 8ba6741..7900ba7 100644 Binary files a/src/IHSetDean/__pycache__/IHSetDean.cpython-312.pyc and b/src/IHSetDean/__pycache__/IHSetDean.cpython-312.pyc differ diff --git a/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.0.2.pyc b/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.0.2.pyc index 482748a..4092c05 100644 Binary files a/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.0.2.pyc and b/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.0.2.pyc differ diff --git a/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.1.1.pyc b/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.1.1.pyc new file mode 100644 index 0000000..99cd285 Binary files /dev/null and b/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.1.1.pyc differ diff --git a/src/IHSetDean/tests/test_dean.py b/src/IHSetDean/tests/test_dean.py index 527fda7..2b50e4e 100644 --- a/src/IHSetDean/tests/test_dean.py +++ b/src/IHSetDean/tests/test_dean.py @@ -1,9 +1,9 @@ -from IHSetDean import IHSetDean import os import matplotlib.pyplot as plt +from IHSetDean import IHSetDean wrkDir = os.getcwd() -model = IHSetDean.cal_Dean(wrkDir+'/data/prof.csv',wrkDir+'/data/wav.nc', 2, 1, Xm = [0, 500], Zmin = 0.0, Zmax = 1.0, D50 = 0.5, MSL = 0.0) +model = IHSetDean.cal_Dean(wrkDir+'/data/prof.csv',wrkDir+'/data/wav.nc', 1, 1, 1, Xm = [0, 500], Zmin = 0.0, Zmax = 1.0, D50 = 0.5, MSL = 0.0) self = IHSetDean.Dean(model.calibrate()) plt.rcParams.update({'font.family': 'serif'}) @@ -38,10 +38,10 @@ plt.xlim([self.xm[0]-20,xm_DoC_fill[-1]+20]) plt.ylim([self.MSL-1,self.DoC+0.5]) -if self.Switch_Calibrate == 2: +if self.Switch_Calibrate == 1: plt.fill([min(self.xm), min(self.xm), max(self.xm), max(self.xm)], - [self.Zmin, self.Zmax, self.Zmax, self.Zmin], color=[0.5, 0.5, 0.5], alpha=0.25) -if self.Switch_Calibrate == 1 or self.Switch_Calibrate == 2: + [self.Zmin, self.Zmax, self.Zmax, self.Zmin], color=[0.5, 0.5, 0.5], alpha=0.25, label='Calibration') +if self.Switch_Plot_prof == 1: plt.plot(self.xp, self.zp, '--k', linewidth=2, label='Observed profile')[0] plt.plot([min(self.xm), max(self.xm)], [self.MSL, self.MSL], '--b', linewidth=2)[0] @@ -50,5 +50,5 @@ plt.grid(True) plt.gca().invert_yaxis() -plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.1), ncol=2) +plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.1), ncol=3) plt.show()