{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Show exceptions" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "os.environ['ROOK_URL'] = 'http://rook.dkrz.de/wps'\n", "\n", "from rooki import rooki" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**check that subset operator is working**" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803',\n", " time='1985-01-01/2014-12-30',\n", ")\n", "resp.ok" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Error: missing collection parameter**" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "subset() missing 1 required positional argument: 'collection'\n" ] } ], "source": [ "try:\n", " resp = rooki.subset()\n", "except TypeError as e:\n", " print(f\"{e}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Check which time range is available**" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803',\n", ")\n", "resp.ok" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['https://data.mips.copernicus-climate.eu/thredds/fileServer/esg_c3s-cmip6/CMIP/IPSL/IPSL-CM6A-LR/historical/r1i1p1f1/Amon/rlds/gr/v20180803/rlds_Amon_IPSL-CM6A-LR_historical_r1i1p1f1_gr_185001-201412.nc']" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp.download_urls()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Error: not available time range**" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " owslib.wps.WPSException : {'code': 'NoApplicableCode', 'locator': 'None', 'text': 'Process error: No files found in given time range for c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803'}\n" ] }, { "data": { "text/plain": [ "False" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803',\n", " time='2100-01-01/2200-12-30',\n", ")\n", "resp.ok" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Process error: No files found in given time range for c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp.status" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Error: invalid time parameter**" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " owslib.wps.WPSException : {'code': 'NoApplicableCode', 'locator': 'None', 'text': 'Process error: TimeParameter should be passed in as a range separated by /'}\n" ] }, { "data": { "text/plain": [ "Process error: TimeParameter should be passed in as a range separated by /" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803',\n", " time='1900-01-01',\n", ")\n", "resp" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " owslib.wps.WPSException : {'code': 'NoApplicableCode', 'locator': 'None', 'text': 'Process error: TimeParameter should be passed in as a range separated by /'}\n" ] }, { "data": { "text/plain": [ "Process error: TimeParameter should be passed in as a range separated by /" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803',\n", " time='today',\n", ")\n", "resp" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Error: not available collection ... c3s-cmip7**" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " owslib.wps.WPSException : {'code': 'NoApplicableCode', 'locator': 'None', 'text': 'Process error: The project could not be identified and force was set to false'}\n" ] }, { "data": { "text/plain": [ "Process error: The project could not be identified and force was set to false" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip7.output1.MOHC.HadGEM2-ES.rcp85.mon.atmos.Amon.r1i1p1.latest.tas',\n", " time='2085-01-01/2120-12-30',\n", ")\n", "resp" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Error: invalid collection parameter**" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " owslib.wps.WPSException : {'code': 'NoApplicableCode', 'locator': 'None', 'text': 'Process error: The project could not be identified and force was set to false'}\n" ] }, { "data": { "text/plain": [ "Process error: The project could not be identified and force was set to false" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip5/tas',\n", " time='2085-01-01/2120-12-30',\n", ")\n", "resp" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Error: operation failed ...0 meridian not supported**\n", "\n", "**Update: this is solved!**\n", "\n", "Issue: https://github.com/roocs/clisops/issues/35" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Metalink URL: http://rook1.cloud.dkrz.de:80/outputs/rook/a7b09ae6-76b3-11eb-94aa-fa163eac7aff/input.meta4, num files: 1" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp = rooki.subset(\n", " collection='c3s-cmip6.CMIP.IPSL.IPSL-CM6A-LR.historical.r1i1p1f1.Amon.rlds.gr.v20180803',\n", " time='1901-01-01/1921-12-30',\n", " area='-20, 40, 20, 70',\n", ")\n", "resp" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.9.2" } }, "nbformat": 4, "nbformat_minor": 4 }