From a0a3bf7691140ad2a62afd0136e79d9368388bdc Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 23 Oct 2024 14:30:13 +0200 Subject: [PATCH 1/6] use (newer) setup-python action also on macos-14 images (#466) --- .github/workflows/tests+pypi.yml | 52 +++++--------------------------- 1 file changed, 8 insertions(+), 44 deletions(-) diff --git a/.github/workflows/tests+pypi.yml b/.github/workflows/tests+pypi.yml index e3e81af1..300d6821 100644 --- a/.github/workflows/tests+pypi.yml +++ b/.github/workflows/tests+pypi.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v5.2.0 with: python-version: "3.10" - run: | @@ -37,7 +37,7 @@ jobs: with: submodules: recursive fetch-depth: 0 - - uses: actions/setup-python@master + - uses: actions/setup-python@v5.2.0 with: python-version: 3.9 - name: Generate coverage report @@ -60,7 +60,7 @@ jobs: submodules: recursive fetch-depth: 0 - name: Set up Python 3.9 - uses: actions/setup-python@v2 + uses: actions/setup-python@v5.2.0 with: python-version: 3.9 - name: Install dependencies @@ -89,7 +89,7 @@ jobs: with: submodules: recursive persist-credentials: false - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5.2.0 with: python-version: 3.9 - env: @@ -121,18 +121,10 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-12, macos-14, windows-latest] - python-version: ["3.9", "3.12", "system"] + python-version: ["3.9", "3.12"] exclude: - - platform: ubuntu-latest - python-version: system - - platform: macos-12 - python-version: system - - platform: windows-latest - python-version: system - platform: macos-14 python-version: "3.9" - - platform: macos-14 - python-version: "3.12" runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v2 @@ -140,18 +132,10 @@ jobs: submodules: recursive fetch-depth: 0 - - if: matrix.platform != 'macos-14' - uses: actions/setup-python@v1 + - uses: actions/setup-python@v5.2.0 with: python-version: ${{ matrix.python-version }} - - if: matrix.platform == 'macos-14' - run: | - sudo ln -s `which python3` /usr/local/bin/python - echo "PIP_INSTALL_ARGS=--break-system-packages" >> $GITHUB_ENV - - # Python 3.12 workaround - python -m pip install --break-system-packages setuptools - run: | python -m pip install $PIP_INSTALL_ARGS -e . # to check if usable without test/example dependencies python -We -c "import PyMPDATA" @@ -178,17 +162,6 @@ jobs: matrix: platform: [ubuntu-latest, macos-12, macos-14, windows-latest] python-version: ["3.9", "3.12"] - exclude: - - platform: ubuntu-latest - python-version: system - - platform: macos-12 - python-version: system - - platform: windows-latest - python-version: system - - platform: macos-14 - python-version: "3.9" - - platform: macos-14 - python-version: "3.12" fail-fast: false runs-on: ${{ matrix.platform }} steps: @@ -197,19 +170,10 @@ jobs: submodules: recursive fetch-depth: 0 - - if: matrix.platform != 'macos-14' - uses: actions/setup-python@v1 + - uses: actions/setup-python@v5.2.0 with: python-version: ${{ matrix.python-version }} - - if: matrix.platform == 'macos-14' - run: | - sudo ln -s `which python3` /usr/local/bin/python - echo "PIP_INSTALL_ARGS=--break-system-packages" >> $GITHUB_ENV - - # Python 3.12 workaround - python -m pip install --break-system-packages setuptools - - run: python -m pip install $PIP_INSTALL_ARGS -e .[tests] ./examples - run: python -m pip install $PIP_INSTALL_ARGS -r tests/devops_tests/requirements.txt - if: matrix.platform == 'ubuntu-latest' @@ -279,7 +243,7 @@ jobs: with: submodules: recursive fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5.2.0 with: python-version: "3.10" From 857f2630001927323334053f04a0273640a1e006 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 23 Oct 2024 14:44:16 +0200 Subject: [PATCH 2/6] bump devops tests to include checks for badges and Colab header cell (#463) --- .../Arabas_and_Farhat_2020/fig_1.ipynb | 27 ++++++++++------ .../Arabas_and_Farhat_2020/fig_2.ipynb | 29 ++++++++++------- .../Arabas_and_Farhat_2020/fig_3.ipynb | 27 ++++++++++------ .../Arabas_and_Farhat_2020/tab_1.ipynb | 27 ++++++++++------ .../Bartman_et_al_2022/fig_X.ipynb | 32 +++++++++++++++++-- examples/PyMPDATA_examples/DPDC/demo.ipynb | 16 +++++++--- .../Jarecka_et_al_2015/fig_6.ipynb | 9 +++--- .../demo.ipynb | 23 +++++++------ .../demo_analytical_solution.ipynb | 16 +++++++--- .../demo_make_convergences.ipynb | 18 ++++++++--- .../demo_make_dispersion_ratio.ipynb | 18 ++++++++--- .../Olesik_et_al_2022/demo_make_plots.ipynb | 26 +++++++++------ .../Olesik_et_al_2022/demo_wall_times.ipynb | 16 +++++++--- .../Shipway_and_Hill_2012/fig_1.ipynb | 20 ++++++++++-- .../Smolarkiewicz_1984/figs_13-14.ipynb | 21 ++++++------ .../demo.ipynb | 13 +++++--- .../demo_over_the_pole.ipynb | 16 +++++----- .../advection_diffusion_1d/demo.ipynb | 18 ++++++++--- .../advection-diffusion-2d.ipynb | 6 ++-- tests/devops_tests | 2 +- 20 files changed, 256 insertions(+), 124 deletions(-) diff --git a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb index fd68c6a2..230633fa 100644 --- a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb +++ b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb @@ -1,15 +1,22 @@ { "cells": [ { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb)" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# license: GPL v3\n", - "# authors: Sylwester Arabas, Michael Olesik, Piotr Bartman\n", - "# copyright: Jagiellonian University\n", - "# based on Fig. 1 from Arabas & Farhat 2020 (https://doi.org/10.1016/j.cam.2019.05.023)" + "license: GPL v3 \n", + "authors: Sylwester Arabas, Michael Olesik, Piotr Bartman \n", + "copyright: Jagiellonian University \n", + "based on Fig. 1 from [Arabas & Farhat 2020](https://doi.org/10.1016/j.cam.2019.05.023)" ] }, { @@ -134,7 +141,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -148,9 +155,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb index e1f4da53..e3ad0131 100644 --- a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb +++ b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb @@ -1,15 +1,22 @@ { "cells": [ { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb)" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# license: GPL v3\n", - "# authors: Sylwester Arabas, Michael Olesik, Piotr Bartman\n", - "# copyright: Jagiellonian University\n", - "# based on Fig. 2 from Arabas & Farhat 2020 (https://doi.org/10.1016/j.cam.2019.05.023)" + "license: GPL v3 \n", + "authors: Sylwester Arabas, Michael Olesik, Piotr Bartman \n", + "copyright: Jagiellonian University \n", + "based on Fig. 2 from [Arabas & Farhat 2020](https://doi.org/10.1016/j.cam.2019.05.023)" ] }, { @@ -24,7 +31,7 @@ "source": [ "import sys\n", "if 'google.colab' in sys.modules:\n", - " !pip --quiet install atmos-atmos-jupyter-utils\n", + " !pip --quiet install open-atmos-jupyter-utils\n", " from open_atmos_jupyter_utils import pip_install_on_colab\n", " pip_install_on_colab('PyMPDATA-examples')" ] @@ -130,7 +137,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -144,9 +151,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb index 9823e971..ae973280 100644 --- a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb +++ b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb @@ -1,15 +1,22 @@ { "cells": [ { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb)" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# license: GPL v3\n", - "# authors: Sylwester Arabas, Michael Olesik, Piotr Bartman\n", - "# copyright: Jagiellonian University\n", - "# based on Fig. 3 from Arabas & Farhat 2020 (https://doi.org/10.1016/j.cam.2019.05.023)" + "license: GPL v3 \n", + "authors: Sylwester Arabas, Michael Olesik, Piotr Bartman \n", + "copyright: Jagiellonian University \n", + "based on Fig. 3 from [Arabas & Farhat 2020](https://doi.org/10.1016/j.cam.2019.05.023)" ] }, { @@ -116,7 +123,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -130,9 +137,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb index 0e5f5b69..6c7b01b4 100644 --- a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb +++ b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb @@ -1,15 +1,22 @@ { "cells": [ { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb)" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# license: GPL v3\n", - "# authors: Sylwester Arabas, Michael Olesik, Piotr Bartman\n", - "# copyright: Jagiellonian University\n", - "# based on Tab. 1 from Arabas & Farhat 2020 (https://doi.org/10.1016/j.cam.2019.05.023)" + "license: GPL v3 \n", + "authors: Sylwester Arabas, Michael Olesik, Piotr Bartman \n", + "copyright: Jagiellonian University \n", + "based on Tab. 1 from [Arabas & Farhat 2020](https://doi.org/10.1016/j.cam.2019.05.023)" ] }, { @@ -262,7 +269,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -276,9 +283,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Bartman_et_al_2022/fig_X.ipynb b/examples/PyMPDATA_examples/Bartman_et_al_2022/fig_X.ipynb index 4df972fc..bc652615 100644 --- a/examples/PyMPDATA_examples/Bartman_et_al_2022/fig_X.ipynb +++ b/examples/PyMPDATA_examples/Bartman_et_al_2022/fig_X.ipynb @@ -1,5 +1,34 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Bartman_et_al_2022/fig_X.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Bartman_et_al_2022/fig_X.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Bartman_et_al_2022/fig_X.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "performance comparison against libmpdata++ presented in the [PyMPDATA JOSS paper](https://doi.org/10.21105/joss.03896)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "if 'google.colab' in sys.modules:\n", + " !pip --quiet install open-atmos-jupyter-utils\n", + " from open_atmos_jupyter_utils import pip_install_on_colab\n", + " pip_install_on_colab('PyMPDATA-examples')" + ] + }, { "cell_type": "code", "execution_count": null, @@ -25,7 +54,6 @@ "outputs": [], "source": [ "import subprocess\n", - "import sys\n", "import json\n", "import numpy as np\n", "import numba\n", @@ -486,7 +514,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.5" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/DPDC/demo.ipynb b/examples/PyMPDATA_examples/DPDC/demo.ipynb index ea2997f1..938c499c 100644 --- a/examples/PyMPDATA_examples/DPDC/demo.ipynb +++ b/examples/PyMPDATA_examples/DPDC/demo.ipynb @@ -4,8 +4,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/master?filepath=examples/PyMPDATA_examples/DPDC/demo.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/DPDC/demo.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/DPDC/demo.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/DPDC/demo.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/DPDC/demo.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "demo of the Double Pass Donor Cell variant" ] }, { @@ -301,7 +309,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -315,7 +323,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.7" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb b/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb index 002f5ffb..81d966e5 100644 --- a/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb +++ b/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb @@ -4,8 +4,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/examples/blob/main/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb)" ] }, { @@ -120,9 +121,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb b/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb index 75348fef..1899efbc 100644 --- a/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb +++ b/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb @@ -4,21 +4,20 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb)" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# references:\n", - "# - Molenkamp 1968: http://dx.doi.org/10.1175/1520-0450(1968)007%3C0160:AOFDMA%3E2.0.CO;2\n", - "# - Anderson & Fattahi 1974: http://dx.doi.org/10.1175/1520-0469(1974)031%3C1500:ACONSO%3E2.0.CO;2\n", - "# - Smolarkiewicz & Margolin 1998: http://dx.doi.org/10.1006/jcph.1998.5901\n", - "# - Jaruga et al. 2015 https://doi.org/10.5194/gmd-8-1005-2015" + "references:\n", + "- Molenkamp 1968: http://dx.doi.org/10.1175/1520-0450(1968)007%3C0160:AOFDMA%3E2.0.CO;2\n", + "- Anderson & Fattahi 1974: http://dx.doi.org/10.1175/1520-0469(1974)031%3C1500:ACONSO%3E2.0.CO;2\n", + "- Smolarkiewicz & Margolin 1998: http://dx.doi.org/10.1006/jcph.1998.5901\n", + "- Jaruga et al. 2015 https://doi.org/10.5194/gmd-8-1005-2015" ] }, { @@ -90,7 +89,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -104,7 +103,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb index 8ba91427..ddfca006 100644 --- a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb +++ b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb @@ -4,8 +4,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examplesPyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "see [Olesik et al. 2022](https://doi.org/10.5194/gmd-15-3879-2022)" ] }, { @@ -176,7 +184,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -190,7 +198,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb index aad7b958..a388fdb8 100644 --- a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb +++ b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb @@ -4,13 +4,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_convergences.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "see [Olesik et al. 2022](https://doi.org/10.5194/gmd-15-3879-2022)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -176,7 +184,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -190,7 +198,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb index 55475a14..c50a3887 100644 --- a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb +++ b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb @@ -4,8 +4,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_dispersion_ratio.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "see [Olesik et al. 2022](https://doi.org/10.5194/gmd-15-3879-2022)" ] }, { @@ -87,7 +95,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -101,9 +109,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb index 7c83e5b6..f021720f 100644 --- a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb +++ b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb @@ -4,18 +4,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb)" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "import os\n", - "os.environ[\"NUMBA_DISABLE_JIT\"] = \"1\"" + "see [Olesik et al. 2022](https://doi.org/10.5194/gmd-15-3879-2022)" ] }, { @@ -31,6 +29,16 @@ " pip_install_on_colab('PyMPDATA-examples')" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "os.environ[\"NUMBA_DISABLE_JIT\"] = \"1\"" + ] + }, { "cell_type": "code", "execution_count": null, @@ -273,9 +281,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.9" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb index 02cd8393..4ade1191 100644 --- a/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb +++ b/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb @@ -4,8 +4,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb) \n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_wall_times.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "see [Olesik et al. 2022](https://doi.org/10.5194/gmd-15-3879-2022)" ] }, { @@ -49,7 +57,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -63,7 +71,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb b/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb index 72a7211a..ffb60a8a 100644 --- a/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb +++ b/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb @@ -1,5 +1,21 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "example based on [Shipway & Hill 20212](https://doi.org/10.1002/qj.1913)" + ] + }, { "cell_type": "code", "execution_count": null, @@ -378,9 +394,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.9" + "version": "3.9.2" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 } diff --git a/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb b/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb index 4e5a63d6..44a9f160 100644 --- a/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb +++ b/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb @@ -4,21 +4,20 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FSmolarkiewicz_1984/figs_13-14.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb)" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# 3D example as in:\n", - "# - Smolarkiewicz 1984, Figs 13-14\n", - "# - Smolarkiewicz and Szmelter 2005\n", - "# - Jaruga et al. 2015, Fig. 13\n", - "# (https://github.com/igfuw/libmpdataxx/blob/master/tests/paper_2015_GMD/4_revolving_sphere_3d)" + "3D example as in:\n", + "- Smolarkiewicz 1984, Figs 13-14\n", + "- Smolarkiewicz and Szmelter 2005\n", + "- Jaruga et al. 2015, Fig. 13\n", + " (https://github.com/igfuw/libmpdataxx/blob/master/tests/paper_2015_GMD/4_revolving_sphere_3d)" ] }, { @@ -142,7 +141,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.9" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb b/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb index 9402f744..e3fdd212 100644 --- a/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb +++ b/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb @@ -8,10 +8,15 @@ } }, "source": [ - "[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb)\n", - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb)\n", - "\n", + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "example based on basic 1D advection test from [Smolarkiewicz 2006](https://doi.org/10.1002/fld.1071)" ] }, diff --git a/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb b/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb index 927cce21..2f7cfd4f 100644 --- a/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb +++ b/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb @@ -4,17 +4,17 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb)" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "# based on MoAC project by Michał Sadowski" + "spherical coordinate transformation example \n", + "by Michał Sadowski" ] }, { @@ -429,7 +429,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -443,7 +443,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.7" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb b/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb index ed3a28ba..cfe1aecd 100644 --- a/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb +++ b/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb @@ -4,8 +4,16 @@ "cell_type": "markdown", "metadata": {}, "source": [ - " [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?filepath=examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb)\n", - " [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "basic demo of advection-diffusion solution with comparison against analytic solution (using sympy)" ] }, { @@ -48,7 +56,7 @@ "mu = 0.05\n", "\n", "solution_symbolic = sp.sympify(\"sin(pi*(x-c*t))*exp(-mu*pi**2*t) + 2\", rational=True)\n", - "u0_symbolic = solution_symbolic.subs({\"t\":0})#sp.sympify(\"sin(pi * x) + 2\", rational=True)\n", + "u0_symbolic = solution_symbolic.subs({\"t\":0})\n", "\n", "#Sim Parameters\n", "steps_per_iter = 1\n", @@ -212,7 +220,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -226,7 +234,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.2" + "version": "3.9.2" } }, "nbformat": 4, diff --git a/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb b/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb index 69a83788..5a9079ba 100644 --- a/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb +++ b/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb @@ -7,9 +7,9 @@ "id": "e333839d" }, "source": [ - "[![View notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb)\n", - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb)\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb)" + "[![preview notebook](https://img.shields.io/static/v1?label=render%20on&logo=github&color=87ce3e&message=GitHub)](https://github.com/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb)\n", + "[![launch on mybinder.org](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb)\n", + "[![launch on Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb)" ] }, { diff --git a/tests/devops_tests b/tests/devops_tests index 231c989f..16203c50 160000 --- a/tests/devops_tests +++ b/tests/devops_tests @@ -1 +1 @@ -Subproject commit 231c989f109a1da47ad77f240db7a6b693983377 +Subproject commit 16203c50739ba13125a044f6adaff6ce9a8b2c1a From dc969ff5c09b513407c1e4eb4ff843c9815c8e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Magnuszewski?= <47724273+pawelmagnu@users.noreply.github.com> Date: Thu, 24 Oct 2024 21:58:33 +0200 Subject: [PATCH 3/6] Adding pdoc-generated example gallery used as both example docs landing site and setup.py description (#467) Co-authored-by: Sylwester Arabas --- .github/workflows/tests+pypi.yml | 14 +++-- docs/markdown/pympdata_examples_landing.md | 36 +++++++++++-- .../Arabas_and_Farhat_2020/__init__.py | 12 +++++ .../Bartman_et_al_2022/__init__.py | 3 ++ examples/PyMPDATA_examples/DPDC/__init__.py | 3 ++ .../Jarecka_et_al_2015/__init__.py | 3 ++ .../__init__.py | 3 ++ .../Olesik_et_al_2022/__init__.py | 15 ++++++ .../Shipway_and_Hill_2012/__init__.py | 3 ++ .../Smolarkiewicz_1984/__init__.py | 3 ++ .../__init__.py | 3 ++ .../__init__.py | 3 ++ .../advection_diffusion_1d/__init__.py | 6 ++- .../advection_diffusion_2d/__init__.py | 3 ++ .../advection-diffusion-2d.ipynb | 2 +- examples/README.md | 53 ++----------------- examples/setup.py | 13 +++-- 17 files changed, 115 insertions(+), 63 deletions(-) diff --git a/.github/workflows/tests+pypi.yml b/.github/workflows/tests+pypi.yml index 300d6821..e8bf7ace 100644 --- a/.github/workflows/tests+pypi.yml +++ b/.github/workflows/tests+pypi.yml @@ -95,10 +95,18 @@ jobs: - env: JUPYTER_PLATFORM_DIRS: 1 run: | - pip3 install pdoc + pip3 install pdoc nbformat pip install -e . -e ./examples - export PDOC_ALLOW_EXEC=1 - python -We -m pdoc -o html PyMPDATA examples/PyMPDATA_examples -t docs/templates + + python - <basic advection equation: +$$ \partial_t (\psi) + \nabla \cdot (u \psi) = 0 $$ + +The examples are grouped by the dimensionality of the computational grid. + +## in 1D +| tags | link | +|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------| +| advection-diffusion equation
$$ \partial_t (\psi) + \nabla \cdot (u \psi) + \mu \Delta (\psi) = 0 $$ | `PyMPDATA_examples.advection_diffusion_1d`* | +| Black-Scholes equation, option pricing
$$ \frac{\partial f}{\partial t} + rS \frac{\partial f}{\partial S} + \frac{\sigma^2}{2} S^2 \frac{\partial^2 f}{\partial S^2} - rf = 0$$ | `PyMPDATA_examples.Arabas_and_Farhat_2020`* | +| advection equation, homogeneous, several algorithm variants comparison: infinite-gauge, flux-corrected,.. | `PyMPDATA_examples.Smolarkiewicz_2006_Figs_3_4_10_11_12` | +| Size-spectral advection, particle population condensational growth, coordinate transformation
$$ \partial_t (G \psi) + \nabla \cdot (Gu \psi) = 0 $$ | `PyMPDATA_examples.Olesik_et_al_2022`* | +| advection equation, [double-pass donor-cell option](https://osti.gov/servlets/purl/7049237) | `PyMPDATA_examples.DPDC` | + +## in 2D +| tags | link | +|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| advection-diffusion equation
$$ \partial_t (\psi) + \nabla \cdot (u \psi) + \mu \Delta (\psi) = 0 $$ | `PyMPDATA_examples.advection_diffusion_2d`*
adv-diff | +| Spectral-spatial advection, particle population condensational growth in a vertical column of air, time dependent flow | `PyMPDATA_examples.Shipway_and_Hill_2012` | +| shallow-water equations
$$\begin{eqnarray} \partial_t h + \partial_x (uh) + \partial_y (vh) &=& 0~ \\\ \partial_t (uh) + \partial_x ( uuh) + \partial_y (vuh) &=& - h \partial_x h~ \\\ \partial_t (vh) + \partial_x ( uvh) + \partial_y (vvh) &=& - h \partial_y h~ \end{eqnarray}$$ | `PyMPDATA_examples.Jarecka_et_al_2015`* | +| advection equation, solid body rotation | `PyMPDATA_examples.Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12`* | +| advection equation, coordinate transformation, spherical coordinates, see also examples in [PYMPDATA-MPI](https://pypi.org/project/PyMPDATA-MPI/) $$ \partial_t (G \psi) + \nabla \cdot (Gu \psi) = 0 $$ | `PyMPDATA_examples.Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14`
mpi-gif | + +## in 3D +| tags | link | +|:------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------| +| homogeneous advection equation | `PyMPDATA_examples.Smolarkiewicz_1984` | +| homogeneous advection equation, performance comparison against libmpdata++, scalability analysis in respect to threads | `PyMPDATA_examples.Bartman_et_al_2022` | + +\* - with comparison against analytic solution # Installation Since the examples package includes Jupyter notebooks (and their execution requires write access), the suggested install and launch steps are: diff --git a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/__init__.py b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/__init__.py index 42fd658b..34b60703 100644 --- a/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/__init__.py +++ b/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/__init__.py @@ -4,6 +4,18 @@ study on pricing of European and American options using MPDATA. Each notebook in this directory corresponds to a figure or a table in the paper. + +fig_1.ipynb: +.. include:: ./fig_1.ipynb.badges.md + +fig_2.ipynb: +.. include:: ./fig_2.ipynb.badges.md + +fig_3.ipynb: +.. include:: ./fig_3.ipynb.badges.md + +tab_1.ipynb: +.. include:: ./tab_1.ipynb.badges.md """ from .simulation import Simulation diff --git a/examples/PyMPDATA_examples/Bartman_et_al_2022/__init__.py b/examples/PyMPDATA_examples/Bartman_et_al_2022/__init__.py index fd48dbbf..5302cc8d 100644 --- a/examples/PyMPDATA_examples/Bartman_et_al_2022/__init__.py +++ b/examples/PyMPDATA_examples/Bartman_et_al_2022/__init__.py @@ -1,4 +1,7 @@ """ This example is based on the paper: [Bartman et al. 2022](https://doi.org/10.21105/joss.03896). + +fig_X.ipynb: +.. include:: ./fig_X.ipynb.badges.md """ diff --git a/examples/PyMPDATA_examples/DPDC/__init__.py b/examples/PyMPDATA_examples/DPDC/__init__.py index d559df63..bc91f929 100644 --- a/examples/PyMPDATA_examples/DPDC/__init__.py +++ b/examples/PyMPDATA_examples/DPDC/__init__.py @@ -1,3 +1,6 @@ """ This example demonstrates the use of the Double-Pass Donor-Cell option in `PyMPDATA.options`. + +demo.ipynb: +.. include:: ./demo.ipynb.badges.md """ diff --git a/examples/PyMPDATA_examples/Jarecka_et_al_2015/__init__.py b/examples/PyMPDATA_examples/Jarecka_et_al_2015/__init__.py index 2e9b2113..84e8fb95 100644 --- a/examples/PyMPDATA_examples/Jarecka_et_al_2015/__init__.py +++ b/examples/PyMPDATA_examples/Jarecka_et_al_2015/__init__.py @@ -2,6 +2,9 @@ This module showcases the PyMPDATA implementation of an MPDATA-based shallow-water equations solver discussed and bencharked against analytical solutions in [Jarecka_et_al_2015](https://doi.org/10.1016/j.jcp.2015.02.003). + +fig_6.ipynb: +.. include:: ./fig_6.ipynb.badges.md """ from .plot_output import plot_output diff --git a/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/__init__.py b/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/__init__.py index ddd62819..2f94d7ad 100644 --- a/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/__init__.py +++ b/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/__init__.py @@ -2,4 +2,7 @@ This is an example based on the solid-body rotation test from [Molenkap 1968](http://doi.org/10.1175/1520-0450(1968)007%3C0160:AOFDMA%3E2.0.CO;2) (as in Fig. 12 in [Jaruga et al. 2015](https://doi.org/10.5194/gmd-8-1005-2015)). + +demo.ipynb: +.. include:: ./demo.ipynb.badges.md """ diff --git a/examples/PyMPDATA_examples/Olesik_et_al_2022/__init__.py b/examples/PyMPDATA_examples/Olesik_et_al_2022/__init__.py index 3029cc93..6b474dcd 100644 --- a/examples/PyMPDATA_examples/Olesik_et_al_2022/__init__.py +++ b/examples/PyMPDATA_examples/Olesik_et_al_2022/__init__.py @@ -2,4 +2,19 @@ This is a PyMPDATA implementation of 1D particle population condensational growth problem with coordinate transformations, as presented in [Olesik et al. 2022](https://doi.org/10.5194/gmd-15-3879-2022). + +demo_analytical_solution.ipynb: +.. include:: ./demo_analytical_solution.ipynb.badges.md + +demo_make_convergences.ipynb: +.. include:: ./demo_make_convergences.ipynb.badges.md + +demo_make_dispersion_ratio.ipynb: +.. include:: ./demo_make_dispersion_ratio.ipynb.badges.md + +demo_make_plots.ipynb: +.. include:: ./demo_make_plots.ipynb.badges.md + +demo_wall_times.ipynb: +.. include:: ./demo_wall_times.ipynb.badges.md """ diff --git a/examples/PyMPDATA_examples/Shipway_and_Hill_2012/__init__.py b/examples/PyMPDATA_examples/Shipway_and_Hill_2012/__init__.py index 5f97ed81..04367c3a 100644 --- a/examples/PyMPDATA_examples/Shipway_and_Hill_2012/__init__.py +++ b/examples/PyMPDATA_examples/Shipway_and_Hill_2012/__init__.py @@ -2,6 +2,9 @@ This is an example of 2D droplet size-spectral/spatial problem of condensational growth in a column of air, as described in [Shipway and Hill 2012](https://doi.org/10.1002/qj.1913). + +fig_1.ipynb +.. include:: ./fig_1.ipynb.badges.md """ from .arakawa_c import arakawa_c diff --git a/examples/PyMPDATA_examples/Smolarkiewicz_1984/__init__.py b/examples/PyMPDATA_examples/Smolarkiewicz_1984/__init__.py index ab115d37..267b9793 100644 --- a/examples/PyMPDATA_examples/Smolarkiewicz_1984/__init__.py +++ b/examples/PyMPDATA_examples/Smolarkiewicz_1984/__init__.py @@ -1,6 +1,9 @@ """ This is an example of 3D advection, a spherical signal revolving in a box, based on [Smolarkiewicz, 1984](https://doi.org/10.1016/0021-9991(84)90121-9). + +figs_13-14.ipynb: +.. include:: ./figs_13-14.ipynb.badges.md """ from .settings import Settings diff --git a/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/__init__.py b/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/__init__.py index 1a6c85fa..8d6a0477 100644 --- a/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/__init__.py +++ b/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/__init__.py @@ -3,5 +3,8 @@ [Smolarkiewicz 2006](https://doi.org/10.1002/fld.1071), depicting infinite-gauge and flux-corrected transport case. +demo.ipynb: +.. include:: ./demo.ipynb.badges.md + ![plot](https://github.com/open-atmos/PyMPDATA/releases/download/tip/fig_4.svg) """ diff --git a/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/__init__.py b/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/__init__.py index 08a67c65..e973f940 100644 --- a/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/__init__.py +++ b/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/__init__.py @@ -3,4 +3,7 @@ [Williamson and Rasch 1989](https://doi.org/10.1175/1520-0493(1989)117%3C0102:TDSLTW%3E2.0.CO;2). It demonstrates the use of `PyMPDATA.solver.g_factor` to transform the advection problem onto a sphere. + +demo_over_the_pole.ipynb: +.. include:: ./demo_over_the_pole.ipynb.badges.md """ diff --git a/examples/PyMPDATA_examples/advection_diffusion_1d/__init__.py b/examples/PyMPDATA_examples/advection_diffusion_1d/__init__.py index 41e31c95..c5e53dba 100644 --- a/examples/PyMPDATA_examples/advection_diffusion_1d/__init__.py +++ b/examples/PyMPDATA_examples/advection_diffusion_1d/__init__.py @@ -1,4 +1,6 @@ """ -PyMPDATA 1D advection-diffusion example with error analysis -for different initial parameters. +PyMPDATA 1D advection-diffusion example with error analysis for different initial parameters. + +demo.ipynb: +.. include:: ./demo.ipynb.badges.md """ diff --git a/examples/PyMPDATA_examples/advection_diffusion_2d/__init__.py b/examples/PyMPDATA_examples/advection_diffusion_2d/__init__.py index 8412e802..10e46f3f 100644 --- a/examples/PyMPDATA_examples/advection_diffusion_2d/__init__.py +++ b/examples/PyMPDATA_examples/advection_diffusion_2d/__init__.py @@ -1,3 +1,6 @@ """ PyMPDATA 2D advection-diffusion example with gif creation. + +advection-diffusion-2d.ipynb: +.. include:: ./advection-diffusion-2d.ipynb.badges.md """ diff --git a/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb b/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb index 5a9079ba..1e4c346c 100644 --- a/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb +++ b/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb @@ -473,7 +473,7 @@ "outputs": [], "source": [ "def merge_images_into_gif(image_folder, gif_name, duration=0.01):\n", - " with imageio.get_writer(gif_name, mode='I', duration=duration) as writer:\n", + " with imageio.get_writer(gif_name, mode='I', duration=duration, loop=0) as writer:\n", " for filename in sorted(os.listdir(image_folder)):\n", " image = imageio.v3.imread(os.path.join(image_folder, filename))\n", " writer.append_data(image)" diff --git a/examples/README.md b/examples/README.md index aa6478ec..75c57dcf 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,53 +4,6 @@ [![PyPI version](https://badge.fury.io/py/PyMPDATA-examples.svg)](https://pypi.org/project/PyMPDATA-examples) [![API docs](https://img.shields.io/badge/API_docs-pdoc3-blue.svg)](https://open-atmos.github.io/PyMPDATA-examples/) -Each of the examples listed below can either be executed using Jupyer after downaloding it (and installing - the PySDM-examples package using ``pip install``) or executed in the cloud by clicking on one of the - Mybinder or Colab badges below: - -- [Smolarkiewicz 2006](http://doi.org/10.1002/fld.1071) Figs 3,4,10,11 & 12 - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FSmolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_2006_Figs_3_4_10_11_12/demo.ipynb) - (1D homogeneous cases depicting infinite-gauge and flux-corrected transport cases) -- [Arabas & Farhat 2020](https://doi.org/10.1016/j.cam.2019.05.023) (1D advection-diffusion example based on Black-Scholes equation): - - Fig 1: - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FArabas_and_Farhat_2020/fig_1.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_1.ipynb) - - Fig 2: - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FArabas_and_Farhat_2020/fig_2.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_2.ipynb) - - Fig 3: - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FArabas_and_Farhat_2020/fig_3.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/fig_3.ipynb) - - Tab 1: - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FArabas_and_Farhat_2020/tab_1.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Arabas_and_Farhat_2020/tab_1.ipynb) -- [Olesik et al. 2022](https://doi.org/10.5194/gmd-15-3879-2022) - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FOlesik_et_al_2022/) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Olesik_et_al_2022/demo_make_plots.ipynb) - (1D particle population condensational growth problem with coordinate transformations) -- [Shipway and Hill 2012 (KiD-1D)](https://doi.org/10.1002/qj.1913) (analysis discussed in [Olesik et al. 2022](https://arxiv.org/abs/2011.14726)) - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FShipway_and_Hill_2012/) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Shipway_and_Hill_2012/fig_1.ipynb) - (2D spectral-spatial problem of droplet condensational growth in a column of air) -![animation](https://github.com/open-atmos/PyMPDATA/wiki/files/KiD-1D_PyMPDATA_n_iters=1.gif) -![animation](https://github.com/open-atmos/PyMPDATA/wiki/files/KiD-1D_PyMPDATA_n_iters=3.gif) -- Molenkamp 2D solid-body rotation test (as in [Jaruga et al. 2015](https://doi.org/10.5194/gmd-8-1005-2015), Fig. 12) - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FMolenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12/demo.ipynb) -- 1D advection-diffusion example with animation - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2Fadvection_diffusion_1d/demo.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_1d/demo.ipynb) -- 2D advection-diffusion example with visualization - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2Fadvection_diffusion_2d/advection-diffusion-2d.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/advection_diffusion_2d/advection-diffusion-2d.ipynb) -- 2D shallow-water equations (3D elliptic drop spreading on 2D plane under gravity example from [Jarecka et al. 2015](https://doi.org/10.1016/j.jcp.2015.02.003)) - - Fig 6: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Jarecka_et_al_2015/fig_6.ipynb) -- 2D advection on a sphere (setup depicting coordinate transformation based on [Williamson and Rasch 1989](https://doi.org/10.1175/1520-0493(1989)117%3C0102:TDSLTW%3E2.0.CO;2)) - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FWilliamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14/demo_over_the_pole.ipynb) -![animation](https://github.com/open-atmos/PyMPDATA/wiki/files/sphere_upwind.gif) -- 3D advection (spherical signal revolving in a box, based on [Smolarkiewicz 1984](https://doi.org/10.1016/0021-9991(84)90121-9)) - [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyMPDATA.git/main?urlpath=lab/tree/examples/PyMPDATA_examples%2FSmolarkiewicz_1984/figs_13-14.ipynb) - [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyMPDATA/blob/main/examples/PyMPDATA_examples/Smolarkiewicz_1984/figs_13-14.ipynb) +For a list of examples, see [PyMPDATA-examples documentation](https://open-atmos.github.io/PyMPDATA/PyMPDATA_examples.html). + +For information on package development, see [PyMPDATA README](https://github.com/open-atmos/PyMPDATA/blob/main/README.md). diff --git a/examples/setup.py b/examples/setup.py index 9b8678d7..f95dabed 100644 --- a/examples/setup.py +++ b/examples/setup.py @@ -1,15 +1,20 @@ """ the magick behind ``pip install ...`` """ import os +import re from setuptools import find_packages, setup def get_long_description(): - """returns contents of README.md file""" - with open("README.md", "r", encoding="utf8") as file: - long_description = file.read() - return long_description + """returns contents of the pdoc landing site with pdoc links converted into URLs""" + with open( + "../docs/markdown/pympdata_examples_landing.md", "r", encoding="utf8" + ) as file: + pdoc_links = re.compile( + r"(`)([\w\d_-]*).([\w\d_-]*)(`)", re.MULTILINE | re.UNICODE + ) + return pdoc_links.sub(r'\3', file.read()) CI = "CI" in os.environ From 8fff7ce640ccaf807827d8ffc6f32dd2ff57ea1b Mon Sep 17 00:00:00 2001 From: Sfonxu <89732829+Sfonxu@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:03:24 +0200 Subject: [PATCH 4/6] add Rust code snippets to the tutorial (incl. CI execution) (#450) Co-authored-by: Sylwester Arabas --- .github/workflows/readme_rust.yml | 43 ++++++++++++++ docs/markdown/pympdata_landing.md | 93 ++++++++++++++++++++++++++++++- 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/readme_rust.yml diff --git a/.github/workflows/readme_rust.yml b/.github/workflows/readme_rust.yml new file mode 100644 index 00000000..45c39f14 --- /dev/null +++ b/.github/workflows/readme_rust.yml @@ -0,0 +1,43 @@ +name: readme_rust + +defaults: + run: + shell: bash + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '0 13 * * 4' + +jobs: + rust: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + with: + components: rust-src + - uses: actions/setup-python@v5 + with: + python-version: 3.9 + - run: pip install -e . + - run: pip install pytest-codeblocks pytest + + - run: | + cat >Cargo.toml < Python code (click to expand) +
+Rust code (click to expand) +```Rust +use pyo3::prelude::*; +use pyo3::types::{IntoPyDict, PyDict, PyTuple}; + +fn main() -> PyResult<()> { + Python::with_gil(|py| { + let options_args = [("n_iters", 2)].into_py_dict_bound(py); + let options = py.import_bound("PyMPDATA")?.getattr("Options")?.call((), Some(&options_args))?; +``` +
+ ```Python from PyMPDATA import Options options = Options(n_iters=2) @@ -236,6 +249,45 @@ advector = VectorField(pyargs(... )); ``` + +
+Rust code (click to expand) +```Rust + let vector_field = py.import_bound("PyMPDATA")?.getattr("VectorField")?; + let scalar_field = py.import_bound("PyMPDATA")?.getattr("ScalarField")?; + let periodic = py.import_bound("PyMPDATA.boundary_conditions")?.getattr("Periodic")?; + + let nx_ny = [24, 24]; + let cx_cy = [-0.5, -0.25]; + let boundary_con = PyTuple::new_bound(py, [periodic.call0()?, periodic.call0()?]).into_any(); + let halo = options.getattr("n_halo")?; + + let indices = PyDict::new_bound(py); + Python::run_bound(py, &format!(r#" +import numpy as np +nx, ny = {}, {} +xi, yi = np.indices((nx, ny), dtype=float) +data=np.exp( + -(xi+.5-nx/2)**2 / (2*(ny/10)**2) + -(yi+.5-nx/2)**2 / (2*(ny/10)**2) +) + "#, nx_ny[0], nx_ny[1]), None, Some(&indices)).unwrap(); + + let advectee_arg = vec![("data", indices.get_item("data")?), ("halo", Some(halo.clone())), ("boundary_conditions", Some(boundary_con))].into_py_dict_bound(py); + let advectee = scalar_field.call((), Some(&advectee_arg))?; + let full = PyDict::new_bound(py); + Python::run_bound(py, &format!(r#" +import numpy as np +nx, ny = {}, {} +Cx, Cy = {}, {} +data = (np.full((nx + 1, ny), Cx), np.full((nx, ny + 1), Cy)) + "#, nx_ny[0], nx_ny[1], cx_cy[0], cx_cy[1]), None, Some(&full)).unwrap(); + let boundary_con = PyTuple::new_bound(py, [periodic.call0()?, periodic.call0()?]).into_any(); + let advector_arg = vec![("data", full.get_item("data")?), ("halo", Some(halo.clone())), ("boundary_conditions", Some(boundary_con))].into_py_dict_bound(py); + let advector = vector_field.call((), Some(&advector_arg))?; +``` +
+
Python code (click to expand) @@ -306,6 +358,18 @@ stepper = Stepper(pyargs(... ```
+ +
+Rust code (click to expand) + +```Rust +let n_dims: i32 = 2; +let stepper_arg = PyDict::new_bound(py); +let _ = PyDictMethods::set_item(&stepper_arg, "options", &options); +let _ = PyDictMethods::set_item(&stepper_arg, "n_dims", &n_dims); +``` +
+ Python code (click to expand) ```Python @@ -332,6 +396,17 @@ stepper = Stepper(pyargs(... )); ```
+ +
+Rust code (click to expand) + +```Rust + let _stepper_arg_alternative = vec![("options", &options), ("grid", &PyTuple::new_bound(py, nx_ny).into_any())].into_py_dict_bound(py); + let stepper_ = py.import_bound("PyMPDATA")?.getattr("Stepper")?; + let stepper = stepper_.call((), Some(&stepper_arg))?; //or use stepper args alternative +``` +
+
Python code (click to expand) @@ -406,6 +481,22 @@ solver.advance(pyargs('n_steps', 75)); state = solver.advectee.get(); ```
+ +
+Rust code (click to expand) + +```Rust + let solver_ = py.import_bound("PyMPDATA")?.getattr("Solver")?; + let solver = solver_.call((), Some(&vec![("stepper", stepper), ("advectee", advectee), ("advector", advector)].into_py_dict_bound(py)))?; + let _state_0 = solver.getattr("advectee")?.getattr("get")?.call0()?.getattr("copy")?.call0()?; + solver.getattr("advance")?.call((), Some(&vec![("n_steps", 75)].into_py_dict_bound(py)))?; + let _state = solver.getattr("advectee")?.getattr("get")?.call0()?; + Ok(()) + }) +} +``` +
+
Python code (click to expand) From 6100931e2b680d36235a41b5f56f27b5456fccac Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Fri, 25 Oct 2024 11:18:53 +0200 Subject: [PATCH 5/6] fixing inclusion of examples landing page in MANIFEST.in (for sdist to work) + add one more animation (#470) --- examples/MANIFEST.in | 1 + examples/PyMPDATA_examples/__init__.py | 2 +- {docs/markdown => examples/docs}/pympdata_examples_landing.md | 4 ++-- examples/setup.py | 4 +--- 4 files changed, 5 insertions(+), 6 deletions(-) rename {docs/markdown => examples/docs}/pympdata_examples_landing.md (96%) diff --git a/examples/MANIFEST.in b/examples/MANIFEST.in index fd3bf40e..4bbc8430 100644 --- a/examples/MANIFEST.in +++ b/examples/MANIFEST.in @@ -1 +1,2 @@ global-exclude *.ipynb +include docs/*.md diff --git a/examples/PyMPDATA_examples/__init__.py b/examples/PyMPDATA_examples/__init__.py index 7cc7d8cd..af03ba93 100644 --- a/examples/PyMPDATA_examples/__init__.py +++ b/examples/PyMPDATA_examples/__init__.py @@ -1,5 +1,5 @@ """ -.. include:: ../../docs/markdown/pympdata_examples_landing.md +.. include:: ../docs/pympdata_examples_landing.md """ from importlib.metadata import PackageNotFoundError, version diff --git a/docs/markdown/pympdata_examples_landing.md b/examples/docs/pympdata_examples_landing.md similarity index 96% rename from docs/markdown/pympdata_examples_landing.md rename to examples/docs/pympdata_examples_landing.md index c7c6720a..a1b0337d 100644 --- a/docs/markdown/pympdata_examples_landing.md +++ b/examples/docs/pympdata_examples_landing.md @@ -25,10 +25,10 @@ The examples are grouped by the dimensionality of the computational grid. | tags | link | |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | advection-diffusion equation
$$ \partial_t (\psi) + \nabla \cdot (u \psi) + \mu \Delta (\psi) = 0 $$ | `PyMPDATA_examples.advection_diffusion_2d`*
adv-diff | -| Spectral-spatial advection, particle population condensational growth in a vertical column of air, time dependent flow | `PyMPDATA_examples.Shipway_and_Hill_2012` | +| Spectral-spatial advection, particle population condensational growth in a vertical column of air, time dependent flow | `PyMPDATA_examples.Shipway_and_Hill_2012`
spectral-spatial | | shallow-water equations
$$\begin{eqnarray} \partial_t h + \partial_x (uh) + \partial_y (vh) &=& 0~ \\\ \partial_t (uh) + \partial_x ( uuh) + \partial_y (vuh) &=& - h \partial_x h~ \\\ \partial_t (vh) + \partial_x ( uvh) + \partial_y (vvh) &=& - h \partial_y h~ \end{eqnarray}$$ | `PyMPDATA_examples.Jarecka_et_al_2015`* | | advection equation, solid body rotation | `PyMPDATA_examples.Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12`* | -| advection equation, coordinate transformation, spherical coordinates, see also examples in [PYMPDATA-MPI](https://pypi.org/project/PyMPDATA-MPI/) $$ \partial_t (G \psi) + \nabla \cdot (Gu \psi) = 0 $$ | `PyMPDATA_examples.Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14`
mpi-gif | +| advection equation, coordinate transformation, spherical coordinates, see also examples in [PyMPDATA-MPI](https://pypi.org/project/PyMPDATA-MPI/) $$ \partial_t (G \psi) + \nabla \cdot (Gu \psi) = 0 $$ | `PyMPDATA_examples.Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14`
mpi-gif | ## in 3D | tags | link | diff --git a/examples/setup.py b/examples/setup.py index f95dabed..197ba244 100644 --- a/examples/setup.py +++ b/examples/setup.py @@ -8,9 +8,7 @@ def get_long_description(): """returns contents of the pdoc landing site with pdoc links converted into URLs""" - with open( - "../docs/markdown/pympdata_examples_landing.md", "r", encoding="utf8" - ) as file: + with open("docs/pympdata_examples_landing.md", "r", encoding="utf8") as file: pdoc_links = re.compile( r"(`)([\w\d_-]*).([\w\d_-]*)(`)", re.MULTILINE | re.UNICODE ) From ca1b26403c869f2e004d854d05c471845a52c56c Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Fri, 25 Oct 2024 16:36:04 +0200 Subject: [PATCH 6/6] HTML syntax fix --- examples/docs/pympdata_examples_landing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/docs/pympdata_examples_landing.md b/examples/docs/pympdata_examples_landing.md index a1b0337d..ed60f6fb 100644 --- a/examples/docs/pympdata_examples_landing.md +++ b/examples/docs/pympdata_examples_landing.md @@ -28,7 +28,7 @@ The examples are grouped by the dimensionality of the computational grid. | Spectral-spatial advection, particle population condensational growth in a vertical column of air, time dependent flow | `PyMPDATA_examples.Shipway_and_Hill_2012`
spectral-spatial | | shallow-water equations
$$\begin{eqnarray} \partial_t h + \partial_x (uh) + \partial_y (vh) &=& 0~ \\\ \partial_t (uh) + \partial_x ( uuh) + \partial_y (vuh) &=& - h \partial_x h~ \\\ \partial_t (vh) + \partial_x ( uvh) + \partial_y (vvh) &=& - h \partial_y h~ \end{eqnarray}$$ | `PyMPDATA_examples.Jarecka_et_al_2015`* | | advection equation, solid body rotation | `PyMPDATA_examples.Molenkamp_test_as_in_Jaruga_et_al_2015_Fig_12`* | -| advection equation, coordinate transformation, spherical coordinates, see also examples in [PyMPDATA-MPI](https://pypi.org/project/PyMPDATA-MPI/) $$ \partial_t (G \psi) + \nabla \cdot (Gu \psi) = 0 $$ | `PyMPDATA_examples.Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14`
mpi-gif | +| advection equation, coordinate transformation, spherical coordinates, see also examples in [PyMPDATA-MPI](https://pypi.org/project/PyMPDATA-MPI/) $$ \partial_t (G \psi) + \nabla \cdot (Gu \psi) = 0 $$ | `PyMPDATA_examples.Williamson_and_Rasch_1989_as_in_Jaruga_et_al_2015_Fig_14`
mpi-gif | ## in 3D | tags | link |