diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c9ce9283..c72433d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: double-quote-string-fixer - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0 + rev: v3.0.3 hooks: - id: prettier types_or: [html] @@ -30,12 +30,12 @@ repos: language_version: python3 - repo: https://github.com/asottile/add-trailing-comma - rev: v3.0.1 + rev: v3.1.0 hooks: - id: add-trailing-comma - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.281 + rev: v0.0.287 hooks: - id: ruff diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2016-10-12-fetching_data.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2016-10-12-fetching_data.ipynb index 0a262ba1..e94c7ca8 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2016-10-12-fetching_data.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2016-10-12-fetching_data.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"erddapy\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2016-11-15-glider_data_example.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2016-11-15-glider_data_example.ipynb index 4038f10f..34eda694 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2016-11-15-glider_data_example.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2016-11-15-glider_data_example.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cf_xarray\", \"palettable\", \"seawater\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2016-12-20-searching_glider_deployments.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2016-12-20-searching_glider_deployments.ipynb index 362b3b92..9fd6b541 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2016-12-20-searching_glider_deployments.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2016-12-20-searching_glider_deployments.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"iris\", \"seawater\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2017-01-18-siphon-explore-thredds.archived.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2017-01-18-siphon-explore-thredds.archived.ipynb index c45224d3..58bb4b09 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2017-01-18-siphon-explore-thredds.archived.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2017-01-18-siphon-explore-thredds.archived.ipynb @@ -52,17 +52,15 @@ "catalog = TDSCatalog(\"https://thredds.cencoos.org/thredds/catalog.xml\")\n", "\n", "\n", - "info = \"\"\"\n", + "info = f\"\"\"\n", "Catalog information\n", "-------------------\n", "\n", - "Base THREDDS URL: {}\n", - "Catalog name: {}\n", - "Catalog URL: {}\n", - "Metadata: {}\n", - "\"\"\".format(\n", - " catalog.base_tds_url, catalog.catalog_name, catalog.catalog_url, catalog.metadata\n", - ")\n", + "Base THREDDS URL: {catalog.base_tds_url}\n", + "Catalog name: {catalog.catalog_name}\n", + "Catalog URL: {catalog.catalog_url}\n", + "Metadata: {catalog.metadata}\n", + "\"\"\"\n", "\n", "print(info)" ] @@ -234,13 +232,11 @@ } ], "source": [ - "info = \"\"\"\n", - "Href: {}\n", - "Name: {}\n", - "Title: {}\n", - "\"\"\".format(\n", - " ref.href, ref.name, ref.title\n", - ")\n", + "info = f\"\"\"\n", + "Href: {ref.href}\n", + "Name: {ref.name}\n", + "Title: {ref.title}\n", + "\"\"\"\n", "\n", "print(info)" ] diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2017-03-21-ERDDAP_IOOS_Sensor_Map.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2017-03-21-ERDDAP_IOOS_Sensor_Map.ipynb index 1ddf8f2f..d02281dc 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2017-03-21-ERDDAP_IOOS_Sensor_Map.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2017-03-21-ERDDAP_IOOS_Sensor_Map.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"erddapy\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2017-06-12-NCEI_RA_archive_history.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2017-06-12-NCEI_RA_archive_history.ipynb index 20227d8b..8c2421fe 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2017-06-12-NCEI_RA_archive_history.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2017-06-12-NCEI_RA_archive_history.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"owslib\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": { @@ -113,10 +153,8 @@ " \"SCCOOS\": \"Southern California Coastal Ocean Observing System\",\n", " \"SECOORA\": \"Southeast Coastal Ocean Observing Regional Association\",\n", " }\n", - " reg_assoc = '(dataThemeinstitutions_s:\"{}\" dataThemeprojects_s:\"{} ({})\")'.format(\n", - " RAs[ra],\n", - " RAs[ra],\n", - " ra,\n", + " reg_assoc = (\n", + " f'(dataThemeinstitutions_s:\"{RAs[ra]}\" dataThemeprojects_s:\"{RAs[ra]} ({ra})\")'\n", " )\n", "\n", "# Identify the project.\n", diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2017-09-09-hurricane_irma.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2017-09-09-hurricane_irma.ipynb index 6b3ddac3..8ed7c1c5 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2017-09-09-hurricane_irma.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2017-09-09-hurricane_irma.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cf-units\", \"ioos-tools\", \"pyoos\", \"retrying\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -46,7 +86,7 @@ }, "outputs": [], "source": [ - "import sys\n", + "import sys # noqa\n", "from pathlib import Path\n", "from urllib.request import urlopen, urlretrieve\n", "\n", @@ -6518,7 +6558,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2017-11-30-rerddap.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2017-11-30-rerddap.ipynb index 4ab1d95d..08d0ba5e 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2017-11-30-rerddap.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2017-11-30-rerddap.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cartopy\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2018-02-20-obis.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2018-02-20-obis.ipynb index fc599929..01469f3b 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2018-02-20-obis.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2018-02-20-obis.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"palettable\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2018-03-01-erddapy.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2018-03-01-erddapy.ipynb index ece383ff..913e1527 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2018-03-01-erddapy.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2018-03-01-erddapy.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"erddapy\", \"palettable\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1190,9 +1230,7 @@ " )\n", " if len(var) > 2:\n", " raise Exception(\n", - " \"Found more than 1 variable with `standard_names` {}\\n{!r}\".format(\n", - " standard_names, var\n", - " )\n", + " f\"Found more than 1 variable with `standard_names` {standard_names}\\n{var!r}\"\n", " )\n", " variables.extend(var)\n", " return variables" diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2019-03-08-grids-temperature.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2019-03-08-grids-temperature.ipynb index 734ad26c..8630db40 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2019-03-08-grids-temperature.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2019-03-08-grids-temperature.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cartopy\", \"gridgeo\", \"netcdf4\", \"palettable\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2019-05-27-hurricane_gis_part02.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2019-05-27-hurricane_gis_part02.ipynb index cbc286d7..3a5a61d1 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2019-05-27-hurricane_gis_part02.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2019-05-27-hurricane_gis_part02.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cf-units\", \"ioos-tools\", \"pyoos\", \"retrying\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2020-10-10-GTS.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2020-10-10-GTS.ipynb index daa4fdd1..5c722f6a 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2020-10-10-GTS.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2020-10-10-GTS.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"ipyleaflet\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": { diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2021-10-19-multiple-erddap-search.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2021-10-19-multiple-erddap-search.ipynb index 0738c59e..532a00a8 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2021-10-19-multiple-erddap-search.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2021-10-19-multiple-erddap-search.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"erddapy\", \"ipyleaflet\", \"seawater\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_access_notebooks/2022-11-23_pyobis_example.ipynb b/jupyterbook/content/code_gallery/data_access_notebooks/2022-11-23_pyobis_example.ipynb index 941f49a0..ff5a8070 100644 --- a/jupyterbook/content/code_gallery/data_access_notebooks/2022-11-23_pyobis_example.ipynb +++ b/jupyterbook/content/code_gallery/data_access_notebooks/2022-11-23_pyobis_example.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"geoplot\", \"pyobis\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2016-11-16-CF-UGRID-SGRID-conventions.ipynb b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2016-11-16-CF-UGRID-SGRID-conventions.ipynb index 2e702c72..54b1e26e 100644 --- a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2016-11-16-CF-UGRID-SGRID-conventions.ipynb +++ b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2016-11-16-CF-UGRID-SGRID-conventions.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cartopy\", \"cf_xarray\", \"netcdf4\", \"odvc\", \"pysgrid\", \"pyugrid\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-12-04-grids.ipynb b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-12-04-grids.ipynb index 57d95408..95881ba4 100644 --- a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-12-04-grids.ipynb +++ b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-12-04-grids.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cartopy\", \"gridgeo\", \"netcdf4\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2020-02-14-QARTOD_ioos_qc_Water-Level-Example.ipynb b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2020-02-14-QARTOD_ioos_qc_Water-Level-Example.ipynb index db9e1ef8..eb6a6d45 100644 --- a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2020-02-14-QARTOD_ioos_qc_Water-Level-Example.ipynb +++ b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2020-02-14-QARTOD_ioos_qc_Water-Level-Example.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"cf_xarray\", \"erddapy\", \"ioos_qc\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2021-10-25-ERDDAP-interpolate.ipynb b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2021-10-25-ERDDAP-interpolate.ipynb index 8a0ed111..891537aa 100644 --- a/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2021-10-25-ERDDAP-interpolate.ipynb +++ b/jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2021-10-25-ERDDAP-interpolate.ipynb @@ -1,5 +1,46 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "2637369a", + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"erddapy\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "id": "8f0f4f92", diff --git a/jupyterbook/content/code_gallery/data_management_notebooks/2017-05-14-running_compliance_checker.ipynb b/jupyterbook/content/code_gallery/data_management_notebooks/2017-05-14-running_compliance_checker.ipynb index 6ef04043..88762c7f 100644 --- a/jupyterbook/content/code_gallery/data_management_notebooks/2017-05-14-running_compliance_checker.ipynb +++ b/jupyterbook/content/code_gallery/data_management_notebooks/2017-05-14-running_compliance_checker.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"compliance-checker\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_management_notebooks/2017-11-01-Creating-Archives-Using-Bagit.ipynb b/jupyterbook/content/code_gallery/data_management_notebooks/2017-11-01-Creating-Archives-Using-Bagit.ipynb index b01c5cc3..28ad6794 100644 --- a/jupyterbook/content/code_gallery/data_management_notebooks/2017-11-01-Creating-Archives-Using-Bagit.ipynb +++ b/jupyterbook/content/code_gallery/data_management_notebooks/2017-11-01-Creating-Archives-Using-Bagit.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"bagit\", \"pocean-core\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -273,9 +313,7 @@ "metadata": {}, "outputs": [], "source": [ - "urn = \"urn:ioos:station:{naming_authority}:{st_id}\".format(\n", - " naming_authority=naming_authority, st_id=st_id\n", - ")\n", + "urn = f\"urn:ioos:station:{naming_authority}:{st_id}\"\n", "\n", "bag_meta = {\n", " \"Bag-Count\": \"1 of 1\",\n", diff --git a/jupyterbook/content/code_gallery/data_management_notebooks/2018-02-27-pocean-timeSeries-demo.ipynb b/jupyterbook/content/code_gallery/data_management_notebooks/2018-02-27-pocean-timeSeries-demo.ipynb index 4328ce3c..bccbdd5d 100644 --- a/jupyterbook/content/code_gallery/data_management_notebooks/2018-02-27-pocean-timeSeries-demo.ipynb +++ b/jupyterbook/content/code_gallery/data_management_notebooks/2018-02-27-pocean-timeSeries-demo.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"oceans\", \"pocean-core\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/jupyterbook/content/code_gallery/data_management_notebooks/2020-12-08-DataToDwC.ipynb b/jupyterbook/content/code_gallery/data_management_notebooks/2020-12-08-DataToDwC.ipynb index e23434c7..dfc08328 100644 --- a/jupyterbook/content/code_gallery/data_management_notebooks/2020-12-08-DataToDwC.ipynb +++ b/jupyterbook/content/code_gallery/data_management_notebooks/2020-12-08-DataToDwC.ipynb @@ -1,5 +1,45 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"pyworms\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "metadata": { diff --git a/jupyterbook/content/code_gallery/data_management_notebooks/2023-03-20-Reading_and_writing_zarr.ipynb b/jupyterbook/content/code_gallery/data_management_notebooks/2023-03-20-Reading_and_writing_zarr.ipynb index 76be410b..7fb3e84e 100644 --- a/jupyterbook/content/code_gallery/data_management_notebooks/2023-03-20-Reading_and_writing_zarr.ipynb +++ b/jupyterbook/content/code_gallery/data_management_notebooks/2023-03-20-Reading_and_writing_zarr.ipynb @@ -1,5 +1,46 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "04d735b6", + "metadata": { + "tags": [ + "remove-cell" + ] + }, + "outputs": [], + "source": [ + "import subprocess\n", + "import sys\n", + "\n", + "COLAB = \"google.colab\" in sys.modules\n", + "\n", + "\n", + "def _install(package):\n", + " if COLAB:\n", + " ans = input(f\"Install { package }? [y/n]:\")\n", + " if ans.lower() in [\"y\", \"yes\"]:\n", + " subprocess.check_call(\n", + " [sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package]\n", + " )\n", + " print(f\"{ package } installed!\")\n", + "\n", + "\n", + "def _colab_install_missing_deps(deps):\n", + " import importlib\n", + "\n", + " for dep in deps:\n", + " if importlib.util.find_spec(dep) is None:\n", + " if dep == \"iris\":\n", + " dep = \"scitools-iris\"\n", + " _install(dep)\n", + "\n", + "\n", + "deps = [\"zarr\"]\n", + "_colab_install_missing_deps(deps)" + ] + }, { "cell_type": "markdown", "id": "29370978", diff --git a/pytest.ini b/pytest.ini index f276e2d5..aafa9ebb 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,18 +1,20 @@ [pytest] addopts = - # Stale/won't fix/missing library - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2016-12-19-exploring_csw.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2016-12-22-boston_light_swim.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-01-18-siphon-explore-thredds.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-03-21-ERDDAP_IOOS_Sensor_Map.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-07-25-HFRadar_currents.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-09-09-hurricane_irma.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-12-15-finding_HFRadar_currents.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2019-02-26-hurricane_gis_part01.ipynb" - --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2019-03-08-grids-temperature" + # Archived + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2016-12-19-exploring_csw.archived.ipynb" + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2016-12-22-boston_light_swim.archived.ipynb" + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-01-18-siphon-explore-thredds.archived.ipynb" + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-07-25-HFRadar_currents.archived.ipynb" + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-12-15-finding_HFRadar_currents.archived.ipynb" + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2019-02-26-hurricane_gis_part01.archived.ipynb" + --ignore="jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-03-15-ssh-skillscore.archived.ipynb" + --ignore="jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-03-30-wave_height_assessment.archived.ipynb" + # Missing library/rely on versions that are too old --ignore="jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2017-03-30-octave_notebook_example.ipynb" - --ignore="jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-03-15-ssh-skillscore.ipynb" - --ignore="jupyterbook/content/code_gallery/data_analysis_and_visualization_notebooks/2018-03-30-wave_height_assessment.ipynb" + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-09-09-hurricane_irma.ipynb" + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2019-05-27-hurricane_gis_part02.ipynb" + # Take too long to run + --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2019-03-08-grids-temperature.ipynb" # Pass locally but fail upstream for unknown reasons --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-08-01-xtractoR.ipynb" --ignore="jupyterbook/content/code_gallery/data_access_notebooks/2017-11-30-rerddap.ipynb"