Skip to content

Commit e739df7

Browse files
authored
Add cfgrib,ipywidgets to doc env (#7888)
* Add cfgrib to doc env * [skip-ci] Raise for errors in doc build * Remove rasterio examples * Add ipywidgets to silence nbsphinx warning
1 parent 073a57f commit e739df7

File tree

3 files changed

+10
-86
lines changed

3 files changed

+10
-86
lines changed

ci/requirements/doc.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ dependencies:
77
- python=3.10
88
- bottleneck
99
- cartopy
10+
- cfgrib
1011
- dask-core>=2022.1
1112
- h5netcdf>=0.13
1213
- ipykernel
14+
- ipywidgets # silence nbsphinx warning
1315
- ipython
1416
- iris>=2.3
1517
- jupyter_client
@@ -24,7 +26,6 @@ dependencies:
2426
- pip
2527
- pre-commit
2628
- pyproj
27-
- rasterio>=1.1
2829
- scipy!=1.10.0
2930
- seaborn
3031
- setuptools

doc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
]
5959
)
6060

61-
nbsphinx_allow_errors = True
61+
nbsphinx_allow_errors = False
6262

6363
# -- General configuration ------------------------------------------------
6464

doc/examples/visualization_gallery.ipynb

+7-84
Original file line numberDiff line numberDiff line change
@@ -193,90 +193,6 @@
193193
"# Show\n",
194194
"plt.tight_layout()"
195195
]
196-
},
197-
{
198-
"cell_type": "markdown",
199-
"metadata": {
200-
"jp-MarkdownHeadingCollapsed": true,
201-
"tags": []
202-
},
203-
"source": [
204-
"## `imshow()` and rasterio map projections\n",
205-
"\n",
206-
"\n",
207-
"Using rasterio's projection information for more accurate plots.\n",
208-
"\n",
209-
"This example extends `recipes.rasterio` and plots the image in the\n",
210-
"original map projection instead of relying on pcolormesh and a map\n",
211-
"transformation."
212-
]
213-
},
214-
{
215-
"cell_type": "code",
216-
"execution_count": null,
217-
"metadata": {},
218-
"outputs": [],
219-
"source": [
220-
"da = xr.tutorial.open_rasterio(\"RGB.byte\")\n",
221-
"\n",
222-
"# The data is in UTM projection. We have to set it manually until\n",
223-
"# https://github.com/SciTools/cartopy/issues/813 is implemented\n",
224-
"crs = ccrs.UTM(\"18\")\n",
225-
"\n",
226-
"# Plot on a map\n",
227-
"ax = plt.subplot(projection=crs)\n",
228-
"da.plot.imshow(ax=ax, rgb=\"band\", transform=crs)\n",
229-
"ax.coastlines(\"10m\", color=\"r\")"
230-
]
231-
},
232-
{
233-
"cell_type": "markdown",
234-
"metadata": {},
235-
"source": [
236-
"## Parsing rasterio geocoordinates\n",
237-
"\n",
238-
"Converting a projection's cartesian coordinates into 2D longitudes and\n",
239-
"latitudes.\n",
240-
"\n",
241-
"These new coordinates might be handy for plotting and indexing, but it should\n",
242-
"be kept in mind that a grid which is regular in projection coordinates will\n",
243-
"likely be irregular in lon/lat. It is often recommended to work in the data's\n",
244-
"original map projection (see `recipes.rasterio_rgb`)."
245-
]
246-
},
247-
{
248-
"cell_type": "code",
249-
"execution_count": null,
250-
"metadata": {},
251-
"outputs": [],
252-
"source": [
253-
"from pyproj import Transformer\n",
254-
"import numpy as np\n",
255-
"\n",
256-
"da = xr.tutorial.open_rasterio(\"RGB.byte\")\n",
257-
"\n",
258-
"x, y = np.meshgrid(da[\"x\"], da[\"y\"])\n",
259-
"transformer = Transformer.from_crs(da.crs, \"EPSG:4326\", always_xy=True)\n",
260-
"lon, lat = transformer.transform(x, y)\n",
261-
"da.coords[\"lon\"] = ((\"y\", \"x\"), lon)\n",
262-
"da.coords[\"lat\"] = ((\"y\", \"x\"), lat)\n",
263-
"\n",
264-
"# Compute a greyscale out of the rgb image\n",
265-
"greyscale = da.mean(dim=\"band\")\n",
266-
"\n",
267-
"# Plot on a map\n",
268-
"ax = plt.subplot(projection=ccrs.PlateCarree())\n",
269-
"greyscale.plot(\n",
270-
" ax=ax,\n",
271-
" x=\"lon\",\n",
272-
" y=\"lat\",\n",
273-
" transform=ccrs.PlateCarree(),\n",
274-
" cmap=\"Greys_r\",\n",
275-
" shading=\"auto\",\n",
276-
" add_colorbar=False,\n",
277-
")\n",
278-
"ax.coastlines(\"10m\", color=\"r\")"
279-
]
280196
}
281197
],
282198
"metadata": {
@@ -296,6 +212,13 @@
296212
"nbconvert_exporter": "python",
297213
"pygments_lexer": "ipython3",
298214
"version": "3.9.7"
215+
},
216+
"widgets": {
217+
"application/vnd.jupyter.widget-state+json": {
218+
"state": {},
219+
"version_major": 2,
220+
"version_minor": 0
221+
}
299222
}
300223
},
301224
"nbformat": 4,

0 commit comments

Comments
 (0)