Skip to content

Commit cff1a76

Browse files
authored
Quick typo fix + add the links for indexing materials into README.md of SciPy 2023. (#202)
* adding the links to all indexing materials * typo fix + remove a redundant example. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
1 parent 394ba7d commit cff1a76

File tree

3 files changed

+26
-33
lines changed

3 files changed

+26
-33
lines changed

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": {},

workshops/scipy2023/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ Once your codespace is launched, the following happens:
6767
```
6868

6969
```{dropdown} Indexing
70+
{doc}`../../fundamentals/02.1_indexing_Basic`
71+
7072
{doc}`../../intermediate/indexing/advanced-indexing`
73+
74+
{doc}`../../intermediate/indexing/boolean-masking-indexing`
7175
```
7276

7377
```{dropdown} Computational Patterns

workshops/scipy2023/index.ipynb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@
1515
"\n",
1616
"This *4-hour* workshop will explore content from [the Xarray tutorial](https://tutorial.xarray.dev), which contains a comprehensive collection of hands-on tutorial Jupyter Notebooks. We won't cover it all today, but instead will review a curated set of examples that will prepare you for increasingly complex real-world data analysis tasks!\n",
1717
"\n",
18-
"\n",
1918
"## Schedule \n",
2019
"*Times in Central Daylight (Austin, TX)\n",
2120
"\n",
2221
"Use the links to navigate to the right notebooks.\n",
2322
"\n",
24-
"**Remember to select `global-global-xarray environment` for the notebooks when prompted.**\n",
25-
"\n",
2623
"| Topic | Time | Notebook Links | \n",
2724
"| :- | - | - | \n",
2825
"| Introduction and Setup | 1:30 (20 min) | --- | \n",
@@ -36,6 +33,15 @@
3633
"| | **End 5:30** | |\n",
3734
"\n",
3835
"\n",
36+
"## Notes\n",
37+
"\n",
38+
"- Remember to select `global-global-xarray environment` for the notebooks when prompted.\n",
39+
"\n",
40+
"- These notebooks render best if you choose the \"Medium instance for Xarray\" option at login.\n",
41+
"\n",
42+
"```{tip}\n",
43+
"Check that you see \"tip\" in a green bar 👆🏾.\n",
44+
"```\n",
3945
"\n",
4046
"## Thanks for attending!\n",
4147
"\n",

0 commit comments

Comments
 (0)