From cb5eaf19a25e96edc884a4a293e6fe484b5bcc75 Mon Sep 17 00:00:00 2001 From: CB-Lim <129813815+CB-Lim@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:57:53 +0200 Subject: [PATCH] Add files via upload --- README.md | 2 +- docs/index.md | 27 ++++-------------- pyproject.toml | 2 +- src/IHSetDean/IHSetDean.py | 9 +++--- .../__pycache__/IHSetDean.cpython-312.pyc | Bin 6006 -> 6029 bytes .../test_dean.cpython-312-pytest-8.0.2.pyc | Bin 5787 -> 5759 bytes .../test_dean.cpython-312-pytest-8.1.1.pyc | Bin 0 -> 5806 bytes src/IHSetDean/tests/test_dean.py | 12 ++++---- 8 files changed, 19 insertions(+), 33 deletions(-) create mode 100644 src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.1.1.pyc 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 8ba6741e6dc763ceedfd73599783b1cb7e224cd7..7900ba77271fef1f77609189eacd74c255dbf43e 100644 GIT binary patch delta 860 zcmYLG&1(}u6yKTMnS5+ENxS(l{jh0Mp-aWOsRyYPQ7aTtYNSxqmQvWpwzjrTf;4rb zC#44q%0p29gVK}4gMtUWDB?{#l)dOp^x(mWXXkD6@nC;%-|zi?GjC@89orc(J{v|@ zk@5TEP|fp7W@OLN5M^hE7BZTv%%i~% zS9RFUAw>~8ZU72uqQ_Ajb>C4*s{~F{Qt~qt+NM;c_R~n5U!V<4&l-b+$Mr{bsvznBkx9 zQQ7iIc&w#iT+{WC8*;+vUO5U+wUYy~)DOz0xt*)JtFLrG2Q%TF7CEn%N18o1?CN{; zpqiDr8mSs(yVZ@jMzbr&!sY#t7m}B&b;nvvMX4xO1WvJB%G0i`E#E?1*!1XR$)nR7 zRu@!QA#{0ly*$4m){F3-4RgE)(FuRpxEb}d(&B1SB#}xX^ujo|GI$XpA;D88?YyT> z+xZf{Ru=AYFTS5WzO8)?_I}s9pWXhVXKPD=H=O>Ykc<9Eo#@Z?e|MZ;y*sEfH};v zELWeXT`>pg=om_Hup2L)W9*)`!r~H=JqQsA9^G0KgIM{So`Kz@%@$-m2j7zWBm=Kg nHc7*;l+BS9v(TSDM3!JIeIz|iNMifWUj=i0m2wgnd8zpi`l+LY delta 866 zcmY*X&ubGw6yBNH*(TX+x^h{j@@q#{<-X!TI6Afd&A4b;M>rD>~m6QwO1 z3LeCRJ;+l~{{!ivlz7mao;@ft(;DGCBaKk|*l;Zrn2I)Rv(1hV!N oLKYz{;E(V8(p~HRV)3Fq2YK_DIZjCU@q;}H*WD6Th+a?r3k64{LI3~& 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 482748a491ae6d78f7a0ec08b996e315e128a5bb..4092c05685fac738a087f5111d8eb2315b9a01d7 100644 GIT binary patch delta 1369 zcmbtUO-vI(6yDjNZl~RCyU+sL3Z?x2lwTDRA)v;CKM{$Z>;ZwirJN{2Sact3zmMLXf)ye8|b6q8w^`tz&0hyIAdsCEfJZE?^VO&?Dr&E4I$;9lK;$`@O zpJytz3-%5oNGydX&4UbHpded5le#gf0Lu|y{xCo&hDfXC2W6U=#5EGmaJ4D~_G{xo z2o-8Ufe>g=_C!d94K34#+uks46Td(+NgU-{a6za{l&3ieuM$>L#HuhoE)H-yJ2<`3 zwGmz=QYBEU3de|lu6ou>J{(jD(1<{iO@ zV)&wDd&7Z!9!a-^LYdE*-$5@z(j9JdxM>leixt>SD@iq4V$6}zuCxd>AX;%#bQ8P1 zWsVoZxMv3hm&ItX)~PUIgrN@Vta>~mC4$mS3&-8#vtFm0T^iLQ8u5i>vge!hJcu~F zm4GI3TpliO0L^MFw&0k2>{641+MGwtKS{3Ozp+#AGH&Gd96NhA)>q#4|LoXlZFb@% z?3C15Iu-e9{xKB-n+n{Ks(7FXv{@Bxy0eQ8*}Ztw-;eLNcz0l-!psoN65MFX_p`i72ve`y&G#M%d~!c{eskf6BcTO6c0} zhuum<>n<7nG5e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#Fd}97Pu^0YdHkXc;KCF6B^;ykbW0tNSH9w=P zGjw(0xV*nPQ`0_8l1a;qX&+?2Y%MfK_H&Pd5Yr`VZm|aJ{ zo~o6t_C?~rdh(6bPh{(%MWP{FT9qxW%mHIQ`KUHx;K(9_STiVRhes9m6HvhLLAr9+k~(z*n2W#Tcqu4SYsk& zwWi4AiBw1OR0^b zMP;V_u}!{w1-aa(Th@{{=8jk9)y^l+qz&_W`HE8x++Lz1%arL25?)a~?u~mBV8Wa9 z=Df)4Ihv_x9xcvp!di8x<{4wlFt!Eez*JfK`hw%+S1t1&Eu4NwuJ6h)U0G(=rhK`t zUj|+jB)>Mu@tSxI^k^tKly05xSfbBqxwWq0*^`)52HhAM5{Y`r7ozE}6N6B6P$Z ziN1+z$!lr-m*y$+Z0ng)d-Rb%Fp0JCAs!Q}P z6Gc$B=w6Xryg%KyL^NkL!mgCGL^Ld8>!a3BOR|Isikt44J~2NdDl$aHB2l@jF?uKM So4>V0bgVk`iy{#{asLC7JFkiW literal 0 HcmV?d00001 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()