From da2d20fdf86eadcf954431656cb3cd36b93a2c55 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 20:02:58 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.7...v0.6.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f1021ef..7f45505 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.5.7' + rev: 'v0.6.2' hooks: - id: ruff args: ["--fix"] From 139e81dac91ecf1aa2639c742fb19bc6494c0d30 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 20:03:22 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/notebooks/domains.ipynb | 1 - notebooks/atmospheric-river.ipynb | 1 - notebooks/domains.ipynb | 2 -- notebooks/ghg-forcing.ipynb | 1 - notebooks/physics.ipynb | 16 +++++++++++++++- notebooks/prepare-test-data.ipynb | 1 - notebooks/preproc-dev.ipynb | 3 +-- notebooks/preprocessing-cf.ipynb | 2 +- notebooks/production-analysis.ipynb | 3 +-- notebooks/remo-cmor-dev-json.ipynb | 2 -- notebooks/remo-cmor-dev.ipynb | 6 ------ notebooks/remo-dataset.ipynb | 6 ++---- notebooks/remo-dataset2.ipynb | 13 +------------ 13 files changed, 21 insertions(+), 36 deletions(-) diff --git a/docs/notebooks/domains.ipynb b/docs/notebooks/domains.ipynb index 04c35a2..3c90801 100644 --- a/docs/notebooks/domains.ipynb +++ b/docs/notebooks/domains.ipynb @@ -307,7 +307,6 @@ "metadata": {}, "outputs": [], "source": [ - "import numpy as np\n", "from cordex import cordex_domain\n", "\n", "eur11_cordex = cordex_domain(\"EUR-11\", dummy=\"topo\")" diff --git a/notebooks/atmospheric-river.ipynb b/notebooks/atmospheric-river.ipynb index 58eaca7..0b309ef 100644 --- a/notebooks/atmospheric-river.ipynb +++ b/notebooks/atmospheric-river.ipynb @@ -1012,7 +1012,6 @@ "def plot_contourf(da, pole, vmin=None, vmax=None, levels=20):\n", " %matplotlib inline\n", " import cartopy.crs as ccrs\n", - " import cartopy.feature as cf\n", "\n", " # use ncar colormaps from https://github.com/hhuangwx/cmaps\n", " # conda install -c conda-forge cmaps\n", diff --git a/notebooks/domains.ipynb b/notebooks/domains.ipynb index 5c220ee..018ddcf 100644 --- a/notebooks/domains.ipynb +++ b/notebooks/domains.ipynb @@ -2383,7 +2383,6 @@ " %matplotlib inline\n", " import cartopy.crs as ccrs\n", " import cartopy.feature as cf\n", - " import matplotlib.patheffects as pe\n", " import matplotlib.pyplot as plt\n", "\n", " plt.figure(figsize=(20, 10))\n", @@ -2478,7 +2477,6 @@ "metadata": {}, "outputs": [], "source": [ - "import numpy as np\n", "from cordex import cordex_domain\n", "\n", "eur11_cordex = cordex_domain(\"EUR-11\", dummy=\"topo\")" diff --git a/notebooks/ghg-forcing.ipynb b/notebooks/ghg-forcing.ipynb index cf7424f..cb64dbc 100644 --- a/notebooks/ghg-forcing.ipynb +++ b/notebooks/ghg-forcing.ipynb @@ -79,7 +79,6 @@ "\n", "def plot_species(ds):\n", " \"\"\"plot all species and scenarios\"\"\"\n", - " import matplotlib.pyplot as plt\n", "\n", " fig = plt.figure(figsize=(10, 15))\n", " axes = []\n", diff --git a/notebooks/physics.ipynb b/notebooks/physics.ipynb index 1199726..09162c5 100644 --- a/notebooks/physics.ipynb +++ b/notebooks/physics.ipynb @@ -2,6 +2,7 @@ "cells": [ { "cell_type": "markdown", + "id": "7fb27b941602401d91542211134fc71a", "metadata": {}, "source": [ "# Physics" @@ -10,6 +11,7 @@ { "cell_type": "code", "execution_count": 1, + "id": "acae54e37e7d407bbb7b55eff062a284", "metadata": {}, "outputs": [], "source": [ @@ -19,6 +21,7 @@ }, { "cell_type": "markdown", + "id": "9a63283cbaf04dbcab1f6479b197f3a8", "metadata": {}, "source": [ "pyremo contains a simple physics package with common algorithms that were used in a number of legacy fortran programs in and around REMO. For convenience, these algorithms are now implemented in the `pyremo.physics` package. Typical reacurring tasks are, e.g., the derivation relative (`RELHUM`) and specific humidity (`QD`) or liquid water content (`QW`) using temperature and pressure. " @@ -27,6 +30,7 @@ { "cell_type": "code", "execution_count": 2, + "id": "8dd0d8092fe74a7c96281538738b07e2", "metadata": {}, "outputs": [], "source": [ @@ -36,6 +40,7 @@ { "cell_type": "code", "execution_count": 5, + "id": "72eea5119410473aa328ad9291626812", "metadata": {}, "outputs": [], "source": [ @@ -45,6 +50,7 @@ { "cell_type": "code", "execution_count": 18, + "id": "8edb47106e1a46a883d545849b8ab81b", "metadata": {}, "outputs": [ { @@ -593,6 +599,7 @@ { "cell_type": "code", "execution_count": 62, + "id": "10185d26023b46108eb7d9f57d49d2b3", "metadata": {}, "outputs": [], "source": [ @@ -602,6 +609,7 @@ { "cell_type": "code", "execution_count": 7, + "id": "8763a12b2bbd4a93a75aff182afb95dc", "metadata": {}, "outputs": [], "source": [ @@ -611,6 +619,7 @@ { "cell_type": "code", "execution_count": 11, + "id": "7623eae2785240b9bd12b16a66d81610", "metadata": {}, "outputs": [ { @@ -643,6 +652,7 @@ { "cell_type": "code", "execution_count": 43, + "id": "7cdc8c89c7104fffa095e18ddfef8986", "metadata": {}, "outputs": [], "source": [ @@ -652,6 +662,7 @@ { "cell_type": "code", "execution_count": 44, + "id": "b118ea5561624da68c537baed56e602f", "metadata": {}, "outputs": [ { @@ -1200,6 +1211,7 @@ { "cell_type": "code", "execution_count": 45, + "id": "938c804e27f84196a10c8828c723f798", "metadata": {}, "outputs": [], "source": [ @@ -1209,6 +1221,7 @@ { "cell_type": "code", "execution_count": 47, + "id": "504fb2a444614c0babb325280ed9130a", "metadata": {}, "outputs": [ { @@ -1235,7 +1248,6 @@ } ], "source": [ - "import xarray as xr\n", "\n", "(abs(qd - ds.QD) / ds.QD).isel(lev=26).plot()" ] @@ -1243,6 +1255,7 @@ { "cell_type": "code", "execution_count": 17, + "id": "59bbdb311c014d738909a11f9e486628", "metadata": {}, "outputs": [ { @@ -1792,6 +1805,7 @@ { "cell_type": "code", "execution_count": 141, + "id": "b43b363d81ae4b689946ece5c682cd59", "metadata": {}, "outputs": [ { diff --git a/notebooks/prepare-test-data.ipynb b/notebooks/prepare-test-data.ipynb index 051a256..ca41da7 100644 --- a/notebooks/prepare-test-data.ipynb +++ b/notebooks/prepare-test-data.ipynb @@ -63,7 +63,6 @@ "metadata": {}, "outputs": [], "source": [ - "import xarray as xr\n", "\n", "ds = xr.open_mfdataset(files, data_vars=\"minimal\", coords=\"minimal\")" ] diff --git a/notebooks/preproc-dev.ipynb b/notebooks/preproc-dev.ipynb index f2a07f4..7db7341 100644 --- a/notebooks/preproc-dev.ipynb +++ b/notebooks/preproc-dev.ipynb @@ -1068,7 +1068,6 @@ "metadata": {}, "outputs": [], "source": [ - "from pyintorg import interface as intf\n", "\n", "\n", "def horizontal_dims(da):\n", @@ -1343,7 +1342,7 @@ " Makes sure that the selected tos time range is large enough for resampling.\n", "\n", " \"\"\"\n", - " from datetime import date, datetime, timedelta\n", + " from datetime import datetime, timedelta\n", "\n", " import cftime\n", "\n", diff --git a/notebooks/preprocessing-cf.ipynb b/notebooks/preprocessing-cf.ipynb index 184f1fd..99aecaf 100644 --- a/notebooks/preprocessing-cf.ipynb +++ b/notebooks/preprocessing-cf.ipynb @@ -58,7 +58,7 @@ "# from dask_jobqueue import SLURMCluster\n", "import dask\n", "import xarray as xr\n", - "from dask.distributed import Client, progress\n", + "from dask.distributed import Client\n", "\n", "import pyremo as pr\n", "\n", diff --git a/notebooks/production-analysis.ipynb b/notebooks/production-analysis.ipynb index 1afe1bd..048beaa 100644 --- a/notebooks/production-analysis.ipynb +++ b/notebooks/production-analysis.ipynb @@ -44,7 +44,6 @@ "metadata": {}, "outputs": [], "source": [ - "import numpy as np\n", "import xarray as xr\n", "\n", "%matplotlib inline\n", @@ -502,7 +501,7 @@ } ], "source": [ - "from pyremo.analysis import analysis, obs, plot" + "from pyremo.analysis import analysis, plot" ] }, { diff --git a/notebooks/remo-cmor-dev-json.ipynb b/notebooks/remo-cmor-dev-json.ipynb index a5be9f4..2dd975d 100644 --- a/notebooks/remo-cmor-dev-json.ipynb +++ b/notebooks/remo-cmor-dev-json.ipynb @@ -19,7 +19,6 @@ "outputs": [], "source": [ "import glob\n", - "import os\n", "\n", "import cordex as cx\n", "\n", @@ -2516,7 +2515,6 @@ } ], "source": [ - "import cf_xarray as cfxr\n", "\n", "out.cf.add_bounds(\"time\").cf.bounds" ] diff --git a/notebooks/remo-cmor-dev.ipynb b/notebooks/remo-cmor-dev.ipynb index 4e27100..3497ec9 100644 --- a/notebooks/remo-cmor-dev.ipynb +++ b/notebooks/remo-cmor-dev.ipynb @@ -31,20 +31,14 @@ } ], "source": [ - "import datetime as dt\n", "import glob\n", "\n", "# from urllib.request import urlopen\n", - "import json\n", - "import os\n", - "import sys\n", "\n", "# from datetime import datetime as dt\n", "from datetime import timedelta as td\n", "\n", "# import cf_xarray as cfxr\n", - "import cftime as cfdt\n", - "import cmor\n", "import cordex as cx\n", "import numpy as np\n", "import pandas as pd\n", diff --git a/notebooks/remo-dataset.ipynb b/notebooks/remo-dataset.ipynb index 72046ca..64e466c 100644 --- a/notebooks/remo-dataset.ipynb +++ b/notebooks/remo-dataset.ipynb @@ -500,7 +500,7 @@ } ], "source": [ - "from dask.distributed import Client, progress\n", + "from dask.distributed import Client\n", "\n", "client = Client()\n", "client" @@ -18668,9 +18668,7 @@ "execution_count": 25, "metadata": {}, "outputs": [], - "source": [ - "import xesmf as xe" - ] + "source": [] }, { "cell_type": "code", diff --git a/notebooks/remo-dataset2.ipynb b/notebooks/remo-dataset2.ipynb index 0039d48..0812b86 100644 --- a/notebooks/remo-dataset2.ipynb +++ b/notebooks/remo-dataset2.ipynb @@ -41,16 +41,10 @@ "source": [ "# import PyRemo as pr\n", "# from matplotlib import pyplot as plt\n", - "import dask\n", - "import fsspec\n", "\n", "# from tqdm.autonotebook import tqdm\n", - "import intake\n", "import numpy as np\n", - "import pandas as pd\n", - "import seaborn as sns\n", "import xarray as xr\n", - "from dask.diagnostics import progress\n", "\n", "import pyremo as pr\n", "\n", @@ -3218,7 +3212,6 @@ " Function to regrid data bilinearly to a coarser grid\n", " \"\"\"\n", "\n", - " import xesmf as xe\n", "\n", " return xe.Regridder(finer, coarser, mode)" ] @@ -35342,7 +35335,6 @@ } ], "source": [ - "from dask.distributed import progress\n", "\n", "%time temps_mean_ = temps_mean.persist() # start computation\n", "%time progress(temps_mean_)" @@ -35973,7 +35965,6 @@ } ], "source": [ - "from dask.distributed import progress\n", "\n", "%time temps_cycle_ = temps_cycle.persist() # start computation\n", "%time progress(temps_cycle_)" @@ -40656,9 +40647,7 @@ "execution_count": 75, "metadata": {}, "outputs": [], - "source": [ - "import xesmf as xe" - ] + "source": [] }, { "cell_type": "code",