Skip to content

Commit

Permalink
FIX: Style compliance for Jupyter Notebooks (#199)
Browse files Browse the repository at this point in the history
* ADD: MRR2 backend

* Revert "ADD: MRR2 backend"

This reverts commit e377116.

* Fixed format to pass ruff.

* ADD: Documenting the changes in history.md

* FIX: Cmweather imports

* Cmweather oh cmweather

* ADD: MVC

* ADD: Link to PR in history.md
  • Loading branch information
rcjackson authored Aug 23, 2024
1 parent bd774ba commit 1b4a535
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 80 deletions.
4 changes: 4 additions & 0 deletions docs/history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## Development version (2024-08-23)

FIX: Notebooks are now conforming to ruff's style checks by [@rcjackson](https://github.com/rcjackson), ({pull}`199`) by [@rcjackson](https://github.com/rcjackson).

## 0.6.3 (2024-08-13)

FIX: use rstart in meter for ODIM_H5/V2_4 ({issue}`196`) by [@kmuehlbauer](https://github.com/kmuehlbauer), ({pull}`197`) by [@kmuehlbauer](https://github.com/kmuehlbauer).
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/Accessors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
"source": [
"import numpy as np\n",
"import xarray as xr\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/CfRadial1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"outputs": [],
"source": [
"import xarray as xr\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
11 changes: 4 additions & 7 deletions examples/notebooks/CfRadial1_Export.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import tempfile\n",
"import cmweather\n",
"import numpy as np\n",
"import xarray as xr\n",
"import xradar as xd\n",
"import cmweather # noqa\n",
"import datatree as xt\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
8 changes: 5 additions & 3 deletions examples/notebooks/CfRadial1_Model_Transformation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
"outputs": [],
"source": [
"import os\n",
"import xarray as xr\n",
"import xradar as xd\n",
"\n",
"import datatree as xt\n",
"from open_radar_data import DATASETS"
"import xarray as xr\n",
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/Furuno.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"outputs": [],
"source": [
"import xarray as xr\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/GAMIC.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"outputs": [],
"source": [
"import xarray as xr\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/notebooks/HaloPhotonics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"metadata": {},
"outputs": [],
"source": [
"import xradar as xd\n",
"import xarray as xr\n",
"import matplotlib.pyplot as plt\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down Expand Up @@ -569,7 +569,7 @@
" x=\"x\", y=\"y\", ax=ax[int(sweep / 3), sweep % 3]\n",
" )\n",
" ax[int(sweep / 3), sweep % 3].set_title(\n",
" \"%2.1f degree scan\" % sweep_ds[\"fixed_angle\"].values[sweep]\n",
" \"{angle:2.1f} degree scan\".format(angle=sweep_ds[\"fixed_angle\"].values[sweep])\n",
" )\n",
" ax[int(sweep / 3), sweep % 3].set_ylim([-4000, 0])\n",
" ax[int(sweep / 3), sweep % 3].set_xlim([-4000, 1000])\n",
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/Iris.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"outputs": [],
"source": [
"import xarray as xr\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
14 changes: 8 additions & 6 deletions examples/notebooks/Multi-Volume-Concatenation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
"metadata": {},
"outputs": [],
"source": [
"import xradar as xd\n",
"import xarray as xr\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import cmweather\n",
"import warnings\n",
"\n",
"import cartopy.crs as ccrs\n",
"import cmweather # noqa\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import xarray as xr\n",
"from open_radar_data import DATASETS\n",
"import warnings\n",
"\n",
"import xradar as xd\n",
"\n",
"warnings.filterwarnings(\"ignore\")"
]
Expand Down
7 changes: 4 additions & 3 deletions examples/notebooks/NexradLevel2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"metadata": {},
"outputs": [],
"source": [
"import cmweather # noqa\n",
"import xarray as xr\n",
"import xradar as xd\n",
"import cmweather\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/ODIM_H5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"outputs": [],
"source": [
"import xarray as xr\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions examples/notebooks/Rainbow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import xarray as xr\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
33 changes: 16 additions & 17 deletions examples/notebooks/Read-plot-Sigmet-data-from-AWS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@
"metadata": {},
"outputs": [],
"source": [
"import fsspec\n",
"import xarray as xr\n",
"import xradar as xd\n",
"from datetime import datetime\n",
"\n",
"import boto3\n",
"import botocore\n",
"import numpy as np\n",
"from pandas import to_datetime\n",
"import cmweather # noqa\n",
"import fsspec\n",
"import matplotlib.pyplot as plt\n",
"import cmweather\n",
"import xarray as xr\n",
"from botocore.client import Config\n",
"from datetime import datetime\n",
"from matplotlib import pyplot\n",
"from pyart.graph import cm"
"from pandas import to_datetime\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down Expand Up @@ -320,7 +319,7 @@
" vmin=-10,\n",
" vmax=50,\n",
" ax=ax,\n",
" cbar_kwargs={\"label\": \"$Reflectivity \\ [dBZ]$\"},\n",
" cbar_kwargs={\"label\": r\"$Reflectivity \\ [dBZ]$\"},\n",
")\n",
"\n",
"ds.RHOHV.where(ds.DBZH >= -10).where(ds.RHOHV >= 0.85).plot(\n",
Expand All @@ -330,7 +329,7 @@
" vmin=0,\n",
" vmax=1,\n",
" ax=ax1,\n",
" cbar_kwargs={\"label\": \"$Corr. \\ Coef. \\ [unitless]$\"},\n",
" cbar_kwargs={\"label\": r\"$Corr. \\ Coef. \\ [unitless]$\"},\n",
")\n",
"\n",
"# lambda fucntion for unit trasformation m->km\n",
Expand All @@ -345,20 +344,20 @@
"ax1.set_title(\"\")\n",
"\n",
"# renaming the axis\n",
"ax.set_ylabel(\"$North - South \\ distance \\ [km]$\")\n",
"ax.set_xlabel(\"$East - West \\ distance \\ [km]$\")\n",
"ax1.set_ylabel(\"$North - South \\ distance \\ [km]$\")\n",
"ax1.set_xlabel(\"$East - West \\ distance \\ [km]$\")\n",
"ax.set_ylabel(r\"$North - South \\ distance \\ [km]$\")\n",
"ax.set_xlabel(r\"$East - West \\ distance \\ [km]$\")\n",
"ax1.set_ylabel(r\"$North - South \\ distance \\ [km]$\")\n",
"ax1.set_xlabel(r\"$East - West \\ distance \\ [km]$\")\n",
"\n",
"# setting up the title\n",
"ax.set_title(\n",
" f\"$Guaviare \\ radar$\"\n",
" r\"$Guaviare \\ radar$\"\n",
" + \"\\n\"\n",
" + f\"${to_datetime(ds.time.values[0]): %Y-%m-%d - %X}$\"\n",
" + \"$ UTC$\"\n",
")\n",
"ax1.set_title(\n",
" f\"$Guaviare \\ radar$\"\n",
" r\"$Guaviare \\ radar$\"\n",
" + \"\\n\"\n",
" + f\"${to_datetime(ds.time.values[0]): %Y-%m-%d - %X}$\"\n",
" + \"$ UTC$\"\n",
Expand Down
8 changes: 4 additions & 4 deletions examples/notebooks/angle_reindexing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import xarray as xr\n",
"import matplotlib.pyplot as plt\n",
"import xradar as xd\n",
"from open_radar_data import DATASETS"
"import xarray as xr\n",
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand Down
26 changes: 12 additions & 14 deletions examples/notebooks/multiple-sweeps-into-volume-scan.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,18 @@
"metadata": {},
"outputs": [],
"source": [
"import fsspec\n",
"import xradar as xd\n",
"import numpy as np\n",
"import cartopy.crs as ccrs\n",
"import cartopy.feature as cfeature\n",
"import matplotlib.pyplot as plt\n",
"import cmweather\n",
"import warnings\n",
"from pandas import to_datetime\n",
"from datetime import datetime\n",
"from matplotlib import pyplot\n",
"\n",
"import cartopy.crs as ccrs\n",
"import cmweather # noqa\n",
"import fsspec\n",
"import matplotlib.pyplot as plt\n",
"from datatree import DataTree, open_datatree\n",
"from matplotlib.animation import FuncAnimation\n",
"from IPython.display import HTML\n",
"from matplotlib.animation import FuncAnimation\n",
"\n",
"import xradar as xd\n",
"\n",
"warnings.simplefilter(\"ignore\")"
]
Expand Down Expand Up @@ -222,8 +220,8 @@
"m2km = lambda x, _: f\"{x/1000:g}\"\n",
"ax.xaxis.set_major_formatter(m2km)\n",
"ax.yaxis.set_major_formatter(m2km)\n",
"ax.set_ylabel(\"$North - South \\ distance \\ [km]$\")\n",
"ax.set_xlabel(\"$East - West \\ distance \\ [km]$\")\n",
"ax.set_ylabel(r\"$North - South \\ distance \\ [km]$\")\n",
"ax.set_xlabel(r\"$East - West \\ distance \\ [km]$\")\n",
"\n",
"# Dictionary-key method\n",
"vcp_dt[\"PRECB\"][\"sweep_0\"].DBZH.plot(\n",
Expand All @@ -238,8 +236,8 @@
"ax1.yaxis.set_major_formatter(m2km)\n",
"ax1.set_xlim(ax.get_xlim())\n",
"ax1.set_ylim(ax.get_ylim())\n",
"ax1.set_ylabel(\"$North - South \\ distance \\ [km]$\")\n",
"ax1.set_xlabel(\"$East - West \\ distance \\ [km]$\")\n",
"ax1.set_ylabel(r\"$North - South \\ distance \\ [km]$\")\n",
"ax1.set_xlabel(r\"$East - West \\ distance \\ [km]$\")\n",
"fig.tight_layout()"
]
},
Expand Down
13 changes: 6 additions & 7 deletions examples/notebooks/plot-ppi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"import xradar as xd\n",
"import cmweather\n",
"from open_radar_data import DATASETS"
"import cmweather # noqa\n",
"from open_radar_data import DATASETS\n",
"\n",
"import xradar as xd"
]
},
{
Expand All @@ -37,9 +37,8 @@
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import pyproj\n",
"import cartopy"
"import cartopy\n",
"import matplotlib.pyplot as plt"
]
},
{
Expand Down

0 comments on commit 1b4a535

Please sign in to comment.