From 6136d3ba209904924f3d2807ec32af242c2c0ac8 Mon Sep 17 00:00:00 2001 From: Carsten Ehbrecht Date: Wed, 6 Dec 2023 16:56:45 +0100 Subject: [PATCH] added nb with 360 day calendar issue --- .../errors/cds-error-process-failed.ipynb | 609 ++++++++++++++++++ 1 file changed, 609 insertions(+) create mode 100644 notebooks/errors/cds-error-process-failed.ipynb diff --git a/notebooks/errors/cds-error-process-failed.ipynb b/notebooks/errors/cds-error-process-failed.ipynb new file mode 100644 index 0000000..0a1cd3c --- /dev/null +++ b/notebooks/errors/cds-error-process-failed.ipynb @@ -0,0 +1,609 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "92cdff97-3c7f-4023-ba6a-a317d201a175", + "metadata": {}, + "source": [ + "# CDS error 2023.12.06: Sorry, process failed\n", + "\n", + "{\"inputs\": {\"pr\": [\"c3s-cmip6.ScenarioMIP.MOHC.HadGEM3-GC31-LL.ssp245.r1i1p1f3.day.pr.gn.v20190908\"]}, \"steps\": {\"subset_pr_1\": {\"run\": \"subset\", \"in\": {\"collection\": \"inputs/pr\", \"time\": \"2015/2099\", \"time_components\": \"year:2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099|month:jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec|day:01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31\", \"area\": \"-30,-70,-24,-60\"}}}, \"outputs\": {\"output\": \"subset_pr_1/output\"}, \"doc\": \"workflow\"}" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "28597968-a168-4bb4-8535-a8f28169d618", + "metadata": {}, + "outputs": [], + "source": [ + "from rooki import operators as ops" + ] + }, + { + "cell_type": "markdown", + "id": "e51adf54-e23a-4151-85fe-eb3d0f64f613", + "metadata": {}, + "source": [ + "## error request" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "d158138c-fb3c-48be-ac25-9c5d99397230", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wf = ops.Subset(\n", + " ops.Input(\n", + " 'pr', ['c3s-cmip6.ScenarioMIP.MOHC.HadGEM3-GC31-LL.ssp245.r1i1p1f3.day.pr.gn.v20190908']\n", + " ),\n", + " area=\"-30,-70,-24,-60\",\n", + " time=\"2015/2015\",\n", + " time_components=\"month:jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec|day:01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31\"\n", + ")\n", + "resp = wf.orchestrate()\n", + "resp.ok" + ] + }, + { + "cell_type": "markdown", + "id": "ab47dc19-87a6-4343-8cc2-f3018d8ee608", + "metadata": {}, + "source": [ + "## Exception in clisops\n", + "\n", + "```\n", + " File \"/usr/local/anaconda/envs/rook/lib/python3.11/site-packages/clisops/ops/subset.py\", line 157, in _calculate\n", + " result = subset_time_by_components(result, time_components=time_comps)\n", + " File \"/usr/local/anaconda/envs/rook/lib/python3.11/site-packages/clisops/core/subset.py\", line 1726, in \n", + " {idx for tc in req_t_comp for idx in t_comp_indices[tc]}\n", + " ~~~~~~~~~~~~~~^^^^\n", + "KeyError: 31\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "8a662eea-2f76-4e99-b5e6-5f3c73eb13e1", + "metadata": {}, + "source": [ + "## modified request\n", + "\n", + "failure due to 360 day calendar." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "f3250be0-67d8-4e4e-809e-ad512e1fc0cd", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "wf = ops.Subset(\n", + " ops.Input(\n", + " 'pr', ['c3s-cmip6.ScenarioMIP.MOHC.HadGEM3-GC31-LL.ssp245.r1i1p1f3.day.pr.gn.v20190908']\n", + " ),\n", + " area=\"-30,-70,-24,-60\",\n", + " time=\"2015/2015\",\n", + ")\n", + "resp = wf.orchestrate()\n", + "resp.ok" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "58487f3c-30b8-4d71-a5bb-6f0bce40a10e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Downloading to /var/folders/qb/mg0csz190wd4rxybhhnwjln80000gn/T/metalink_8blib3sn/pr_day_HadGEM3-GC31-LL_ssp245_r1i1p1f3_gn_20150101-20151230.nc.\n" + ] + }, + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset>\n",
+       "Dimensions:    (time: 360, bnds: 2, lat: 8, lon: 3)\n",
+       "Coordinates:\n",
+       "  * time       (time) object 2015-01-01 12:00:00 ... 2015-12-30 12:00:00\n",
+       "  * lat        (lat) float64 -69.38 -68.12 -66.88 ... -63.12 -61.88 -60.62\n",
+       "  * lon        (lon) float64 330.9 332.8 334.7\n",
+       "Dimensions without coordinates: bnds\n",
+       "Data variables:\n",
+       "    time_bnds  (time, bnds) object ...\n",
+       "    lat_bnds   (lat, bnds) float64 ...\n",
+       "    lon_bnds   (lon, bnds) float64 ...\n",
+       "    pr         (time, lat, lon) float32 ...\n",
+       "Attributes: (12/47)\n",
+       "    Conventions:            CF-1.7 CMIP-6.2\n",
+       "    activity_id:            ScenarioMIP\n",
+       "    branch_method:          standard\n",
+       "    branch_time_in_child:   59400.0\n",
+       "    branch_time_in_parent:  59400.0\n",
+       "    creation_date:          2019-09-06T15:28:52Z\n",
+       "    ...                     ...\n",
+       "    tracking_id:            hdl:21.14100/a87aa417-4042-4cdc-a260-997b693602ad\n",
+       "    variable_id:            pr\n",
+       "    variable_name:          pr\n",
+       "    variant_label:          r1i1p1f3\n",
+       "    license:                CMIP6 model data produced by the Met Office Hadle...\n",
+       "    cmor_version:           3.4.0
" + ], + "text/plain": [ + "\n", + "Dimensions: (time: 360, bnds: 2, lat: 8, lon: 3)\n", + "Coordinates:\n", + " * time (time) object 2015-01-01 12:00:00 ... 2015-12-30 12:00:00\n", + " * lat (lat) float64 -69.38 -68.12 -66.88 ... -63.12 -61.88 -60.62\n", + " * lon (lon) float64 330.9 332.8 334.7\n", + "Dimensions without coordinates: bnds\n", + "Data variables:\n", + " time_bnds (time, bnds) object ...\n", + " lat_bnds (lat, bnds) float64 ...\n", + " lon_bnds (lon, bnds) float64 ...\n", + " pr (time, lat, lon) float32 ...\n", + "Attributes: (12/47)\n", + " Conventions: CF-1.7 CMIP-6.2\n", + " activity_id: ScenarioMIP\n", + " branch_method: standard\n", + " branch_time_in_child: 59400.0\n", + " branch_time_in_parent: 59400.0\n", + " creation_date: 2019-09-06T15:28:52Z\n", + " ... ...\n", + " tracking_id: hdl:21.14100/a87aa417-4042-4cdc-a260-997b693602ad\n", + " variable_id: pr\n", + " variable_name: pr\n", + " variant_label: r1i1p1f3\n", + " license: CMIP6 model data produced by the Met Office Hadle...\n", + " cmor_version: 3.4.0" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dsets = resp.datasets()\n", + "ds = dsets[0]\n", + "ds" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}