diff --git a/cubed-blockwise-example.ipynb b/cubed-blockwise-example.ipynb index 7b43b777..c306fba8 100644 --- a/cubed-blockwise-example.ipynb +++ b/cubed-blockwise-example.ipynb @@ -2,8 +2,8 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, - "id": "8c33b843-dbaf-4320-a4ae-868b732a1171", + "execution_count": null, + "id": "0", "metadata": {}, "outputs": [], "source": [ @@ -14,550 +14,15 @@ "import cubed.array_api as xp\n", "import numpy as np\n", "import pandas as pd\n", - "import xarray as xr\n", - "\n", - "import flox.xarray" + "import xarray as xr" ] }, { "cell_type": "code", - "execution_count": 2, - "id": "674c8844-f411-4a1a-b055-894b954639a4", + "execution_count": null, + "id": "1", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.Dataset> Size: 363MB\n",
-       "Dimensions:  (time: 8760, latitude: 72, longitude: 144)\n",
-       "Coordinates:\n",
-       "  * time     (time) datetime64[ns] 70kB 2021-01-01 ... 2021-12-31T23:00:00\n",
-       "Dimensions without coordinates: latitude, longitude\n",
-       "Data variables:\n",
-       "    tp       (time, latitude, longitude) float32 363MB cubed.Array<chunksize=(744, 5, 144)>
" - ], - "text/plain": [ - " Size: 363MB\n", - "Dimensions: (time: 8760, latitude: 72, longitude: 144)\n", - "Coordinates:\n", - " * time (time) datetime64[ns] 70kB 2021-01-01 ... 2021-12-31T23:00:00\n", - "Dimensions without coordinates: latitude, longitude\n", - "Data variables:\n", - " tp (time, latitude, longitude) float32 363MB cubed.Array" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "spec = cubed.Spec(allowed_mem=\"2GB\")\n", "ds = xr.Dataset(\n", @@ -574,542 +39,10 @@ }, { "cell_type": "code", - "execution_count": 3, - "id": "80152f02-9d1f-4a45-9dd6-2155167c63f5", + "execution_count": null, + "id": "2", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/tom/miniconda3/envs/flox-cubed-apr2024/lib/python3.11/site-packages/xarray/core/groupby.py:668: FutureWarning: 'M' is deprecated and will be removed in a future version, please use 'ME' instead.\n", - " index_grouper = pd.Grouper(\n" - ] - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'tp' (time: 12, latitude: 72, longitude: 144)> Size: 995kB\n",
-       "cubed.Array<array-006, shape=(12, 72, 144), dtype=float64, chunks=((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), (5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2), (144,))>\n",
-       "Coordinates:\n",
-       "  * time     (time) datetime64[ns] 96B 2021-01-31 2021-02-28 ... 2021-12-31\n",
-       "Dimensions without coordinates: latitude, longitude
" - ], - "text/plain": [ - " Size: 995kB\n", - "cubed.Array\n", - "Coordinates:\n", - " * time (time) datetime64[ns] 96B 2021-01-31 2021-02-28 ... 2021-12-31\n", - "Dimensions without coordinates: latitude, longitude" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "monthly = ds.tp.resample(time=\"M\").sum(method=\"blockwise\")\n", "monthly" @@ -1117,524 +50,10 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "3c93d86f-6435-459f-9fb6-44b6604c3bac", + "execution_count": null, + "id": "3", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
<xarray.DataArray 'tp' (time: 12, latitude: 72, longitude: 144)> Size: 995kB\n",
-       "array([[[744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        ...,\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.]],\n",
-       "\n",
-       "       [[672., 672., 672., ..., 672., 672., 672.],\n",
-       "        [672., 672., 672., ..., 672., 672., 672.],\n",
-       "        [672., 672., 672., ..., 672., 672., 672.],\n",
-       "        ...,\n",
-       "        [672., 672., 672., ..., 672., 672., 672.],\n",
-       "        [672., 672., 672., ..., 672., 672., 672.],\n",
-       "        [672., 672., 672., ..., 672., 672., 672.]],\n",
-       "\n",
-       "       [[744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        ...,\n",
-       "...\n",
-       "        ...,\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.]],\n",
-       "\n",
-       "       [[720., 720., 720., ..., 720., 720., 720.],\n",
-       "        [720., 720., 720., ..., 720., 720., 720.],\n",
-       "        [720., 720., 720., ..., 720., 720., 720.],\n",
-       "        ...,\n",
-       "        [720., 720., 720., ..., 720., 720., 720.],\n",
-       "        [720., 720., 720., ..., 720., 720., 720.],\n",
-       "        [720., 720., 720., ..., 720., 720., 720.]],\n",
-       "\n",
-       "       [[744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        ...,\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.],\n",
-       "        [744., 744., 744., ..., 744., 744., 744.]]])\n",
-       "Coordinates:\n",
-       "  * time     (time) datetime64[ns] 96B 2021-01-31 2021-02-28 ... 2021-12-31\n",
-       "Dimensions without coordinates: latitude, longitude
" - ], - "text/plain": [ - " Size: 995kB\n", - "array([[[744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " ...,\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.]],\n", - "\n", - " [[672., 672., 672., ..., 672., 672., 672.],\n", - " [672., 672., 672., ..., 672., 672., 672.],\n", - " [672., 672., 672., ..., 672., 672., 672.],\n", - " ...,\n", - " [672., 672., 672., ..., 672., 672., 672.],\n", - " [672., 672., 672., ..., 672., 672., 672.],\n", - " [672., 672., 672., ..., 672., 672., 672.]],\n", - "\n", - " [[744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " ...,\n", - "...\n", - " ...,\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.]],\n", - "\n", - " [[720., 720., 720., ..., 720., 720., 720.],\n", - " [720., 720., 720., ..., 720., 720., 720.],\n", - " [720., 720., 720., ..., 720., 720., 720.],\n", - " ...,\n", - " [720., 720., 720., ..., 720., 720., 720.],\n", - " [720., 720., 720., ..., 720., 720., 720.],\n", - " [720., 720., 720., ..., 720., 720., 720.]],\n", - "\n", - " [[744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " ...,\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.],\n", - " [744., 744., 744., ..., 744., 744., 744.]]])\n", - "Coordinates:\n", - " * time (time) datetime64[ns] 96B 2021-01-31 2021-02-28 ... 2021-12-31\n", - "Dimensions without coordinates: latitude, longitude" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "monthly.compute()" ] @@ -1642,18 +61,13 @@ { "cell_type": "code", "execution_count": null, - "id": "ef74c1b4-9886-43ef-8f5e-6e2d031544d8", + "id": "4", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, "language_info": { "codemirror_mode": { "name": "ipython", @@ -1663,8 +77,7 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" + "pygments_lexer": "ipython3" } }, "nbformat": 4,