From d3ec86c09b8f7411cc023e0969326c6d7e71547e Mon Sep 17 00:00:00 2001 From: Eline Date: Tue, 17 Dec 2024 10:37:32 +0100 Subject: [PATCH] update error --- .../CMIP6/example_model_run_pcrglobwb.ipynb | 278 +++++++++++++++--- 1 file changed, 244 insertions(+), 34 deletions(-) diff --git a/book/thesis_projects/BSc/2024_Q2_ElineMol_CEG/Drafts/CMIP6/example_model_run_pcrglobwb.ipynb b/book/thesis_projects/BSc/2024_Q2_ElineMol_CEG/Drafts/CMIP6/example_model_run_pcrglobwb.ipynb index 8fe2179..2e5fd05 100644 --- a/book/thesis_projects/BSc/2024_Q2_ElineMol_CEG/Drafts/CMIP6/example_model_run_pcrglobwb.ipynb +++ b/book/thesis_projects/BSc/2024_Q2_ElineMol_CEG/Drafts/CMIP6/example_model_run_pcrglobwb.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 15, "id": "424992ea", "metadata": {}, "outputs": [], @@ -31,7 +31,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 16, "id": "cec50ce3", "metadata": {}, "outputs": [], @@ -53,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 17, "id": "3f186494-1f05-445d-8663-306591c87320", "metadata": {}, "outputs": [], @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 18, "id": "3d38bc4c-fec2-4572-983b-376edbaefde3", "metadata": {}, "outputs": [], @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 19, "id": "fbabe50c", "metadata": {}, "outputs": [ @@ -150,23 +150,38 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 20, "id": "870c4af6", "metadata": {}, "outputs": [ { - "ename": "PermissionError", - "evalue": "[Errno 13] Permission denied: '/home/emol/forcing/csonoran_desert/work/diagnostic/script/ewatercycle_forcing.yaml'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mPermissionError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m forcing \u001b[38;5;241m=\u001b[39m \u001b[43mewatercycle\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mforcing\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msources\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mPCRGlobWBForcing\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[43mdirectory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/home/emol/forcing/csonoran_desert/work/diagnostic/script\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[43m)\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(forcing)\n", - "File \u001b[0;32m~/.local/lib/python3.12/site-packages/ewatercycle/base/forcing.py:271\u001b[0m, in \u001b[0;36mDefaultForcing.load\u001b[0;34m(cls, directory)\u001b[0m\n\u001b[1;32m 268\u001b[0m meta \u001b[38;5;241m=\u001b[39m data_source \u001b[38;5;241m/\u001b[39m FORCING_YAML\n\u001b[1;32m 269\u001b[0m yaml \u001b[38;5;241m=\u001b[39m YAML(typ\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msafe\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 271\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[43mmeta\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexists\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 272\u001b[0m msg \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 273\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mForcing file \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmeta\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m not found. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 274\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPerhaps you want to use \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m(...)?\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 275\u001b[0m )\n\u001b[1;32m 276\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mFileNotFoundError\u001b[39;00m(msg)\n", - "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/pathlib.py:860\u001b[0m, in \u001b[0;36mPath.exists\u001b[0;34m(self, follow_symlinks)\u001b[0m\n\u001b[1;32m 853\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 854\u001b[0m \u001b[38;5;124;03mWhether this path exists.\u001b[39;00m\n\u001b[1;32m 855\u001b[0m \n\u001b[1;32m 856\u001b[0m \u001b[38;5;124;03mThis method normally follows symlinks; to check whether a symlink exists,\u001b[39;00m\n\u001b[1;32m 857\u001b[0m \u001b[38;5;124;03madd the argument follow_symlinks=False.\u001b[39;00m\n\u001b[1;32m 858\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 859\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 860\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstat\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfollow_symlinks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_symlinks\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 861\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 862\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m _ignore_error(e):\n", - "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/pathlib.py:840\u001b[0m, in \u001b[0;36mPath.stat\u001b[0;34m(self, follow_symlinks)\u001b[0m\n\u001b[1;32m 835\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mstat\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39m, follow_symlinks\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m):\n\u001b[1;32m 836\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 837\u001b[0m \u001b[38;5;124;03m Return the result of the stat() system call on this path, like\u001b[39;00m\n\u001b[1;32m 838\u001b[0m \u001b[38;5;124;03m os.stat() does.\u001b[39;00m\n\u001b[1;32m 839\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 840\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstat\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfollow_symlinks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_symlinks\u001b[49m\u001b[43m)\u001b[49m\n", - "\u001b[0;31mPermissionError\u001b[0m: [Errno 13] Permission denied: '/home/emol/forcing/csonoran_desert/work/diagnostic/script/ewatercycle_forcing.yaml'" - ] + "data": { + "text/html": [ + "
PCRGlobWBForcing(\n",
+       "    start_time='2025-08-01T00:00:00Z',\n",
+       "    end_time='2030-08-31T00:00:00Z',\n",
+       "    directory=PosixPath('/home/emol/forcing/csonoran_desert/work/diagnostic/script'),\n",
+       "    shape=PosixPath('/home/emol/forcing/csonoran_desert/work/diagnostic/script/hysets_09488650.shp'),\n",
+       "    filenames={},\n",
+       "    precipitationNC='pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_pr_gn_2025-2030_hysets_09488650.nc',\n",
+       "    temperatureNC='pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_tas_gn_2025-2030_hysets_09488650.nc'\n",
+       ")\n",
+       "
\n" + ], + "text/plain": [ + "\u001b[1;35mPCRGlobWBForcing\u001b[0m\u001b[1m(\u001b[0m\n", + " \u001b[33mstart_time\u001b[0m=\u001b[32m'2025-08-01T00:00:00Z'\u001b[0m,\n", + " \u001b[33mend_time\u001b[0m=\u001b[32m'2030-08-31T00:00:00Z'\u001b[0m,\n", + " \u001b[33mdirectory\u001b[0m=\u001b[1;35mPosixPath\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'/home/emol/forcing/csonoran_desert/work/diagnostic/script'\u001b[0m\u001b[1m)\u001b[0m,\n", + " \u001b[33mshape\u001b[0m=\u001b[1;35mPosixPath\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'/home/emol/forcing/csonoran_desert/work/diagnostic/script/hysets_09488650.shp'\u001b[0m\u001b[1m)\u001b[0m,\n", + " \u001b[33mfilenames\u001b[0m=\u001b[1m{\u001b[0m\u001b[1m}\u001b[0m,\n", + " \u001b[33mprecipitationNC\u001b[0m=\u001b[32m'pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_pr_gn_2025-2030_hysets_09488650.nc'\u001b[0m,\n", + " \u001b[33mtemperatureNC\u001b[0m=\u001b[32m'pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_tas_gn_2025-2030_hysets_09488650.nc'\u001b[0m\n", + "\u001b[1m)\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ @@ -188,10 +203,62 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "08a4ed9e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
PCRGlobWB(\n",
+       "    parameter_set=ParameterSet(\n",
+       "        name='custom_parameter_set',\n",
+       "        directory=PosixPath('/data/shared/parameter-sets/pcrglobwb_global'),\n",
+       "        config=PosixPath('pcrglobwb_sonoran_mpi-esm1-2-hr_05min.ini'),\n",
+       "        doi='N/A',\n",
+       "        target_model='pcrglobwb',\n",
+       "        supported_model_versions={'setters'},\n",
+       "        downloader=None\n",
+       "    ),\n",
+       "    forcing=PCRGlobWBForcing(\n",
+       "        start_time='2025-08-01T00:00:00Z',\n",
+       "        end_time='2030-08-31T00:00:00Z',\n",
+       "        directory=PosixPath('/home/emol/forcing/csonoran_desert/work/diagnostic/script'),\n",
+       "        shape=PosixPath('/home/emol/forcing/csonoran_desert/work/diagnostic/script/hysets_09488650.shp'),\n",
+       "        filenames={},\n",
+       "        precipitationNC='pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_pr_gn_2025-2030_hysets_09488650.nc',\n",
+       "        temperatureNC='pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_tas_gn_2025-2030_hysets_09488650.nc'\n",
+       "    )\n",
+       ")\n",
+       "
\n" + ], + "text/plain": [ + "\u001b[1;35mPCRGlobWB\u001b[0m\u001b[1m(\u001b[0m\n", + " \u001b[33mparameter_set\u001b[0m=\u001b[1;35mParameterSet\u001b[0m\u001b[1m(\u001b[0m\n", + " \u001b[33mname\u001b[0m=\u001b[32m'custom_parameter_set'\u001b[0m,\n", + " \u001b[33mdirectory\u001b[0m=\u001b[1;35mPosixPath\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'/data/shared/parameter-sets/pcrglobwb_global'\u001b[0m\u001b[1m)\u001b[0m,\n", + " \u001b[33mconfig\u001b[0m=\u001b[1;35mPosixPath\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'pcrglobwb_sonoran_mpi-esm1-2-hr_05min.ini'\u001b[0m\u001b[1m)\u001b[0m,\n", + " \u001b[33mdoi\u001b[0m=\u001b[32m'N/A'\u001b[0m,\n", + " \u001b[33mtarget_model\u001b[0m=\u001b[32m'pcrglobwb'\u001b[0m,\n", + " \u001b[33msupported_model_versions\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'setters'\u001b[0m\u001b[1m}\u001b[0m,\n", + " \u001b[33mdownloader\u001b[0m=\u001b[3;35mNone\u001b[0m\n", + " \u001b[1m)\u001b[0m,\n", + " \u001b[33mforcing\u001b[0m=\u001b[1;35mPCRGlobWBForcing\u001b[0m\u001b[1m(\u001b[0m\n", + " \u001b[33mstart_time\u001b[0m=\u001b[32m'2025-08-01T00:00:00Z'\u001b[0m,\n", + " \u001b[33mend_time\u001b[0m=\u001b[32m'2030-08-31T00:00:00Z'\u001b[0m,\n", + " \u001b[33mdirectory\u001b[0m=\u001b[1;35mPosixPath\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'/home/emol/forcing/csonoran_desert/work/diagnostic/script'\u001b[0m\u001b[1m)\u001b[0m,\n", + " \u001b[33mshape\u001b[0m=\u001b[1;35mPosixPath\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'/home/emol/forcing/csonoran_desert/work/diagnostic/script/hysets_09488650.shp'\u001b[0m\u001b[1m)\u001b[0m,\n", + " \u001b[33mfilenames\u001b[0m=\u001b[1m{\u001b[0m\u001b[1m}\u001b[0m,\n", + " \u001b[33mprecipitationNC\u001b[0m=\u001b[32m'pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_pr_gn_2025-2030_hysets_09488650.nc'\u001b[0m,\n", + " \u001b[33mtemperatureNC\u001b[0m=\u001b[32m'pcrglobwb_CMIP6_MPI-ESM1-2-HR_day_ssp585_r1i1p1f1_tas_gn_2025-2030_hysets_09488650.nc'\u001b[0m\n", + " \u001b[1m)\u001b[0m\n", + "\u001b[1m)\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "pcrglob = ewatercycle.models.PCRGlobWB(\n", " parameter_set=parameter_set,\n", @@ -202,10 +269,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "a45eba5c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'setters'" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "pcrglob.version" ] @@ -220,10 +298,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "4a62965a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
dict_items([('start_time', '2025-08-01T00:00:00Z'), ('end_time', '2025-08-01T00:00:00Z'), ('routing_method', \n",
+       "'accuTravelTime'), ('max_spinups_in_years', '0')])\n",
+       "
\n" + ], + "text/plain": [ + "\u001b[1;35mdict_items\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'start_time'\u001b[0m, \u001b[32m'2025-08-01T00:00:00Z'\u001b[0m\u001b[1m)\u001b[0m, \u001b[1m(\u001b[0m\u001b[32m'end_time'\u001b[0m, \u001b[32m'2025-08-01T00:00:00Z'\u001b[0m\u001b[1m)\u001b[0m, \u001b[1m(\u001b[0m\u001b[32m'routing_method'\u001b[0m, \n", + "\u001b[32m'accuTravelTime'\u001b[0m\u001b[1m)\u001b[0m, \u001b[1m(\u001b[0m\u001b[32m'max_spinups_in_years'\u001b[0m, \u001b[32m'0'\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "print(pcrglob.parameters)" ] @@ -238,10 +332,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "cc852425", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "('/home/emol/repos/projects/book/thesis_projects/BSc/2024_Q2_ElineMol_CEG/Drafts/CMIP6/pcrglobwb_20241217_092442/pcrglobwb_ewatercycle.ini',\n", + " '/home/emol/repos/projects/book/thesis_projects/BSc/2024_Q2_ElineMol_CEG/Drafts/CMIP6/pcrglobwb_20241217_092442')" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "cfg_file, cfg_dir = pcrglob.setup(\n", " end_time=\"2025-08-31T00:00:00Z\",\n", @@ -252,10 +358,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "4456b5e2", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
dict_items([('start_time', '2025-08-01T00:00:00Z'), ('end_time', '2025-08-31T00:00:00Z'), ('routing_method', \n",
+       "'accuTravelTime'), ('max_spinups_in_years', '0')])\n",
+       "
\n" + ], + "text/plain": [ + "\u001b[1;35mdict_items\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'start_time'\u001b[0m, \u001b[32m'2025-08-01T00:00:00Z'\u001b[0m\u001b[1m)\u001b[0m, \u001b[1m(\u001b[0m\u001b[32m'end_time'\u001b[0m, \u001b[32m'2025-08-31T00:00:00Z'\u001b[0m\u001b[1m)\u001b[0m, \u001b[1m(\u001b[0m\u001b[32m'routing_method'\u001b[0m, \n", + "\u001b[32m'accuTravelTime'\u001b[0m\u001b[1m)\u001b[0m, \u001b[1m(\u001b[0m\u001b[32m'max_spinups_in_years'\u001b[0m, \u001b[32m'0'\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "print(pcrglob.parameters)" ] @@ -270,7 +392,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "87144041", "metadata": {}, "outputs": [], @@ -288,10 +410,78 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "664b32b6-2b4c-49f1-be5a-b451fceb9ecc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
PCRGlobWB: Sonoran Desert
time
2025-08-01 00:00:00+00:00NaN
2025-08-02 00:00:00+00:00NaN
2025-08-03 00:00:00+00:00NaN
2025-08-04 00:00:00+00:00NaN
2025-08-05 00:00:00+00:00NaN
\n", + "
" + ], + "text/plain": [ + " PCRGlobWB: Sonoran Desert\n", + "time \n", + "2025-08-01 00:00:00+00:00 NaN\n", + "2025-08-02 00:00:00+00:00 NaN\n", + "2025-08-03 00:00:00+00:00 NaN\n", + "2025-08-04 00:00:00+00:00 NaN\n", + "2025-08-05 00:00:00+00:00 NaN" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "time = pd.date_range(pcrglob.start_time_as_isostr, pcrglob.end_time_as_isostr)\n", "timeseries = pd.DataFrame(\n", @@ -312,12 +502,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "403d55e6", "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "ename": "_InactiveRpcError", + "evalue": "<_InactiveRpcError of RPC that terminated with:\n\tstatus = StatusCode.UNKNOWN\n\tdetails = \"Exception calling application: Size mismatch: Number of array elements is 20449, number of raster cells is 20736\"\n\tdebug_error_string = \"UNKNOWN:Error received from peer {created_time:\"2024-12-17T10:25:29.874295642+01:00\", grpc_status:2, grpc_message:\"Exception calling application: Size mismatch: Number of array elements is 20449, number of raster cells is 20736\"}\"\n>", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31m_InactiveRpcError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[28], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m pcrglob\u001b[38;5;241m.\u001b[39mtime \u001b[38;5;241m<\u001b[39m pcrglob\u001b[38;5;241m.\u001b[39mend_time:\n\u001b[0;32m----> 2\u001b[0m \u001b[43mpcrglob\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Track discharge at station location\u001b[39;00m\n\u001b[1;32m 5\u001b[0m discharge_at_station \u001b[38;5;241m=\u001b[39m pcrglob\u001b[38;5;241m.\u001b[39mget_value_at_coords(\n\u001b[1;32m 6\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgroundwater recharge\u001b[39m\u001b[38;5;124m\"\u001b[39m, lat\u001b[38;5;241m=\u001b[39m[station_latitude], lon\u001b[38;5;241m=\u001b[39m[station_longitude]\n\u001b[1;32m 7\u001b[0m )\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/ewatercycle/base/model.py:182\u001b[0m, in \u001b[0;36meWaterCycleModel.update\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 180\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupdate\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 181\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Advance model state by one time step.\"\"\"\u001b[39;00m\n\u001b[0;32m--> 182\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_bmi\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/grpc4bmi/bmi_optionaldest.py:52\u001b[0m, in \u001b[0;36mOptionalDestBmi.update\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupdate\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 52\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43morigin\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/grpc4bmi/bmi_memoized.py:60\u001b[0m, in \u001b[0;36mMemoizedBmi.update\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 59\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupdate\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m---> 60\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43morigin\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/ewatercycle/container.py:453\u001b[0m, in \u001b[0;36mBmiProxy.update\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 452\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupdate\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 453\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43morigin\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/grpc4bmi/bmi_grpc_client.py:107\u001b[0m, in \u001b[0;36mBmiClient.update\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 105\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstub\u001b[38;5;241m.\u001b[39mupdate(bmi_pb2\u001b[38;5;241m.\u001b[39mEmpty())\n\u001b[1;32m 106\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m grpc\u001b[38;5;241m.\u001b[39mRpcError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m--> 107\u001b[0m \u001b[43mhandle_error\u001b[49m\u001b[43m(\u001b[49m\u001b[43me\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/grpc4bmi/bmi_grpc_client.py:105\u001b[0m, in \u001b[0;36mBmiClient.update\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupdate\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 104\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 105\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstub\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbmi_pb2\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mEmpty\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 106\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m grpc\u001b[38;5;241m.\u001b[39mRpcError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 107\u001b[0m handle_error(e)\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/grpc/_channel.py:1176\u001b[0m, in \u001b[0;36m_UnaryUnaryMultiCallable.__call__\u001b[0;34m(self, request, timeout, metadata, credentials, wait_for_ready, compression)\u001b[0m\n\u001b[1;32m 1161\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__call__\u001b[39m(\n\u001b[1;32m 1162\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1163\u001b[0m request: Any,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1168\u001b[0m compression: Optional[grpc\u001b[38;5;241m.\u001b[39mCompression] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1169\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Any:\n\u001b[1;32m 1170\u001b[0m (\n\u001b[1;32m 1171\u001b[0m state,\n\u001b[1;32m 1172\u001b[0m call,\n\u001b[1;32m 1173\u001b[0m ) \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_blocking(\n\u001b[1;32m 1174\u001b[0m request, timeout, metadata, credentials, wait_for_ready, compression\n\u001b[1;32m 1175\u001b[0m )\n\u001b[0;32m-> 1176\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_end_unary_response_blocking\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcall\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/opt/conda/envs/ewatercycle2/lib/python3.12/site-packages/grpc/_channel.py:1005\u001b[0m, in \u001b[0;36m_end_unary_response_blocking\u001b[0;34m(state, call, with_call, deadline)\u001b[0m\n\u001b[1;32m 1003\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m state\u001b[38;5;241m.\u001b[39mresponse\n\u001b[1;32m 1004\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1005\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m _InactiveRpcError(state)\n", + "\u001b[0;31m_InactiveRpcError\u001b[0m: <_InactiveRpcError of RPC that terminated with:\n\tstatus = StatusCode.UNKNOWN\n\tdetails = \"Exception calling application: Size mismatch: Number of array elements is 20449, number of raster cells is 20736\"\n\tdebug_error_string = \"UNKNOWN:Error received from peer {created_time:\"2024-12-17T10:25:29.874295642+01:00\", grpc_status:2, grpc_message:\"Exception calling application: Size mismatch: Number of array elements is 20449, number of raster cells is 20736\"}\"\n>" + ] + } + ], "source": [ "while pcrglob.time < pcrglob.end_time:\n", " pcrglob.update()\n", @@ -470,7 +680,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "b5846be2", "metadata": {}, "outputs": [],