8000 Add nb error decadal daily by cehbrecht · Pull Request #203 · roocs/rooki · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "issue-overview",
"metadata": {},
"source": [
"# CMIP6-decadal daily `psl` full-year subset over Europe\n",
"\n",
"This notebook extends the August 1962 error reproduction to request complete years of daily CMIP6-decadal sea-level pressure (`psl`) over Europe. It concatenates the same ten EC-Earth3 realizations initialized in 1961.\n",
"\n",
"The default request covers the complete 1962 calendar year. A multi-year 1962–1968 variant is prepared below and can be selected with one assignment. The returned data are deliberately **not** opened with `resp.datasets()`.\n"
]
},
{
"cell_type": "markdown",
"id": "parameters-heading",
"metadata": {},
"source": [
"## Time and area parameters\n",
"\n",
"Rook's `area` parameter uses `west,south,east,north`. The bounding box below covers Europe from 10°W to 35°E and 30°N to 70°N. Rook handles the longitude conversion for datasets that use `0…360` coordinates.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "request-parameters",
"metadata": {},
"outputs": [],
"source": [
"EUROPE_BBOX = \"-10,30,35,70\"\n",
"SINGLE_YEAR_TIME = \"1962/1962\"\n",
"MULTI_YEAR_TIME = \"1962/1968\"\n"
]
},
{
"cell_type": "markdown",
"id": "single-year-heading",
"metadata": {},
"source": [
"## Complete-year WPS workflow\n",
"\n",
"Unlike the original August-only request, this subset has no `time_components` filter, so it retains every day in 1962.\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "single-year-request",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'inputs': {'psl': ['c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r10i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r1i1p1f1.day.psl.gr.v20201215',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r2i1p1f1.day.psl.gr.v20201215',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r3i1p1f1.day.psl.gr.v20201215',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r4i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r5i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r6i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r7i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r8i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r9i1p1f1.day.psl.gr.v20201216']},\n",
" 'steps': {'concat_psl_1': {'run': 'concat',\n",
" 'in': {'collection': 'inputs/psl', 'dims': 'realization'}},\n", 8000
" 'subset_psl_1': {'run': 'subset',\n",
" 'in': {'collection': 'concat_psl_1/output',\n",
" 'time': '1962/1962',\n",
" 'area': '-10,30,35,70'}}},\n",
" 'outputs': {'output': 'subset_psl_1/output'},\n",
" 'doc': 'workflow'}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"request = {\n",
" \"inputs\": {\n",
" \"psl\": [\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r10i1p1f1.day.psl.gr.v20201216\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r1i1p1f1.day.psl.gr.v20201215\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r2i1p1f1.day.psl.gr.v20201215\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r3i1p1f1.day.psl.gr.v20201215\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r4i1p1f1.day.psl.gr.v20201216\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r5i1p1f1.day.psl.gr.v20201216\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r6i1p1f1.day.psl.gr.v20201216\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r7i1p1f1.day.psl.gr.v20201216\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r8i1p1f1.day.psl.gr.v20201216\",\n",
" \"c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r9i1p1f1.day.psl.gr.v20201216\",\n",
" ]\n",
" },\n",
" \"steps\": {\n",
" \"concat_psl_1\": {\n",
" \"run\": \"concat\",\n",
" \"in\": {\"collection\": \"inputs/psl\", \"dims\": \"realization\"},\n",
" },\n",
" \"subset_psl_1\": {\n",
" \"run\": \"subset\",\n",
" \"in\": {\n",
" \"collection\": \"concat_psl_1/output\",\n",
" \"time\": SINGLE_YEAR_TIME,\n",
" \"area\": EUROPE_BBOX,\n",
" },\n",
" },\n",
" },\n",
" \"outputs\": {\"output\": \"subset_psl_1/output\"},\n",
" \"doc\": \"workflow\",\n",
"}\n",
"\n",
"request\n"
]
},
{
"cell_type": "markdown",
"id": "multi-year-heading",
"metadata": {},
"source": [
"## Prepared multi-year variant\n",
"\n",
"This copy keeps the inputs, concat operation, and European bounding box unchanged while extending the subset through 1968. Choose which request to submit by changing `selected_request`.\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "multi-year-request",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'collection': 'concat_psl_1/output',\n",
" 'time': '1962/1968',\n",
" 'area': '-10,30,35,70'}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from copy import deepcopy\n",
"\n",
"multi_year_request = deepcopy(request)\n",
"multi_year_request[\"steps\"][\"subset_psl_1\"][\"in\"][\"time\"] = MULTI_YEAR_TIME\n",
"\n",
"# selected_request = request\n",
"selected_request = multi_year_request\n",
"\n",
"selected_request[\"steps\"][\"subset_psl_1\"][\"in\"]\n"
]
},
{
"cell_type": "markdown",
"id": "workflow-heading",
"metadata": {},
"source": [
"## Build the equivalent Rooki workflow\n",
"\n",
"Importing Rooki contacts the configured WPS service. Change `ROOK_URL` if the reproduction should run against another deployment.\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "configure-rooki",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import os\n",
"\n",
"os.environ[\"ROOK_URL\"] = \"http://rook.dkrz.de/wps\"\n",
"\n",
"from rooki import operators as ops\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "build-workflow",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'inputs': {'psl': ['c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r10i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r1i1p1f1.day.psl.gr.v20201215',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r2i1p1f1.day.psl.gr.v20201215',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r3i1p1f1.day.psl.gr.v20201215',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r4i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r5i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r6i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r7i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r8i1p1f1.day.psl.gr.v20201216',\n",
" 'c3s-cmip6-decadal.DCPP.EC-Earth-Consortium.EC-Earth3.dcppA-hindcast.s1961-r9i1p1f1.day.psl.gr.v20201216']},\n",
" 'steps': {'concat_psl_1': {'run': 'concat',\n",
" 'in': {'collection': 'inputs/psl', 'dims': 'realization'}},\n",
" 'subset_psl_1': {'run': 'subset',\n",
" 'in': {'collection': 'concat_psl_1/output',\n",
" 'time': '1962/1968',\n",
" 'area': '-10,30,35,70'}}},\n",
" 'outputs': {'output': 'subset_psl_1/output'},\n",
" 'doc': 'workflow'}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"psl = ops.Input(\"psl\", selected_request[\"inputs\"][\"psl\"])\n",
"concat = ops.Concat(psl, dims=\"realization\")\n",
"subset_parameters = selected_request[\"steps\"][\"subset_psl_1\"][\"in\"]\n",
"subset = ops.Subset(\n",
" concat,\n",
" time=subset_parameters[\"time\"],\n",
" area=subset_parameters[\"area\"],\n",
")\n",
"\n",
"serialized_request = json.loads(subset._serialise())\n",
"serialized_request\n"
]
},
{
"cell_type": "markdown",
"id": "reproduce-heading",
"metadata": {},
"source": [
"## Reproduce the failure\n",
"\n",
"The next cell submits the selected complete-year workflow. Run it only against the deployment being investigated.\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "submit-workflow",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Orchestration time: 528.6 seconds\n"
]
},
{
"data": {
"text/plain": [
"(True, 'ProcessSucceeded')"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from time import perf_counter\n",
"\n",
"started_at = perf_counter()\n",
"resp = subset.orchestrate()\n",
"elapsed_seconds = perf_counter() - started_at\n",
"\n",
"print(f\"Orchestration time: {elapsed_seconds:.1f} seconds\")\n",
"resp.ok, resp.status\n"
]
},
{
"cell_type": "markdown",
"id": "inspect-heading",
"metadata": {},
"source": [
"## Inspect the response without loading data\n",
"\n",
"Displaying the response preserves failure details for diagnosis. On success, report the output size and URLs without downloading or opening the NetCDF result.\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "show-response",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Metalink URL: http://rook7.cloud.dkrz.de:80/outputs/rook/9846e926-9c1d-11f1-b2d2-fa163eb671ca/input.meta4, num files: 7"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"resp\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "list-output-urls",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Output size: 264.40 MiB\n",
"Output URLs (not downloaded):\n",
"http://rook7.cloud.dkrz.de:80/outputs/rook/d2c3db6c-9c1e-11f1-8aa1-fa163eb671ca/psl_day_EC-Earth3_dcppA-hindcast_r10i1p1f1_gr_19620101-19621231.nc\n",
"http://rook7.cloud.dkrz.de:80/outputs/rook/d2c3ef76-9c1e-11f1-8aa1-fa163eb671ca/psl_day_EC-Earth3_dcppA-hindcast_r10i1p1f1_gr_19630101-19631231.nc\n",
"http://rook7.cloud.dkrz.de:80/outputs/rook/d2c3fc8c-9c1e-11f1-8aa1-fa163eb671ca/psl_day_EC-Earth3_dcppA-hindcast_r10i1p1f1_gr_19640101-19641231.nc\n",
"http://rook7.cloud.dkrz.de:80/outputs/rook/d2c40768-9c1e-11f1-8aa1-fa163eb671ca/psl_day_EC-Earth3_dcppA-hindcast_r10i1p1f1_gr_19650101-19651231.nc\n",
"http://rook7.cloud.dkrz.de:80/outputs/rook/d2c411a4-9c1e-11f1-8aa1-fa163eb671ca/psl_day_EC-Earth3_dcppA-hindcast_r10i1p1f1_gr_19660101-19661231.nc\n",
"http://rook7.cloud.dkrz.de:80/outputs/rook/d2c41cb2-9c1e-11f1-8aa1-fa163eb671ca/psl_day_EC-Earth3_dcppA-hindcast_r10i1p1f1_gr_19670101-19671231.nc\n",
"http://rook7.cloud.dkrz.de:80/outputs/rook/d2c427fc-9c1e-11f1-8aa1-fa163eb671ca/psl_day_EC-Earth3_dcppA-hindcast_r10i1p1f1_gr_19680101-19681231.nc\n"
]
}
],
"source": [
"if resp.ok:\n",
" print(f\"Output size: {resp.size_in_mb:.2f} MiB\")\n",
" print(\"Output URLs (not downloaded):\")\n",
" for url in resp.download_urls():\n",
" print(url)\n"
]
}
],
"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.12.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading
0