From 96448a6c00130eb0e795b7f837a3daffec653c5d Mon Sep 17 00:00:00 2001 From: Chris Vernon Date: Thu, 16 Jun 2022 15:45:36 -0400 Subject: [PATCH 1/3] update notebooks to not download data by default --- notebooks/basin_users_logistic_regression.ipynb | 16 +++++++++++++--- notebooks/fishery_dynamics.ipynb | 16 +++++++++++++--- notebooks/hymod.ipynb | 16 +++++++++++++--- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/notebooks/basin_users_logistic_regression.ipynb b/notebooks/basin_users_logistic_regression.ipynb index fe69936..cad23eb 100644 --- a/notebooks/basin_users_logistic_regression.ipynb +++ b/notebooks/basin_users_logistic_regression.ipynb @@ -30,6 +30,19 @@ "In this tutorial, we will be loading in data that has been produced in Hadjimichael et al. (2020). Before we start our analysis, we'll load the relevant Python libraries, example data, and information for the three users." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### **NOTE:** If you are running this notebook locally, run the following command to install the required package data:\n", + "\n", + "```python\n", + "msdbook.install_package_data()\n", + "```\n", + "\n", + "##### Otherwise, proceed with the following" + ] + }, { "cell_type": "code", "execution_count": null, @@ -51,9 +64,6 @@ "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "\n", - "# load example data from Hadjimichael et al. (2020)\n", - "msdbook.install_package_data()\n", - "\n", "# Select the IDs for the three users that we will perform the analysis for\n", "all_IDs = ['7000550','7200799','3704614'] \n", "usernames = ['Medium seniority irrigation',\n", diff --git a/notebooks/fishery_dynamics.ipynb b/notebooks/fishery_dynamics.ipynb index d11c726..06c1cc3 100644 --- a/notebooks/fishery_dynamics.ipynb +++ b/notebooks/fishery_dynamics.ipynb @@ -62,6 +62,19 @@ "In this tutorial, we will be loading in data that has been produced in Hadjimichael et al. (2020). Before we start our analysis, we'll load the relevant Python libraries. __NOTE__: To step through the notebook, execute each gray (code) box by typing \"Shift+Enter\"." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### **NOTE:** If you are running this notebook locally, run the following command to install the required package data:\n", + "\n", + "```python\n", + "msdbook.install_package_data()\n", + "```\n", + "\n", + "##### Otherwise, proceed with the following" + ] + }, { "cell_type": "code", "execution_count": null, @@ -81,9 +94,6 @@ "from SALib.analyze import sobol\n", "from matplotlib import patheffects as pe\n", "\n", - "# load example data\n", - "msdbook.install_package_data()\n", - "\n", "%matplotlib inline\n", "%config InlineBackend.print_figure_kwargs = {'bbox_inches':None}\n" ] diff --git a/notebooks/hymod.ipynb b/notebooks/hymod.ipynb index 8046beb..aaf82b0 100644 --- a/notebooks/hymod.ipynb +++ b/notebooks/hymod.ipynb @@ -104,6 +104,19 @@ "In the following section of code, we'll load the necessary python libraries and read in the input file. For this exercise we'll only use the first eleven years of data. The first five rows of the input dataset are printed to show what they look like:" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "##### **NOTE:** If you are running this notebook locally, run the following command to install the required package data:\n", + "\n", + "```python\n", + "msdbook.install_package_data()\n", + "```\n", + "\n", + "##### Otherwise, proceed with the following" + ] + }, { "cell_type": "code", "execution_count": null, @@ -120,9 +133,6 @@ "from sklearn import metrics\n", "from matplotlib import pyplot as plt\n", "\n", - "# load example data\n", - "msdbook.install_package_data()\n", - "\n", "# load the Leaf River HYMOD input file\n", "leaf_data = msdbook.load_hymod_input_file()\n", "\n", From 45f939a7e3bf02b15ca7d89cb952495ad19f6185 Mon Sep 17 00:00:00 2001 From: Chris Vernon Date: Thu, 16 Jun 2022 15:49:19 -0400 Subject: [PATCH 2/3] add new targets for notebooks --- docs/source/conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index db6042b..3028261 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,10 +24,10 @@ # -- Notebook URLs ----------------------------------------------------------- rst_prolog = """ -.. _nb_logistic_regression: https://mybinder.org/v2/gh/IMMM-SFA/msd_uncertainty_ebook/main?labpath=notebooks%2Fbasin_users_logistic_regression.ipynb -.. _nb_saltelli_sobol: https://mybinder.org/v2/gh/IMMM-SFA/msd_uncertainty_ebook/main?labpath=notebooks%2Fsa_saltelli_sobol_ishigami.ipynb -.. _nb_hymod: https://mybinder.org/v2/gh/IMMM-SFA/msd_uncertainty_ebook/main?labpath=notebooks%2Fhymod.ipynb -.. _nb_fishery_dynamics: https://mybinder.org/v2/gh/IMMM-SFA/msd_uncertainty_ebook/main?labpath=notebooks%2Ffishery_dynamics.ipynb +.. _nb_logistic_regression: https://uc-ebook.msdlive.org/user-redirect/lab/tree/examples/basin_users_logistic_regression.ipynb +.. _nb_saltelli_sobol: https://uc-ebook.msdlive.org/user-redirect/lab/tree/examples/sa_saltelli_sobol_ishigami.ipynb +.. _nb_hymod: https://uc-ebook.msdlive.org/user-redirect/lab/tree/examples/hymod.ipynb +.. _nb_fishery_dynamics: https://uc-ebook.msdlive.org/user-redirect/lab/tree/examples/fishery_dynamics.ipynb """ From ceb89918b5928cd30dfa747703fdf855fd33d075 Mon Sep 17 00:00:00 2001 From: thurber Date: Thu, 16 Jun 2022 14:32:55 -0700 Subject: [PATCH 3/3] add s3 sync action --- .github/workflows/02_deploy.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/02_deploy.yml b/.github/workflows/02_deploy.yml index 288c61f..a01099e 100644 --- a/.github/workflows/02_deploy.yml +++ b/.github/workflows/02_deploy.yml @@ -38,6 +38,16 @@ jobs: - name: Get current datetime in ISO format id: date run: echo "::set-output name=date::$(date -u +'%Y-%m-%d')" + - uses: jakejarvis/s3-sync-action@master + with: + args: --delete + env: + SOURCE_DIR: 'notebooks' + DEST_DIR: 'notebooks' + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} - name: Create GitHub release id: gh_release uses: softprops/action-gh-release@v1