From 08e762ead64fd598799f135068b15e8edfc8c37e Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Mon, 8 Jul 2024 09:18:08 -0600 Subject: [PATCH] Minor changes and typo fixes (#286) * adding the links to all indexing materials * typo fix + remove a redundant example. * updates to indexing * updating advanced indexing * advanced indexing * update indexing redundancies * adding excercise * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * few fixes for build fail * updating header * updating header * align with new exercise syntax * adding advanced indexing * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add numpy advanced indexing * update learning objectives * few minor updates and wording changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update indexing docs * quick merge conflict resolve * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update docs * adding np.ix_ * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix merge * typo fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * quick typo fix * typo * typo * typo fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Scott Henderson Co-authored-by: Scott Henderson --- intermediate/01-high-level-computation-patterns.ipynb | 2 +- intermediate/indexing/advanced-indexing.ipynb | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/intermediate/01-high-level-computation-patterns.ipynb b/intermediate/01-high-level-computation-patterns.ipynb index e5f17c1c..13c5f261 100644 --- a/intermediate/01-high-level-computation-patterns.ipynb +++ b/intermediate/01-high-level-computation-patterns.ipynb @@ -657,7 +657,7 @@ ":class: dropdown\n", "\n", "```python\n", - "data.coarsen(lat=5, lon=5, boundary=\"trim\").reduce(np.mean).plot();\n", + "data.coarsen(lat=5, lon=5, boundary=\"trim\").reduce(np.ptp).plot();\n", "```\n", ":::\n", "::::" diff --git a/intermediate/indexing/advanced-indexing.ipynb b/intermediate/indexing/advanced-indexing.ipynb index ca3f2d5c..a5538151 100644 --- a/intermediate/indexing/advanced-indexing.ipynb +++ b/intermediate/indexing/advanced-indexing.ipynb @@ -154,7 +154,7 @@ "\n", "ds = xr.tutorial.load_dataset(\"air_temperature\")\n", "da_air = ds.air\n", - "ds" + "da_air" ] }, { @@ -171,7 +171,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "👆 please notice how the output of the indexing example above resulted in an array of size `3x4`" + "👆 Please note that the output shape in the example above is `4x3` because the latitude indexer selects 4 rows, and the longitude indexer selects 3 columns." ] }, { @@ -239,7 +239,9 @@ "To trigger vectorized indexing behavior, you will need to provide the selection dimensions with a new **shared** output dimension name. This means that the dimensions of both indexers must be the same, and the output will have the same dimension name as the indexers.\n", "```\n", "\n", - "Let's see how this works with an example. A researcher wants to find the nearest climate model grid cell to a collection of observation sites. She has the latitude and longitude of the observation sites as following:" + "Let's see how this works with an example:\n", + "\n", + "A researcher wants to find the nearest climate model grid cell to a collection of observation sites. They have the latitude and longitude of the observation sites as following:" ] }, { @@ -257,7 +259,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "If the researcher use the lists to index the DataArray, they will get the orthogonal indexing behavior, which is not what they wants." + "If the researcher use the lists to index the DataArray, they will get the orthogonal indexing behavior, which is not what they want." ] }, {