8000 deploy: cff1a7688f86e6f7d34b8b299a6d87993642a16f · xarray-contrib/xarray-tutorial@ad94dea · GitHub
[go: up one dir, main page]

Skip to content

Commit ad94dea

Browse files
committed
deploy: cff1a76
1 parent a6e9403 commit ad94dea

File tree

6 files changed

+322
-282
lines changed

6 files changed

+322
-282
lines changed

_sources/intermediate/indexing/advanced-indexing.ipynb

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"source": [
1818
"## Overview\n",
1919
"\n",
20-
"In the previous notebooks, we learned basic forms of indexing with xarray (positional and name based dimensions, integer and label based indexing), Datetime Indexing, and nearest neighbor lookups. In this tutorial, we will lean how Xarray indexing is different from Numpy and how to do vectorized/pointwise indexing using Xarray. \n",
20+
"In the previous notebooks, we learned basic forms of indexing with xarray (positional and name based dimensions, integer and label based indexing), Datetime Indexing, and nearest neighbor lookups. In this tutorial, we will learn how Xarray indexing is different from Numpy and how to do vectorized/pointwise indexing using Xarray. \n",
2121
"First, let's import packages needed for this repository: "
2222
]
2323
},
@@ -107,6 +107,18 @@
107107
"da.sel(lat=target_lat, lon=target_lon, method=\"nearest\") # -- orthogonal indexing"
108108
]
109109
},
110+
{
111+
"cell_type": "code",
112+
"execution_count": null,
113+
"metadata": {},
114+
"outputs": [],
115+
"source": [
116+
"target_lat = xr.DataArray([31, 41, 42, 42], dims=\"degrees_north\")\n",
117+
"target_lon = xr.DataArray([200, 201, 202, 205], dims=\"degrees_east\")\n",
118+
"\n",
119+
"da.sel(lat=target_lat, lon=target_lon, method=\"nearest\") # -- orthogonal indexing"
120+
]
121+
},
110122
{
111123
"cell_type": "markdown",
112124
"metadata": {},
@@ -229,35 +241,6 @@
229241
"```"
230242
]
231243
},
232-
{
233-
"cell_type": "markdown",
234-
"metadata": {},
235-
"source": [
236-
"Analogously, label-based pointwise-indexing is also possible by the `.sel()` method:"
237-
]
238-
},
239-
{
240-
"cell_type": "code",
241-
"execution_count": null,
242-
"metadata": {
243-
"tags": []
244-
},
245-
"outputs": [],
246-
"source": [
247-
"da = xr.DataArray(\n",
248-
" np.random.rand(4, 3),\n",
249-
" [\n",
250-
" (\"time\", pd.date_range(\"2000-01-01\", periods=4)),\n",
251-
" (\"space\", [\"IA\", \"IL\", \"IN\"]),\n",
252-
" ],\n",
253-
")\n",
254-
"times = xr.DataArray(pd.to_datetime([\"2000-01-03\", \"2000-01-02\", \"2000-01-01\"]), dims=\"new_time\")\n",
255-
"\n",
256-
"\n",
257-
"# -- get data for each state and each time:\n",
258-
"da.sel(space=xr.DataArray([\"IA\", \"IL\", \"IN\"], dims=[\"new_time\"]), time=times)"
259-
]
260-
},
261244
{
262245
"cell_type": "markdown",
263246
"metadata": {},

_sources/workshops/scipy2023/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ Organized by:
1818

1919
For the live tutorial, we will be using the SciPy 2023 Nebari JupyterHub at [scipy.quansight.dev](https://scipy.quansight.dev/)
2020

21-
You can follow [this participants' guide to register and sign-in to Nebari](https://docs.google.com/document/d/1vnWhNyUBRpILb2MAHQfTmZQY3pCIaCmroV9ke49nQlE/edit), and:
21+
You can follow [this participants' guide to register and sign-in to Nebari](https://docs.google.com/document/d/1vnWhNyUBRpILb2MAHQfTmZQY3pCIaCmroV9ke49nQlE/edit).
22+
23+
**NOTE: When you're in `Server Options` page, select the `Medium Instance for xarray` for the machine instance for this tutorial.**
24+
25+
Once you see the Jupyterlab interface spun up, do the following:
2226

2327
- Open a Terminal
2428

@@ -63,7 +67,11 @@ Once your codespace is launched, the following happens:
6367
```
6468

6569
```{dropdown} Indexing
70+
{doc}`../../fundamentals/02.1_indexing_Basic`
71+
6672
{doc}`../../intermediate/indexing/advanced-indexing`
73+
74+
{doc}`../../intermediate/indexing/boolean-masking-indexing`
6775
```
6876

6977
```{dropdown} Computational Patterns

0 commit comments

Comments
 (0)
0