diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e5e69..b757a64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -# 2024.02.23 - -- Features: Implements Dean article +# 2024.02.23 + +- Features: Implements Dean article diff --git a/README.md b/README.md index 2b0b645..08373e8 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# IHSetDean - -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 - -To install this module use: - -```sh -pip install https://github.com/IHCantabria/IHSetDean/archive/refs/tags/latest.zip -``` - -Run tests to validate: - -```sh -ihsetdean-tests -``` - -## Documentation - -Documentation is available at https://ihcantabria.github.io/IHSetDean - -## Credits - -Developed and maintained by Lim, Changbin @ IHCantabria. +# 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. + + +## Installation and use + +To install this module use: + +```sh +pip install https://github.com/IHCantabria/IHSetDean/archive/refs/tags/latest.zip +``` + +Run tests to validate: + +```sh +ihsetdean-tests +``` + +## Documentation + +Documentation is available at https://ihcantabria.github.io/IHSetDean + +## Credits + +Developed and maintained by Lim, Changbin @ IHCantabria. diff --git a/data/config.nc b/data/config.nc new file mode 100644 index 0000000..bf2e85e Binary files /dev/null and b/data/config.nc differ diff --git a/data/ens.nc b/data/ens.nc new file mode 100644 index 0000000..fefab66 Binary files /dev/null and b/data/ens.nc differ diff --git a/data/wav.nc b/data/wav.nc new file mode 100644 index 0000000..fefab66 Binary files /dev/null and b/data/wav.nc differ diff --git a/docs/Makefile b/docs/Makefile index 41c270b..1a37590 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,20 +1,20 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 890680f..251d597 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,52 +1,52 @@ -# Configuration file for the Sphinx documentation builder. -# -# For the full list of built-in configuration values, see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Project information ----------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -from IHSetDean.__init__ import __version__ - - -project = "IHSetDean" -copyright = "2024, Lim, Changbin" -author = "Lim, Changbin" -version = release = __version__ - -html_context = { - "display_github": True, # Integrate GitHub - "github_user": "ihcantabria", # Username - "github_repo": "IHSetDean", # Repo name - "github_version": "main", # Version - "conf_py_path": "/docs/", -} - -# -- General configuration --------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration - -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.napoleon", - "sphinx_rtd_theme", - "myst_nb", - # 'sphinxcontrib.autodoc_pydantic', - "sphinx.ext.autosummary", -] -templates_path = ["_templates"] -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - - -# -- Options for HTML output ------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output - -html_theme = "sphinx_rtd_theme" -html_theme_options = { - "display_version": True, - "style_external_links": False, -} -# html_theme = 'furo' -# html_theme = 'sphinx_book_theme' - -html_static_path = ["_static"] -html_logo = "" -html_title = " v" + release +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +from IHSetDean.__init__ import __version__ + + +project = "IHSetDean" +copyright = "2024, Lim, Changbin" +author = "Lim, Changbin" +version = release = __version__ + +html_context = { + "display_github": True, # Integrate GitHub + "github_user": "ihcantabria", # Username + "github_repo": "IHSetDean", # Repo name + "github_version": "main", # Version + "conf_py_path": "/docs/", +} + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx_rtd_theme", + "myst_nb", + # 'sphinxcontrib.autodoc_pydantic', + "sphinx.ext.autosummary", +] +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +html_theme_options = { + "display_version": True, + "style_external_links": False, +} +# html_theme = 'furo' +# html_theme = 'sphinx_book_theme' + +html_static_path = ["_static"] +html_logo = "" +html_title = " v" + release diff --git a/docs/index.md b/docs/index.md index d91aad5..c6779fc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,21 +1,32 @@ -# IHSetDean - -## Summary - -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. - -## Model formula - -Dean (1991) suggested a simple equilibrium beach profile equation based on the wave energy dissipation as follows: - -```text -h=Ay^(2/3) - -h : the water depth -y : the seaward distance -A : the Dean parameter -``` - -![Definition sketch of equilibrium beach profile model](_static/images/Imagen1.png) - -Fig. Definition sketch of equilibrium beach profile model (Dean, 1991). +# IHSetDean + +## Summary + +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. + +## 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: + +```text +(∂S(t))/∂t=k(S_eq (t)-S(t)) + +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 diff --git a/docs/make.bat b/docs/make.bat index b4f380c..8f6d24c 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,35 +1,35 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.https://www.sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "" goto help - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end popd \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 1ea4c1e..682d20a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,49 +1,49 @@ -[build-system] -requires = ["flit_core >=3.2,<4"] -build-backend = "flit_core.buildapi" - - -[project] -name = "IHSetDean" -authors = [{ name = "Lim, Changbin", email = "changbin.lim@unican.es" }] -maintainers = [{ name = "Lim, Changbin", email = "changbin.lim@unican.es" }] -readme = "README.md" -requires-python = ">=3.9" -classifiers = [ - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Physics", - "Development Status :: 1 - Planning", - "Programming Language :: Python", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", -] -dynamic = ["version", "description"] - -dependencies = ["numpy", "pytest >=7", "scipy"] - - -[project.optional-dependencies] -dev = ["flit", "black", "sphinx", "myst-nb", "sphinx_rtd_theme", "pre-commit"] - - -[project.urls] -documentation = "https://ihcantabria.github.io/IHSetDean/" -repository = "https://github.com/IHCantabria/IHSetDean" -changelog = "https://github.com/IHCantabria/IHSetDean/blob/main/CHANGELOG.md" - - -[project.scripts] -ihsetdean-tests = "IHSetDean.tests.__init__:run_tests" - - -[tool.pytest.ini_options] -addopts = "--durations=0 --durations-min=0.1" -testpaths = "src/tests" -markers = [ - "slow: marks tests as slow (deselect with '-m \"not slow\"')", - "serial", -] +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + + +[project] +name = "IHSetDean" +authors = [{ name = "Lim, Changbin", email = "changbin.lim@unican.es" }] +maintainers = [{ name = "Lim, Changbin", email = "changbin.lim@unican.es" }] +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "Development Status :: 1 - Planning", + "Programming Language :: Python", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +dynamic = ["version", "description"] + +dependencies = ["numpy", "pytest >=7", "scipy", "xarray"] + + +[project.optional-dependencies] +dev = ["flit", "black", "sphinx", "myst-nb", "sphinx_rtd_theme", "pre-commit"] + + +[project.urls] +documentation = "https://ihcantabria.github.io/IHSetDean/" +repository = "https://github.com/IHCantabria/IHSetDean" +changelog = "https://github.com/IHCantabria/IHSetDean/blob/main/CHANGELOG.md" + + +[project.scripts] +ihsetdean-tests = "IHSetDean.tests.__init__:run_tests" + + +[tool.pytest.ini_options] +addopts = "--durations=0 --durations-min=0.1" +testpaths = "src/tests" +markers = [ + "slow: marks tests as slow (deselect with '-m \"not slow\"')", + "serial", +] diff --git a/src/IHSetDean/IHSetDean.py b/src/IHSetDean/IHSetDean.py index bb681b5..a98c457 100644 --- a/src/IHSetDean/IHSetDean.py +++ b/src/IHSetDean/IHSetDean.py @@ -1,62 +1,74 @@ -import numpy as np -from scipy.interpolate import interp1d - - -def caida_grano(D50): - ws = np.nan - if D50 < 0.1: - ws = 1.1e6 * (D50 * 0.001) ** 2 - elif 0.1 <= D50 <= 1: - ws = 273 * (D50 * 0.001) ** 1.1 - elif D50 > 1: - ws = 4.36 * D50**0.5 - return ws - - -def RMSEq(Y, Y2t): - return np.sqrt(np.mean((Y - Y2t) ** 2, axis=0)) - - -def Dean(dp, zp, D50): - z = zp - zp[0] - d = dp - dp[0] - - # Profile with equidistant points - dp = np.linspace(0, dp[-1], 500).reshape(-1, 1) # 500 points - interp_func = interp1d(d, z, kind="linear", fill_value="extrapolate") - zp = interp_func(dp) - zp = zp[1:] - dp = dp[1:] - - ws = None - if D50 is not None: - ws = caida_grano(D50) - - Y = np.log(-zp) - Y2 = 2 / 3 * np.log(dp) - - fc = np.arange(-20, 20, 0.001) - Y2_grid, fc_grid = np.meshgrid(Y2, fc, indexing="ij") - Y2t = fc_grid + Y2_grid - - out = RMSEq(Y, Y2t) - I = np.argmin(out) - - A = np.exp(fc[I]) - kk = np.exp(fc[I] - np.log(ws**0.44)) if ws is not None else None - - hm = -A * dp ** (2 / 3) - err = RMSEq(zp, hm) - - Para = {"model": "Dean"} - Para["formulation"] = ["h= Ax.^(2/3)", "A=k ws^0.44"] - Para["name_coeffs"] = ["A", "k"] - Para["coeffs"] = [A, kk] - Para["RMSE"] = err - - model = { - "D": np.array([0] + list(dp.flatten())), - "Z": np.array([0] + list(hm.flatten())), - } - - return Para, model +import numpy as np +from scipy.interpolate import interp1d +import xarray as xr + +class cal_Dean(object): + """ + cal_Dean + + Configuration to calibrate and run the Dean profile. + + This class reads input datasets, performs its calibration. + """ + def __init__(self, path): + self.path = path + + cfg = xr.open_dataset(path+'config.nc') + ens = xr.open_dataset(path+'ens.nc') + + self.Ymin = cfg['Ymin'].values + self.Ymax = cfg['Ymax'].values + self.dY = cfg['dy'].values + self.D50 = ens['D50'].values + self.dp = ens['d'].values + self.zp = ens['z'].values + + def calibrate(self): + self.zp = self.zp - self.zp[0] + self.d = self.dp - self.dp[0] + + # Profile with equidistant points + dp = np.linspace(0, self.dp[-1], 500).reshape(-1, 1) + interp_func = interp1d(self.d, self.zp, kind="linear", fill_value="extrapolate") + zp = interp_func(dp) + zp = zp[1:] + dp = dp[1:] + + ws = None + if self.D50 is not None: + ws = caida_grano(self.D50) + + Y = np.log(-zp) + Y2 = 2 / 3 * np.log(dp) + + fc = np.arange(self.Ymin, self.Ymax, self.dY) + Y2_grid, fc_grid = np.meshgrid(Y2, fc, indexing="ij") + Y2t = fc_grid + Y2_grid + + out = RMSEq(Y, Y2t) + I = np.argmin(out) + + self.A = np.exp(fc[I]) + self.kk = np.exp(fc[I] - np.log(ws**0.44)) if ws is not None else None + self.dp_value = dp + + return self + +def caida_grano(D50): + ws = np.nan + if D50 < 0.1: + ws = 1.1e6 * (D50 * 0.001) ** 2 + elif 0.1 <= D50 <= 1: + ws = 273 * (D50 * 0.001) ** 1.1 + elif D50 > 1: + ws = 4.36 * D50**0.5 + return ws + +def RMSEq(Y, Y2t): + return np.sqrt(np.mean((Y - Y2t) ** 2, axis=0)) + +def Dean(self): + + self.hm = -self.A * self.dp ** (2 / 3) + + return self diff --git a/src/IHSetDean/__init__.py b/src/IHSetDean/__init__.py index 8407dfe..cf64942 100644 --- a/src/IHSetDean/__init__.py +++ b/src/IHSetDean/__init__.py @@ -1,3 +1,3 @@ -""" Template """ - -__version__ = "0.1.0" +""" Template """ + +__version__ = "0.1.0" diff --git a/src/IHSetDean/__pycache__/IHSetDean.cpython-311.pyc b/src/IHSetDean/__pycache__/IHSetDean.cpython-311.pyc new file mode 100644 index 0000000..f93d4df Binary files /dev/null and b/src/IHSetDean/__pycache__/IHSetDean.cpython-311.pyc differ diff --git a/src/IHSetDean/__pycache__/IHSetDean.cpython-312.pyc b/src/IHSetDean/__pycache__/IHSetDean.cpython-312.pyc new file mode 100644 index 0000000..2673c4c Binary files /dev/null and b/src/IHSetDean/__pycache__/IHSetDean.cpython-312.pyc differ diff --git a/src/IHSetDean/__pycache__/__init__.cpython-311.pyc b/src/IHSetDean/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..31e637b Binary files /dev/null and b/src/IHSetDean/__pycache__/__init__.cpython-311.pyc differ diff --git a/src/IHSetDean/__pycache__/__init__.cpython-312.pyc b/src/IHSetDean/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..8fea056 Binary files /dev/null and b/src/IHSetDean/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/IHSetDean/tests/__init__.py b/src/IHSetDean/tests/__init__.py index 98350d2..57f8e87 100644 --- a/src/IHSetDean/tests/__init__.py +++ b/src/IHSetDean/tests/__init__.py @@ -1,11 +1,11 @@ -"""Testing subpackage""" - -from pathlib import Path -import pytest - - -def run_tests(): - """run all available tests""" - tests_path = Path(__file__).parent - print(f"Running tests from path: {tests_path}") - pytest.main(["-v", "-m", "not slow", "-p" "no:warnings", tests_path]) +"""Testing subpackage""" + +from pathlib import Path +import pytest + + +def run_tests(): + """run all available tests""" + tests_path = Path(__file__).parent + print(f"Running tests from path: {tests_path}") + pytest.main(["-v", "-m", "not slow", "-p" "no:warnings", tests_path]) diff --git a/src/IHSetDean/tests/__pycache__/__init__.cpython-311.pyc b/src/IHSetDean/tests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..a4292db Binary files /dev/null and b/src/IHSetDean/tests/__pycache__/__init__.cpython-311.pyc differ diff --git a/src/IHSetDean/tests/__pycache__/__init__.cpython-312.pyc b/src/IHSetDean/tests/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..c881edb Binary files /dev/null and b/src/IHSetDean/tests/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/IHSetDean/tests/__pycache__/test_dean ori.cpython-312-pytest-8.0.2.pyc b/src/IHSetDean/tests/__pycache__/test_dean ori.cpython-312-pytest-8.0.2.pyc new file mode 100644 index 0000000..41572dd Binary files /dev/null and b/src/IHSetDean/tests/__pycache__/test_dean ori.cpython-312-pytest-8.0.2.pyc differ diff --git a/src/IHSetDean/tests/__pycache__/test_dean.cpython-311-pytest-7.3.1.pyc b/src/IHSetDean/tests/__pycache__/test_dean.cpython-311-pytest-7.3.1.pyc new file mode 100644 index 0000000..07f1420 Binary files /dev/null and b/src/IHSetDean/tests/__pycache__/test_dean.cpython-311-pytest-7.3.1.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 new file mode 100644 index 0000000..61be80a Binary files /dev/null and b/src/IHSetDean/tests/__pycache__/test_dean.cpython-312-pytest-8.0.2.pyc differ diff --git a/src/IHSetDean/tests/test_dean.py b/src/IHSetDean/tests/test_dean.py index dc96f77..725a0eb 100644 --- a/src/IHSetDean/tests/test_dean.py +++ b/src/IHSetDean/tests/test_dean.py @@ -1,24 +1,26 @@ -from scipy import io -import numpy as np -from IHSetDean import IHSetDean -from scipy.interpolate import interp1d - - -def test_Dean(): - - perfil = io.loadmat("./data/perfiles_cierre.mat") - p = 0 - d = perfil["perfil"]["d"][0][p].flatten() - d = d - d[0] - z = perfil["perfil"]["z"][0][p].flatten() - CM = perfil["perfil"]["CM_95"][0][p].flatten() - z = z - CM - di = np.linspace(d[0], d[-1], 100) - z = interp1d(d, z, kind="linear", fill_value="extrapolate")(di) - d = di - - D50 = perfil["perfil"]["D50"][0][p].flatten() - - # Assuming the 'ajuste_perfil' function is defined as in the previous code - pDeank, mDeank = IHSetDean.Dean(d, z, D50) - assert pDeank["RMSE"][0] == 0.4840710371023019 +from IHSetDean import IHSetDean +import xarray as xr +import os +import matplotlib.pyplot as plt + +config = xr.Dataset(coords={'dy': 0.001, # Calibrate + 'Ymin': -20, # Calibrate the minimum value + 'Ymax': 20, # Calibrate the maximum value + }) + +wrkDir = os.getcwd() +config.to_netcdf(wrkDir+'/data/config.nc', engine='netcdf4') +model = IHSetDean.cal_Dean(wrkDir+'/data/') +self = IHSetDean.Dean(model.calibrate()) + +plt.rcParams.update({'font.family': 'serif'}) +plt.rcParams.update({'font.size': 7}) +plt.rcParams.update({'font.weight': 'bold'}) +font = {'family': 'serif', + 'weight': 'bold', + 'size': 8} + +hk = [] +hk.append(plt.plot(self.dp, self.zp, '--k')[0]) +hk.append(plt.plot(self.dp, self.hm, linewidth=2)[0]) +plt.show() \ No newline at end of file