{
"cells": [
{
"cell_type": "markdown",
"id": "fa561492",
"metadata": {
"tags": []
},
"source": [
"
\n",
"\n",
"
scripts/comin_plugin_P1.py
, which you can open by clicking here.\n",
" In your plugin, add a 2D diagnostic variable named comin_process_id
for domain 1.\n",
" \n",
" As outlined in the ICON tutorial, adding a new variable in your ComIn plugin involves two steps:\n",
" comin.var_request_add
for this.\n",
" For a list of available metadata, refer to the Python API.comin.var_get
.\n",
" Furthermore, you will need to specify the entry point for your callback function. In this exercise, we will use the EP_ATM_WRITE_OUTPUT_BEFORE
entry point. scripts/comin_plugin_P1.py
and attach it to the EP_ATM_WRITE_OUTPUT_BEFORE
entry point. \n",
"This is done using the comin.register_callback
function (a function decorator).\n",
"\n",
"In the callback function, fill the variable comin_process_id
with the MPI rank of the processor. \n",
"print(\"...\", file=sys.stderr)
to avoid buffering.\n",
"\n",
"\n",
"np.asarray
is an important point to note: The `comin.var_get` call returns a handle to an ICON variable. However, since ICON contains fields with multiple time levels, the corresponding array pointer changes during the model run. Each time the plugin needs to access the array (pointer), it must be explicitly or implicitly converted to a NumPy array.\n",
"\n",
" \n",
" Exercise: \n",
" \n",
"
| \n",
" \n",
" ![]() | \n",
"