From 05809b61c5892b56969bd682846b873f8b5ff150 Mon Sep 17 00:00:00 2001 From: Damien Irving Date: Thu, 24 Jun 2021 10:56:41 +1000 Subject: [PATCH] Try workaround for xclim KS test --- notebooks/fidelity.ipynb | 3741 +++++++++++++++++++++++++++++++++++--- 1 file changed, 3501 insertions(+), 240 deletions(-) diff --git a/notebooks/fidelity.ipynb b/notebooks/fidelity.ipynb index 75c2a3b..7a8beef 100644 --- a/notebooks/fidelity.ipynb +++ b/notebooks/fidelity.ipynb @@ -2,33 +2,74 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "dfd8226f-8ee0-4f97-8970-560587d9cba3", "metadata": { "tags": [] }, "outputs": [], "source": [ - "i#mport sys\n", - "#sys.path.insert(0, '/home/599/dbi599/unseen')" + "import sys\n", + "sys.path.append('../unseen')\n", + "\n", + "import numpy as np\n", + "from dask.distributed import Client, LocalCluster\n", + "import xclim.analog\n", + "\n", + "import myfuncs" ] }, { "cell_type": "code", - "execution_count": 3, - "id": "induced-denver", + "execution_count": 2, + "id": "a098cd10", "metadata": {}, "outputs": [], "source": [ - "import xarray as xr\n", - "import dask\n", - "import itertools\n", - "import dask.bag as db\n", - "import numpy as np\n", - "import xclim.analog\n", - "\n", - "import preprocess_obs\n", - "import myfuncs" + "cluster = LocalCluster()\n", + "client = Client(cluster)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "6918a64e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "
\n", + "

Client

\n", + "\n", + "
\n", + "

Cluster

\n", + "
    \n", + "
  • Workers: 4
  • \n", + "
  • Cores: 8
  • \n", + "
  • Memory: 28.00 GiB
  • \n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "client" ] }, { @@ -36,7 +77,7 @@ "id": "unusual-platform", "metadata": {}, "source": [ - "## Read and stack data" + "## Read data" ] }, { @@ -402,28 +443,23 @@ " fill: currentColor;\n", "}\n", "
<xarray.Dataset>\n",
-       "Dimensions:    (ensemble: 96, init_date: 4, lead_time: 3650)\n",
+       "Dimensions:    (ensemble: 96, init_date: 2, lead_time: 3650)\n",
        "Coordinates:\n",
        "  * ensemble   (ensemble) int64 1 2 3 4 5 6 7 8 9 ... 88 89 90 91 92 93 94 95 96\n",
-       "  * init_date  (init_date) datetime64[ns] 1990-11-01 1991-11-01 ... 1993-11-01\n",
+       "  * init_date  (init_date) object 1991-11-01 00:00:00 1992-11-01 00:00:00\n",
        "  * lead_time  (lead_time) int64 0 1 2 3 4 5 6 ... 3644 3645 3646 3647 3648 3649\n",
-       "    time       (lead_time, init_date) datetime64[ns] dask.array<chunksize=(3650, 4), meta=np.ndarray>\n",
+       "    time       (lead_time, init_date) object dask.array<chunksize=(3650, 2), meta=np.ndarray>\n",
        "Data variables:\n",
-       "    precip     (init_date, lead_time, ensemble) float64 dask.array<chunksize=(4, 3650, 96), meta=np.ndarray>\n",
+       "    pr         (init_date, lead_time, ensemble) float64 dask.array<chunksize=(2, 3650, 96), meta=np.ndarray>\n",
        "Attributes:\n",
-       "    comment:    pressure level interpolator, version 3.0, precision=double\n",
-       "    filename:   atmos_isobaric_daily.zarr\n",
-       "    grid_tile:  N/A\n",
-       "    grid_type:  regular\n",
-       "    history:    Thu Jun 10 15:27:22 2021: /g/data/e14/dbi599/miniconda3/envs/...\n",
-       "    title:      AccessOcean-AM2
" ], "text/plain": [ - "\n", - "array(['1990-11-01T00:00:00.000000000', '1991-11-01T00:00:00.000000000',\n", - " '1992-11-01T00:00:00.000000000', '1993-11-01T00:00:00.000000000'],\n", - " dtype='datetime64[ns]')\n", + "\n", + "Dimensions: (time: 730)\n", "Coordinates:\n", - " * init_date (init_date) datetime64[ns] 1990-11-01 1991-11-01 ... 1993-11-01" + " * time (time) object 1991-01-01 09:00:00 ... 1992-12-31 09:00:00\n", + "Data variables:\n", + " pr (time) float64 dask.array\n", + "Attributes:\n", + " history: Tue Jun 22 17:00:09 2021: /g/data/e14/dbi599/miniconda3/envs/un..." ] }, "execution_count": 5, @@ -934,45 +1011,33 @@ } ], "source": [ - "ds_cafe['init_date']" + "awap_file = '/g/data/xv83/dbi599/pr_awap_cafe-grid-TAS-POINT.zarr.zip'\n", + "ds_awap = myfuncs.open_file(awap_file, sel={'time': slice('1991-01-01', '1992-12-31')})\n", + "ds_awap" + ] + }, + { + "cell_type": "markdown", + "id": "primary-palace", + "metadata": {}, + "source": [ + "## K-S test" ] }, { "cell_type": "code", "execution_count": 6, - "id": "33bc5714", + "id": "6225c45b", "metadata": {}, "outputs": [], "source": [ - "#def resample_forecasts_monthly(ds, n_months, end_month, method='sum', \n", - "# lead_time_func='max'):\n", - "# \"\"\" Resample forecasts to a set of months for each year\"\"\"\n", - "# def _resample_grouped_monthly_forecasts(ds, method):\n", - "# month = np.unique(ds.init_date.dt.month)\n", - "# assert len(month) == 1\n", - "# start_month = (end_month - (n_months-1)) % 12\n", - "# i_start = (start_month - month[0]) % 12\n", - "# rs = ds.isel(lead_time=slice(i_start, None)).coarsen(\n", - "# lead_time=n_months, boundary='trim',\n", - "# coord_func={'lead_time': lead_time_func, \n", - "# 'time': 'max'})\n", - "# if method == 'sum':\n", - "# return rs.sum()\n", - "# elif method == 'mean':\n", - "# return rs.mean()\n", - "# else:\n", - "# raise InputError('Unrecognised method')\n", - "# \n", - "# rs = ds.groupby('init_date.month').map(\n", - "# _resample_grouped_monthly_forecasts, method=method)\n", - "# rs['time'].attrs = ds['time'].attrs\n", - "# return rs" + "fcst_stacked = ds_cafe.stack({'sample': ['ensemble', 'init_date', 'lead_time']})" ] }, { "cell_type": "code", "execution_count": 7, - "id": "advanced-outdoors", + "id": "08a6f3f6", "metadata": {}, "outputs": [ { @@ -1330,22 +1395,17 @@ " fill: currentColor;\n", "}\n", "
<xarray.Dataset>\n",
-       "Dimensions:    (sample: 1401600)\n",
+       "Dimensions:    (sample: 700800)\n",
        "Coordinates:\n",
-       "    time       (sample) datetime64[ns] dask.array<chunksize=(1401600,), meta=np.ndarray>\n",
+       "    time       (sample) object dask.array<chunksize=(700800,), meta=np.ndarray>\n",
        "  * sample     (sample) MultiIndex\n",
        "  - ensemble   (sample) int64 1 1 1 1 1 1 1 1 1 1 ... 96 96 96 96 96 96 96 96 96\n",
-       "  - init_date  (sample) datetime64[ns] 1990-11-01 1990-11-01 ... 1993-11-01\n",
+       "  - init_date  (sample) object 1991-11-01 00:00:00 ... 1992-11-01 00:00:00\n",
        "  - lead_time  (sample) int64 0 1 2 3 4 5 6 ... 3644 3645 3646 3647 3648 3649\n",
        "Data variables:\n",
-       "    precip     (sample) float64 dask.array<chunksize=(1401600,), meta=np.ndarray>\n",
+       "    pr         (sample) float64 dask.array<chunksize=(700800,), meta=np.ndarray>\n",
        "Attributes:\n",
-       "    comment:    pressure level interpolator, version 3.0, precision=double\n",
-       "    filename:   atmos_isobaric_daily.zarr\n",
-       "    grid_tile:  N/A\n",
-       "    grid_type:  regular\n",
-       "    history:    Thu Jun 10 15:27:22 2021: /g/data/e14/dbi599/miniconda3/envs/...\n",
-       "    title:      AccessOcean-AM2
" ], "text/plain": [ "\n", - "Dimensions: (sample: 1401600)\n", + "Dimensions: (sample: 700800)\n", "Coordinates:\n", - " time (sample) datetime64[ns] dask.array\n", + " time (sample) object dask.array\n", " * sample (sample) MultiIndex\n", " - ensemble (sample) int64 1 1 1 1 1 1 1 1 1 1 ... 96 96 96 96 96 96 96 96 96\n", - " - init_date (sample) datetime64[ns] 1990-11-01 1990-11-01 ... 1993-11-01\n", + " - init_date (sample) object 1991-11-01 00:00:00 ... 1992-11-01 00:00:00\n", " - lead_time (sample) int64 0 1 2 3 4 5 6 ... 3644 3645 3646 3647 3648 3649\n", "Data variables:\n", - " precip (sample) float64 dask.array\n", + " pr (sample) float64 dask.array\n", "Attributes:\n", - " comment: pressure level interpolator, version 3.0, precision=double\n", - " filename: atmos_isobaric_daily.zarr\n", - " grid_tile: N/A\n", - " grid_type: regular\n", - " history: Thu Jun 10 15:27:22 2021: /g/data/e14/dbi599/miniconda3/envs/...\n", - " title: AccessOcean-AM2" + " history: Wed Jun 23 13:32:39 2021: /g/data/e14/dbi599/miniconda3/envs/un..." ] }, "execution_count": 7, @@ -1451,34 +1516,23 @@ } ], "source": [ - "fcst_stacked = ds_cafe.stack({'sample': ['ensemble', 'init_date', 'lead_time']})\n", "fcst_stacked" ] }, { "cell_type": "code", "execution_count": 8, - "id": "polyphonic-serum", + "id": "93a637a8", "metadata": {}, "outputs": [], "source": [ - "#ds_stacked = ds_stacked.assign_coords({'time': ds_stacked['time']})" + "fcst_stacked['sample'] = np.arange(fcst_stacked['sample'].size)" ] }, { "cell_type": "code", "execution_count": 9, - "id": "fourth-hearing", - "metadata": {}, - "outputs": [], - "source": [ - "awap_file = '/g/data/xv83/ds0092/data/csiro-dcfp-csiro-awap/rain_day_19000101-20201202_cafe-grid.zarr/'" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "alike-bridges", + "id": "52cd3d9c", "metadata": {}, "outputs": [ { @@ -1836,18 +1890,14 @@ " fill: currentColor;\n", "}\n", "
<xarray.Dataset>\n",
-       "Dimensions:  (time: 1460)\n",
+       "Dimensions:  (sample: 700800)\n",
        "Coordinates:\n",
-       "  * time     (time) object 1990-01-01 09:00:00 ... 1993-12-31 09:00:00\n",
+       "    time     (sample) object dask.array<chunksize=(700800,), meta=np.ndarray>\n",
+       "  * sample   (sample) int64 0 1 2 3 4 5 ... 700795 700796 700797 700798 700799\n",
        "Data variables:\n",
-       "    precip   (time) float64 dask.array<chunksize=(1460,), meta=np.ndarray>
" + "
  • history :
    Wed Jun 23 13:32:39 2021: /g/data/e14/dbi599/miniconda3/envs/unseen/bin/jupyter notebook /home/599/dbi599/unseen/notebooks/bias_correction.ipynb\n", + "History of /g/data/xv83/dbi599/pr_cafe-c5-d60-pX-f6_19911101-19921101_3650D_cafe-grid-TAS-POINT.zarr.zip: \n", + " Wed Jun 23 11:28:12 2021: /g/data/e14/dbi599/miniconda3/envs/unseen/bin/python unseen/preprocess.py /g/data/xv83/ds0092/CAFE/forecasts/f6/WIP/c5-d60-pX-f6-19911101/ZARR/atmos_isobaric_daily.zarr.zip /g/data/xv83/ds0092/CAFE/forecasts/f6/WIP/c5-d60-pX-f6-19921101/ZARR/atmos_isobaric_daily.zarr.zip forecast /g/data/xv83/dbi599/pr_cafe-c5-d60-pX-f6_19911101-19921101_3650D_cafe-grid-TAS-POINT.zarr.zip --metadata_file config/dataset_cafe.yml --variables pr --no_leap_days --region TAS-POINT --units pr=mm/day --output_chunks lead_time=50 --dask_config config/dask_local.yml\n", + "History of /g/data/xv83/dbi599/pr_awap_cafe-grid-TAS-POINT.zarr.zip: \n", + " Tue Jun 22 17:00:09 2021: /g/data/e14/dbi599/miniconda3/envs/unseen/bin/jupyter notebook /home/599/dbi599/unseen/notebooks/preprocess.ipynb
  • " ], "text/plain": [ "\n", - "Dimensions: (time: 1460)\n", + "Dimensions: (sample: 700800)\n", "Coordinates:\n", - " * time (time) object 1990-01-01 09:00:00 ... 1993-12-31 09:00:00\n", + " time (sample) object dask.array\n", + " * sample (sample) int64 0 1 2 3 4 5 ... 700795 700796 700797 700798 700799\n", "Data variables:\n", - " precip (time) float64 dask.array" + " pr (sample) float64 dask.array\n", + "Attributes:\n", + " history: Wed Jun 23 13:32:39 2021: /g/data/e14/dbi599/miniconda3/envs/un..." ] }, - "execution_count": 17, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "ds_awap = myfuncs.open_file(awap_file, variables=['precip'], no_leap_days=True,\n", - " region='TAS-POINT')\n", - "#units={'precip': 'mm/day'}\n", - "ds_awap = ds_awap.sel(time=slice('1990-01-01', '1993-12-31'))\n", - "ds_awap" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "fb8d3704", - "metadata": {}, - "outputs": [], - "source": [ - "obs_stacked = ds_awap.stack(sample=['time'])" + "fcst_stacked" ] }, { "cell_type": "code", - "execution_count": 19, - "id": "256d26c7", + "execution_count": 13, + "id": "78bb67cc", "metadata": {}, "outputs": [ { @@ -2277,26 +2355,13 @@ " fill: currentColor;\n", "}\n", "
    <xarray.Dataset>\n",
    -       "Dimensions:  (sample: 1460)\n",
    +       "Dimensions:  (sample: 730)\n",
            "Coordinates:\n",
    -       "  * sample   (sample) MultiIndex\n",
    -       "  - time     (sample) object 1990-01-01 09:00:00 ... 1993-12-31 09:00:00\n",
    +       "  * sample   (sample) int64 0 1 2 3 4 5 6 7 ... 722 723 724 725 726 727 728 729\n",
            "Data variables:\n",
    -       "    precip   (sample) float64 dask.array<chunksize=(1460,), meta=np.ndarray>
    " + "
  • history :
    Tue Jun 22 17:00:09 2021: /g/data/e14/dbi599/miniconda3/envs/unseen/bin/jupyter notebook /home/599/dbi599/unseen/notebooks/preprocess.ipynb
  • " ], "text/plain": [ "\n", - "Dimensions: (sample: 1460)\n", + "Dimensions: (sample: 730)\n", "Coordinates:\n", - " * sample (sample) MultiIndex\n", - " - time (sample) object 1990-01-01 09:00:00 ... 1993-12-31 09:00:00\n", + " * sample (sample) int64 0 1 2 3 4 5 6 7 ... 722 723 724 725 726 727 728 729\n", "Data variables:\n", - " precip (sample) float64 dask.array" + " pr (sample) float64 dask.array\n", + "Attributes:\n", + " history: Tue Jun 22 17:00:09 2021: /g/data/e14/dbi599/miniconda3/envs/un..." ] }, - "execution_count": 19, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "obs_stacked" + "awap_faux_stacked = ds_awap.rename(time='sample')\n", + "awap_faux_stacked['sample'] = np.arange(awap_faux_stacked['sample'].size)\n", + "awap_faux_stacked" ] }, { - "cell_type": "markdown", - "id": "primary-palace", + "cell_type": "code", + "execution_count": 22, + "id": "7aa5373a", "metadata": {}, + "outputs": [], "source": [ - "## Fidelity test" + "test = xclim.analog.spatial_analogs(target=awap_faux_stacked,\n", + " candidates=fcst_stacked.isel({'sample': slice(0, 730)}),\n", + " dist_dim=['sample'],\n", + " method='kolmogorov_smirnov')" ] }, { "cell_type": "code", - "execution_count": 12, - "id": "2a3a0aad", + "execution_count": 19, + "id": "7bc1306b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'0.27.0'" + "array(0.3260274)" ] }, - "execution_count": 12, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "xclim.__version__" + "test.values" ] }, { - "cell_type": "code", - "execution_count": 23, - "id": "7aa5373a", + "cell_type": "markdown", + "id": "be57ca1f", "metadata": {}, - "outputs": [ - { + "source": [ + "TODO: To look at the whole stacked forecast array we'd need to pad the observations with zeros so the sample dimension was the same size, or stack the obs by init_date and lead_time and then duplicate for the number of ensemble members..." + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "2fec9740", + "metadata": {}, + "outputs": [ + { "ename": "ValueError", - "evalue": "Names should be list-like for a MultiIndex", + "evalue": "indexes along dimension 'dist' are not equal", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m test = xclim.analog.spatial_analogs(target=obs_stacked,\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mcandidates\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mobs_stacked\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mdist_dim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'sample'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m method='kolmogorov_smirnov')\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/xclim/analog.py\u001b[0m in \u001b[0;36mspatial_analogs\u001b[0;34m(target, candidates, dist_dim, method, **kwargs)\u001b[0m\n\u001b[1;32m 124\u001b[0m \u001b[0mxr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDataArray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtarget\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata_vars\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdims\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"indices\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"indices\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 125\u001b[0m )\n\u001b[0;32m--> 126\u001b[0;31m \u001b[0mtarget\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtarget\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstack\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdist\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdist_dim\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 127\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[0;31m# Create the target DataArray:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/xarray/core/dataarray.py\u001b[0m in \u001b[0;36mstack\u001b[0;34m(self, dimensions, **dimensions_kwargs)\u001b[0m\n\u001b[1;32m 2070\u001b[0m \u001b[0mDataArray\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munstack\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2071\u001b[0m \"\"\"\n\u001b[0;32m-> 2072\u001b[0;31m \u001b[0mds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_to_temp_dataset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstack\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdimensions\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mdimensions_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2073\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_from_temp_dataset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2074\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/xarray/core/dataset.py\u001b[0m in \u001b[0;36mstack\u001b[0;34m(self, dimensions, **dimensions_kwargs)\u001b[0m\n\u001b[1;32m 3774\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3775\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mnew_dim\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdims\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdimensions\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3776\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_stack_once\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdims\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnew_dim\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3777\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3778\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/xarray/core/dataset.py\u001b[0m in \u001b[0;36m_stack_once\u001b[0;34m(self, dims, new_dim)\u001b[0m\n\u001b[1;32m 3727\u001b[0m \u001b[0;31m# consider dropping levels that are unused?\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3728\u001b[0m \u001b[0mlevels\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdim\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mdim\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdims\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3729\u001b[0;31m \u001b[0midx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutils\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmultiindex_from_product_levels\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlevels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnames\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdims\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3730\u001b[0m \u001b[0mvariables\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mnew_dim\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mIndexVariable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnew_dim\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0midx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3731\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/xarray/core/utils.py\u001b[0m in \u001b[0;36mmultiindex_from_product_levels\u001b[0;34m(levels, names)\u001b[0m\n\u001b[1;32m 140\u001b[0m \u001b[0mlabels_mesh\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmeshgrid\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0msplit_labels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindexing\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"ij\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mlabels_mesh\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 142\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mMultiIndex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlevels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msortorder\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnames\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnames\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 143\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/pandas/core/indexes/multi.py\u001b[0m in \u001b[0;36m__new__\u001b[0;34m(cls, levels, codes, sortorder, names, dtype, copy, name, verify_integrity)\u001b[0m\n\u001b[1;32m 314\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 315\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mverify_integrity\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 316\u001b[0;31m \u001b[0mnew_codes\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_verify_integrity\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 317\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_codes\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnew_codes\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 318\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/pandas/core/indexes/multi.py\u001b[0m in \u001b[0;36m_verify_integrity\u001b[0;34m(self, codes, levels)\u001b[0m\n\u001b[1;32m 367\u001b[0m \u001b[0;31m# nlevels matches nor that sortorder matches actually sortorder.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 368\u001b[0m \u001b[0mcodes\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcodes\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcodes\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 369\u001b[0;31m \u001b[0mlevels\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlevels\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlevels\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 370\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 371\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlevels\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcodes\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32mpandas/_libs/properties.pyx\u001b[0m in \u001b[0;36mpandas._libs.properties.CachedProperty.__get__\u001b[0;34m()\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/pandas/core/indexes/multi.py\u001b[0m in \u001b[0;36mlevels\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 722\u001b[0m \u001b[0;31m# create new IndexEngine\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 723\u001b[0m \u001b[0;31m# https://github.com/pandas-dev/pandas/issues/31648\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 724\u001b[0;31m result = [\n\u001b[0m\u001b[1;32m 725\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_shallow_copy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_levels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_names\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 726\u001b[0m ]\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/pandas/core/indexes/multi.py\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 723\u001b[0m \u001b[0;31m# https://github.com/pandas-dev/pandas/issues/31648\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 724\u001b[0m result = [\n\u001b[0;32m--> 725\u001b[0;31m \u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_shallow_copy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_levels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_names\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 726\u001b[0m ]\n\u001b[1;32m 727\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mlevel\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/pandas/core/indexes/multi.py\u001b[0m in \u001b[0;36m_shallow_copy\u001b[0;34m(self, values, name)\u001b[0m\n\u001b[1;32m 1093\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_tuples\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msortorder\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnames\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnames\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1094\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1095\u001b[0;31m result = type(self)(\n\u001b[0m\u001b[1;32m 1096\u001b[0m \u001b[0mlevels\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlevels\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1097\u001b[0m \u001b[0mcodes\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcodes\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/pandas/core/indexes/multi.py\u001b[0m in \u001b[0;36m__new__\u001b[0;34m(cls, levels, codes, sortorder, names, dtype, copy, name, verify_integrity)\u001b[0m\n\u001b[1;32m 306\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mnames\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 307\u001b[0m \u001b[0;31m# handles name validation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 308\u001b[0;31m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_set_names\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnames\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 309\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 310\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msortorder\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/test/lib/python3.9/site-packages/pandas/core/indexes/multi.py\u001b[0m in \u001b[0;36m_set_names\u001b[0;34m(self, names, level, validate)\u001b[0m\n\u001b[1;32m 1424\u001b[0m \u001b[0;31m# Don't allow a single string for names in a MultiIndex\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1425\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mnames\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mis_list_like\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnames\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1426\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Names should be list-like for a MultiIndex\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1427\u001b[0m \u001b[0mnames\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnames\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1428\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mValueError\u001b[0m: Names should be list-like for a MultiIndex" + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m xclim.analog.spatial_analogs(target=awap_faux_stacked,\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mcandidates\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfcst_stacked\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mdist_dim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'sample'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m method='kolmogorov_smirnov')\n", + "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/unseen/lib/python3.9/site-packages/xclim/analog.py\u001b[0m in \u001b[0;36mspatial_analogs\u001b[0;34m(target, candidates, dist_dim, method, **kwargs)\u001b[0m\n\u001b[1;32m 143\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[0;31m# Compute dissimilarity\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 145\u001b[0;31m diss = xr.apply_ufunc(\n\u001b[0m\u001b[1;32m 146\u001b[0m \u001b[0mmetric\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 147\u001b[0m \u001b[0mtarget\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/unseen/lib/python3.9/site-packages/xarray/core/computation.py\u001b[0m in \u001b[0;36mapply_ufunc\u001b[0;34m(func, input_core_dims, output_core_dims, exclude_dims, vectorize, join, dataset_join, dataset_fill_value, keep_attrs, kwargs, dask, output_dtypes, output_sizes, meta, dask_gufunc_kwargs, *args)\u001b[0m\n\u001b[1;32m 1169\u001b[0m \u001b[0;31m# feed DataArray apply_variable_ufunc through apply_dataarray_vfunc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1170\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0many\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDataArray\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0ma\u001b[0m \u001b[0;32min\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1171\u001b[0;31m return apply_dataarray_vfunc(\n\u001b[0m\u001b[1;32m 1172\u001b[0m \u001b[0mvariables_vfunc\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1173\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/unseen/lib/python3.9/site-packages/xarray/core/computation.py\u001b[0m in \u001b[0;36mapply_dataarray_vfunc\u001b[0;34m(func, signature, join, exclude_dims, keep_attrs, *args)\u001b[0m\n\u001b[1;32m 270\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 271\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 272\u001b[0;31m args = deep_align(\n\u001b[0m\u001b[1;32m 273\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mjoin\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexclude\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mexclude_dims\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mraise_on_invalid\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 274\u001b[0m )\n", + "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/unseen/lib/python3.9/site-packages/xarray/core/alignment.py\u001b[0m in \u001b[0;36mdeep_align\u001b[0;34m(objects, join, copy, indexes, exclude, raise_on_invalid, fill_value)\u001b[0m\n\u001b[1;32m 425\u001b[0m \u001b[0mout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvariables\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 426\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 427\u001b[0;31m aligned = align(\n\u001b[0m\u001b[1;32m 428\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mtargets\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 429\u001b[0m \u001b[0mjoin\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/g/data/e14/dbi599/miniconda3/envs/unseen/lib/python3.9/site-packages/xarray/core/alignment.py\u001b[0m in \u001b[0;36malign\u001b[0;34m(join, copy, indexes, exclude, fill_value, *objects)\u001b[0m\n\u001b[1;32m 321\u001b[0m ):\n\u001b[1;32m 322\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mjoin\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"exact\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 323\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"indexes along dimension {dim!r} are not equal\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 324\u001b[0m \u001b[0mjoiner\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_get_joiner\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmatching_indexes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 325\u001b[0m \u001b[0mindex\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mjoiner\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmatching_indexes\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mValueError\u001b[0m: indexes along dimension 'dist' are not equal" ] } ], "source": [ - "test = xclim.analog.spatial_analogs(target=obs_stacked,\n", - " candidates=obs_stacked,\n", - " dist_dim='sample',\n", - " method='kolmogorov_smirnov')" + "xclim.analog.spatial_analogs(target=awap_faux_stacked,\n", + " candidates=fcst_stacked,\n", + " dist_dim=['sample'],\n", + " method='kolmogorov_smirnov')" + ] + }, + { + "cell_type": "markdown", + "id": "ff675987", + "metadata": {}, + "source": [ + "## Temporal resampling" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "33bc5714", + "metadata": {}, + "outputs": [], + "source": [ + "def resample_forecasts_monthly(ds, n_months, end_month, method='sum', \n", + " lead_time_func='max'):\n", + " \"\"\" Resample forecasts to a set of months for each year\"\"\"\n", + " def _resample_grouped_monthly_forecasts(ds, method):\n", + " month = np.unique(ds.init_date.dt.month)\n", + " assert len(month) == 1\n", + " start_month = (end_month - (n_months-1)) % 12\n", + " i_start = (start_month - month[0]) % 12\n", + " rs = ds.isel(lead_time=slice(i_start, None)).coarsen(\n", + " lead_time=n_months, boundary='trim',\n", + " coord_func={'lead_time': lead_time_func, \n", + " 'time': 'max'})\n", + " if method == 'sum':\n", + " return rs.sum()\n", + " elif method == 'mean':\n", + " return rs.mean()\n", + " else:\n", + " raise InputError('Unrecognised method')\n", + " \n", + " rs = ds.groupby('init_date.month').map(\n", + " _resample_grouped_monthly_forecasts, method=method)\n", + " rs['time'].attrs = ds['time'].attrs\n", + " return rs" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "8706e658", + "metadata": {}, + "outputs": [], + "source": [ + "N_MONTHS = 3\n", + "END_MONTH = 11\n", + "ACC_METHOD = 'sum'\n", + "OBS_METHOD = 'Q-NOV'\n", + "\n", + "fcst_acc = resample_forecasts_monthly(ds_cafe,\n", + " n_months=N_MONTHS,\n", + " end_month=END_MONTH,\n", + " lead_time_func='max', #max_month_to_year,\n", + " method=ACC_METHOD)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "aa0b752b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
    \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
    <xarray.DataArray 'lead_time' (lead_time: 3650)>\n",
    +       "array([   0,    1,    2, ..., 3647, 3648, 3649])\n",
    +       "Coordinates:\n",
    +       "  * lead_time  (lead_time) int64 0 1 2 3 4 5 6 ... 3644 3645 3646 3647 3648 3649\n",
    +       "Attributes:\n",
    +       "    units:    D
    " + ], + "text/plain": [ + "\n", + "array([ 0, 1, 2, ..., 3647, 3648, 3649])\n", + "Coordinates:\n", + " * lead_time (lead_time) int64 0 1 2 3 4 5 6 ... 3644 3645 3646 3647 3648 3649\n", + "Attributes:\n", + " units: D" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ds_cafe['lead_time']" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "035cc361", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
    \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
    <xarray.DataArray 'lead_time' (lead_time: 1213)>\n",
    +       "array([  12,   15,   18, ..., 3642, 3645, 3648])\n",
    +       "Coordinates:\n",
    +       "  * lead_time  (lead_time) int64 12 15 18 21 24 27 ... 3636 3639 3642 3645 3648\n",
    +       "Attributes:\n",
    +       "    units:    D
    " + ], + "text/plain": [ + "\n", + "array([ 12, 15, 18, ..., 3642, 3645, 3648])\n", + "Coordinates:\n", + " * lead_time (lead_time) int64 12 15 18 21 24 27 ... 3636 3639 3642 3645 3648\n", + "Attributes:\n", + " units: D" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fcst_acc['lead_time']" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "388cd379", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([cftime.datetime(1991, 11, 13, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 11, 16, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 11, 19, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 11, 22, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 11, 25, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 11, 28, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 12, 1, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 12, 4, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 12, 7, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False),\n", + " cftime.datetime(1991, 12, 10, 0, 0, 0, 0, calendar='proleptic_gregorian', has_year_zero=False)],\n", + " dtype=object)" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fcst_acc['time'][0:10, 0].values" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "6b77e498", + "metadata": {}, + "outputs": [], + "source": [ + "obsv_acc = getattr(ds_awap.resample(time=OBS_METHOD), ACC_METHOD)()" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "98694cf5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
    \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
    <xarray.DataArray 'time' (time: 9)>\n",
    +       "array([cftime.DatetimeProlepticGregorian(1991, 2, 28, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1991, 5, 31, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1991, 8, 31, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1991, 11, 30, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1992, 2, 29, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1992, 5, 31, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1992, 8, 31, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1992, 11, 30, 0, 0, 0, 0, has_year_zero=False),\n",
    +       "       cftime.DatetimeProlepticGregorian(1993, 2, 28, 0, 0, 0, 0, has_year_zero=False)],\n",
    +       "      dtype=object)\n",
    +       "Coordinates:\n",
    +       "  * time     (time) object 1991-02-28 00:00:00 ... 1993-02-28 00:00:00
    " + ], + "text/plain": [ + "\n", + "array([cftime.DatetimeProlepticGregorian(1991, 2, 28, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1991, 5, 31, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1991, 8, 31, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1991, 11, 30, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1992, 2, 29, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1992, 5, 31, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1992, 8, 31, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1992, 11, 30, 0, 0, 0, 0, has_year_zero=False),\n", + " cftime.DatetimeProlepticGregorian(1993, 2, 28, 0, 0, 0, 0, has_year_zero=False)],\n", + " dtype=object)\n", + "Coordinates:\n", + " * time (time) object 1991-02-28 00:00:00 ... 1993-02-28 00:00:00" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "obsv_acc['time']" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "26edff4c", + "metadata": {}, + "outputs": [], + "source": [ + "fcst_acc = fcst_acc.where(fcst_acc.time.dt.month == END_MONTH, drop=True)\n", + "obsv_acc = obsv_acc.where(obsv_acc.time.dt.month == END_MONTH, drop=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "1e2e6468", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
    \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
    <xarray.Dataset>\n",
    +       "Dimensions:    (ensemble: 96, init_date: 4, lead_time: 98)\n",
    +       "Coordinates:\n",
    +       "  * ensemble   (ensemble) int64 1 2 3 4 5 6 7 8 9 ... 88 89 90 91 92 93 94 95 96\n",
    +       "  * init_date  (init_date) datetime64[ns] 1990-11-01 1991-11-01 ... 1993-11-01\n",
    +       "  * lead_time  (lead_time) int64 12 15 18 21 24 27 ... 3303 3306 3309 3312 3315\n",
    +       "    time       (lead_time, init_date) datetime64[ns] dask.array<chunksize=(98, 4), meta=np.ndarray>\n",
    +       "Data variables:\n",
    +       "    precip     (init_date, lead_time, ensemble) float64 dask.array<chunksize=(4, 98, 96), meta=np.ndarray>\n",
    +       "Attributes:\n",
    +       "    comment:    pressure level interpolator, version 3.0, precision=double\n",
    +       "    filename:   atmos_isobaric_daily.zarr\n",
    +       "    grid_tile:  N/A\n",
    +       "    grid_type:  regular\n",
    +       "    history:    Thu Jun 10 15:27:22 2021: /g/data/e14/dbi599/miniconda3/envs/...\n",
    +       "    title:      AccessOcean-AM2
    " + ], + "text/plain": [ + "\n", + "Dimensions: (ensemble: 96, init_date: 4, lead_time: 98)\n", + "Coordinates:\n", + " * ensemble (ensemble) int64 1 2 3 4 5 6 7 8 9 ... 88 89 90 91 92 93 94 95 96\n", + " * init_date (init_date) datetime64[ns] 1990-11-01 1991-11-01 ... 1993-11-01\n", + " * lead_time (lead_time) int64 12 15 18 21 24 27 ... 3303 3306 3309 3312 3315\n", + " time (lead_time, init_date) datetime64[ns] dask.array\n", + "Data variables:\n", + " precip (init_date, lead_time, ensemble) float64 dask.array\n", + "Attributes:\n", + " comment: pressure level interpolator, version 3.0, precision=double\n", + " filename: atmos_isobaric_daily.zarr\n", + " grid_tile: N/A\n", + " grid_type: regular\n", + " history: Thu Jun 10 15:27:22 2021: /g/data/e14/dbi599/miniconda3/envs/...\n", + " title: AccessOcean-AM2" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fcst_acc" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "e4d9bb18", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
    \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
    <xarray.Dataset>\n",
    +       "Dimensions:  (time: 4)\n",
    +       "Coordinates:\n",
    +       "  * time     (time) object 1990-11-30 00:00:00 ... 1993-11-30 00:00:00\n",
    +       "Data variables:\n",
    +       "    precip   (time) float64 dask.array<chunksize=(1,), meta=np.ndarray>
    " + ], + "text/plain": [ + "\n", + "Dimensions: (time: 4)\n", + "Coordinates:\n", + " * time (time) object 1990-11-30 00:00:00 ... 1993-11-30 00:00:00\n", + "Data variables:\n", + " precip (time) float64 dask.array" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "obsv_acc" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "advanced-outdoors", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
    \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
    <xarray.Dataset>\n",
    +       "Dimensions:    (sample: 1401600)\n",
    +       "Coordinates:\n",
    +       "    time       (sample) datetime64[ns] dask.array<chunksize=(1401600,), meta=np.ndarray>\n",
    +       "  * sample     (sample) MultiIndex\n",
    +       "  - ensemble   (sample) int64 1 1 1 1 1 1 1 1 1 1 ... 96 96 96 96 96 96 96 96 96\n",
    +       "  - init_date  (sample) datetime64[ns] 1990-11-01 1990-11-01 ... 1993-11-01\n",
    +       "  - lead_time  (sample) int64 0 1 2 3 4 5 6 ... 3644 3645 3646 3647 3648 3649\n",
    +       "Data variables:\n",
    +       "    precip     (sample) float64 dask.array<chunksize=(1401600,), meta=np.ndarray>\n",
    +       "Attributes:\n",
    +       "    comment:    pressure level interpolator, version 3.0, precision=double\n",
    +       "    filename:   atmos_isobaric_daily.zarr\n",
    +       "    grid_tile:  N/A\n",
    +       "    grid_type:  regular\n",
    +       "    history:    Thu Jun 10 15:27:22 2021: /g/data/e14/dbi599/miniconda3/envs/...\n",
    +       "    title:      AccessOcean-AM2
    " + ], + "text/plain": [ + "\n", + "Dimensions: (sample: 1401600)\n", + "Coordinates:\n", + " time (sample) datetime64[ns] dask.array\n", + " * sample (sample) MultiIndex\n", + " - ensemble (sample) int64 1 1 1 1 1 1 1 1 1 1 ... 96 96 96 96 96 96 96 96 96\n", + " - init_date (sample) datetime64[ns] 1990-11-01 1990-11-01 ... 1993-11-01\n", + " - lead_time (sample) int64 0 1 2 3 4 5 6 ... 3644 3645 3646 3647 3648 3649\n", + "Data variables:\n", + " precip (sample) float64 dask.array\n", + "Attributes:\n", + " comment: pressure level interpolator, version 3.0, precision=double\n", + " filename: atmos_isobaric_daily.zarr\n", + " grid_tile: N/A\n", + " grid_type: regular\n", + " history: Thu Jun 10 15:27:22 2021: /g/data/e14/dbi599/miniconda3/envs/...\n", + " title: AccessOcean-AM2" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fcst_stacked = ds_cafe.stack({'sample': ['ensemble', 'init_date', 'lead_time']})\n", + "fcst_stacked" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "polyphonic-serum", + "metadata": {}, + "outputs": [], + "source": [ + "#ds_stacked = ds_stacked.assign_coords({'time': ds_stacked['time']})" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "fourth-hearing", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "fb8d3704", + "metadata": {}, + "outputs": [], + "source": [ + "obs_stacked = ds_awap.stack(sample=['time'])" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "256d26c7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
    \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
    <xarray.Dataset>\n",
    +       "Dimensions:  (sample: 1460)\n",
    +       "Coordinates:\n",
    +       "  * sample   (sample) MultiIndex\n",
    +       "  - time     (sample) object 1990-01-01 09:00:00 ... 1993-12-31 09:00:00\n",
    +       "Data variables:\n",
    +       "    precip   (sample) float64 dask.array<chunksize=(1460,), meta=np.ndarray>
    " + ], + "text/plain": [ + "\n", + "Dimensions: (sample: 1460)\n", + "Coordinates:\n", + " * sample (sample) MultiIndex\n", + " - time (sample) object 1990-01-01 09:00:00 ... 1993-12-31 09:00:00\n", + "Data variables:\n", + " precip (sample) float64 dask.array" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "obs_stacked" ] }, {