From f25af4c130254dfe423fac44cce2b867ef15da3e Mon Sep 17 00:00:00 2001 From: Negin Sobhani Date: Thu, 6 Jun 2024 13:28:43 -0600 Subject: [PATCH] advanced indexing --- intermediate/indexing/advanced-indexing.ipynb | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/intermediate/indexing/advanced-indexing.ipynb b/intermediate/indexing/advanced-indexing.ipynb index 16b14d68..43380b14 100644 --- a/intermediate/indexing/advanced-indexing.ipynb +++ b/intermediate/indexing/advanced-indexing.ipynb @@ -17,7 +17,9 @@ "source": [ "## Overview\n", "\n", - "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. Xarray positional indexing deviates from the NumPy when indexing with multiple arrays like `arr[[0, 1], [0, 1]]`. In this tutorial we learn about this difference and how to do vectorized/pointwise indexing using Xarray.\n", + "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. Xarray positional indexing deviates from the NumPy when indexing with multiple arrays like `arr[[0, 1], [0, 1]]`.\n", + "\n", + "In this tutorial we learn about this difference and how to do vectorized/pointwise indexing using Xarray.\n", "\n", "For this notebook, first, we should learn about orthogonal (i.e. outer) and vectorized (i.e. pointwise) indexing concepts. \n", "\n", @@ -31,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 47, "metadata": {}, "outputs": [ { @@ -44,7 +46,7 @@ " [21, 22, ..., 24, 25]])" ] }, - "execution_count": 42, + "execution_count": 47, "metadata": {}, "output_type": "execute_result" } @@ -66,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 48, "metadata": {}, "outputs": [ { @@ -441,11 +443,11 @@ " ...,\n", " [16, 17, ..., 19, 20],\n", " [21, 22, ..., 24, 25]])\n", - "Dimensions without coordinates: dim_0, dim_1
      • " ], "text/plain": [ "\n", @@ -457,7 +459,7 @@ "Dimensions without coordinates: dim_0, dim_1" ] }, - "execution_count": 43, + "execution_count": 48, "metadata": {}, "output_type": "execute_result" } @@ -470,7 +472,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 49, "metadata": {}, "outputs": [ { @@ -479,7 +481,7 @@ "array([ 1, 13, 25])" ] }, - "execution_count": 44, + "execution_count": 49, "metadata": {}, "output_type": "execute_result" } @@ -490,7 +492,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 50, "metadata": {}, "outputs": [ { @@ -863,9 +865,9 @@ "array([[ 1, 3, 5],\n", " [11, 13, 15],\n", " [21, 23, 25]])\n", - "Dimensions without coordinates: dim_0, dim_1
          • " ], "text/plain": [ "\n", @@ -875,7 +877,7 @@ "Dimensions without coordinates: dim_0, dim_1" ] }, - "execution_count": 45, + "execution_count": 50, "metadata": {}, "output_type": "execute_result" } @@ -888,7 +890,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The image below shows the difference between orthogonal and vectorized indexing for a 2D 5x5 array. \n", + "The image below summarizes the difference between orthogonal and vectorized indexing for a 2D 5x5 array. \n", "\n", "![Orthogonal vs. Vectorized Indexing](../../images/orthogonal_vs_vectorized.png)" ]