diff --git a/intermediate/indexing/why-an-index.ipynb b/intermediate/indexing/why-an-index.ipynb index 3123f3d1..487126ff 100644 --- a/intermediate/indexing/why-an-index.ipynb +++ b/intermediate/indexing/why-an-index.ipynb @@ -4,6 +4,17 @@ "cell_type": "markdown", "id": "0", "metadata": {}, + "source": [ + "```{admonition} This notebook is currently broken\n", + ":class: warning\n", + "This notebook has known issues and may not execute correctly. See [xarray-contrib/xarray-tutorial#376](https://github.com/xarray-contrib/xarray-tutorial/issues/376) for details and progress.\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "1", + "metadata": {}, "source": [ "# Why does xarray need an *index*? \n", "\n", @@ -41,7 +52,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1", + "id": "2", "metadata": {}, "outputs": [], "source": [ @@ -74,7 +85,7 @@ }, { "cell_type": "markdown", - "id": "2", + "id": "3", "metadata": {}, "source": [ "## 1. Built-in indexes \n", @@ -86,7 +97,7 @@ }, { "cell_type": "markdown", - "id": "3", + "id": "4", "metadata": {}, "source": [ "## 1.1 A coordinate is just an array of labels\n", @@ -99,7 +110,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -118,7 +129,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -127,7 +138,7 @@ }, { "cell_type": "markdown", - "id": "6", + "id": "7", "metadata": {}, "source": [ "\n", @@ -139,7 +150,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -150,7 +161,7 @@ }, { "cell_type": "markdown", - "id": "8", + "id": "9", "metadata": {}, "source": [ "### Let the index do it" @@ -159,7 +170,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -178,7 +189,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -196,7 +207,7 @@ }, { "cell_type": "markdown", - "id": "11", + "id": "12", "metadata": {}, "source": [ "### Recap: the 1‑D index\n", @@ -212,7 +223,7 @@ }, { "cell_type": "markdown", - "id": "12", + "id": "13", "metadata": {}, "source": [ "## 1.2 Generated, not stored: `RangeIndex`\n", @@ -232,7 +243,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -244,7 +255,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -254,7 +265,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -265,7 +276,7 @@ }, { "cell_type": "markdown", - "id": "16", + "id": "17", "metadata": {}, "source": [ "The labels never materialize unless we request them, so we didn't run out of memory." @@ -273,7 +284,7 @@ }, { "cell_type": "markdown", - "id": "17", + "id": "18", "metadata": {}, "source": [ "## 1.3 Slicing in space *and* time\n", @@ -286,7 +297,7 @@ { "cell_type": "code", "execution_count": null, - "id": "18", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -316,7 +327,7 @@ } }, "cell_type": "markdown", - "id": "19", + "id": "20", "metadata": {}, "source": [ "## 2. A metal ring: when the axis wraps around\n", @@ -338,7 +349,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -364,7 +375,7 @@ { "cell_type": "code", "execution_count": null, - "id": "21", + "id": "22", "metadata": { "tags": [ "hide-input" @@ -403,7 +414,7 @@ }, { "cell_type": "markdown", - "id": "22", + "id": "23", "metadata": {}, "source": [ "### The problem! \n", @@ -414,7 +425,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23", + "id": "24", "metadata": { "tags": [ "hide-input" @@ -441,7 +452,7 @@ }, { "cell_type": "markdown", - "id": "24", + "id": "25", "metadata": {}, "source": [ "## 2.1 📝 Write your own: a `PeriodicIndex`\n", @@ -487,7 +498,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25", + "id": "26", "metadata": { "tags": [ "hide-input" @@ -524,7 +535,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26", + "id": "27", "metadata": {}, "outputs": [], "source": [ @@ -537,7 +548,7 @@ }, { "cell_type": "markdown", - "id": "27", + "id": "28", "metadata": {}, "source": [ "### Does your index fix the -180, 180 issue?\n", @@ -547,7 +558,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28", + "id": "29", "metadata": { "tags": [ "hide-input" @@ -574,7 +585,7 @@ }, { "cell_type": "markdown", - "id": "29", + "id": "30", "metadata": {}, "source": [ "## 3. Build your own: a `CoordinateTransform` (step 1 of 2 — a 1-D ruler)\n", @@ -614,7 +625,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30", + "id": "31", "metadata": { "tags": [ "hide-input" @@ -645,7 +656,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31", + "id": "32", "metadata": {}, "outputs": [], "source": [ @@ -663,7 +674,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32", + "id": "33", "metadata": {}, "outputs": [], "source": [ @@ -685,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33", + "id": "34", "metadata": {}, "outputs": [], "source": [ @@ -697,7 +708,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34", + "id": "35", "metadata": {}, "outputs": [], "source": [ @@ -710,7 +721,7 @@ }, { "cell_type": "markdown", - "id": "35", + "id": "36", "metadata": {}, "source": [ "## 4. A nonlinear warp (a fisheye lens) 🔍\n", @@ -727,7 +738,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36", + "id": "37", "metadata": {}, "outputs": [], "source": [ @@ -763,7 +774,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37", + "id": "38", "metadata": { "tags": [ "hide-input" @@ -789,7 +800,7 @@ }, { "cell_type": "markdown", - "id": "38", + "id": "39", "metadata": {}, "source": [ "### Can xarray handle the undistorted coordinates\n" @@ -798,7 +809,7 @@ { "cell_type": "code", "execution_count": null, - "id": "39", + "id": "40", "metadata": {}, "outputs": [], "source": [ @@ -817,7 +828,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40", + "id": "41", "metadata": {}, "outputs": [], "source": [ @@ -826,7 +837,7 @@ }, { "cell_type": "markdown", - "id": "41", + "id": "42", "metadata": {}, "source": [ "**It breaks.** The standard index can't handle a 2-D coordinate.\n", @@ -835,7 +846,7 @@ }, { "cell_type": "markdown", - "id": "42", + "id": "43", "metadata": {}, "source": [ "### The better fix: A custom Index!\n", @@ -847,7 +858,7 @@ { "cell_type": "code", "execution_count": null, - "id": "43", + "id": "44", "metadata": {}, "outputs": [], "source": [ @@ -897,7 +908,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44", + "id": "45", "metadata": { "tags": [ "hide-input" @@ -920,7 +931,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45", + "id": "46", "metadata": { "tags": [ "hide-input" @@ -949,7 +960,7 @@ { "cell_type": "code", "execution_count": null, - "id": "46", + "id": "47", "metadata": {}, "outputs": [], "source": [ @@ -976,7 +987,7 @@ }, { "cell_type": "markdown", - "id": "47", + "id": "48", "metadata": {}, "source": [ "https://xarray-indexes.readthedocs.io/" @@ -985,13 +996,16 @@ { "cell_type": "code", "execution_count": null, - "id": "48", + "id": "49", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { + "execution": { + "allow_errors": true + }, "language_info": { "codemirror_mode": { "name": "ipython",