From f6330d5bca2985c1b89ed8966a605d46962a1713 Mon Sep 17 00:00:00 2001 From: zmoon Date: Thu, 28 Sep 2023 13:49:51 -0600 Subject: [PATCH] Add point example with leaf age opt to nb --- python/examples.ipynb | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/python/examples.ipynb b/python/examples.ipynb index 252d454c..3d57996f 100644 --- a/python/examples.ipynb +++ b/python/examples.ipynb @@ -882,6 +882,63 @@ "source": [ "ds.emi_apin.mean(\"z\", keep_attrs=True).plot(size=4, marker=\"o\")" ] + }, + { + "cell_type": "markdown", + "id": "0a445f3c-52a2-4a3f-89be-c06011b91a76", + "metadata": {}, + "source": [ + "### Leaf age parameterization" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a0eee654-2333-408e-a4f6-0bb9ed574600", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "config = {\n", + " \"filenames\": {\n", + " \"file_vars\": [\n", + " \"../input/point_file_20220630.sfcf023.txt\",\n", + " \"../input/point_file_20220701.sfcf000.txt\",\n", + " \"../input/point_file_20220701.sfcf001.txt\",\n", + " ],\n", + " },\n", + " \"userdefs\": {\n", + " \"infmt_opt\": 1,\n", + " \"ntime\": 3,\n", + " \"nlat\": 1,\n", + " \"nlon\": 1,\n", + " \"leafage_opt\": 0, # on\n", + " },\n", + "}\n", + "ds0 = run(config=config)\n", + "\n", + "config[\"userdefs\"][\"leafage_opt\"] = 1 # off\n", + "ds1 = run(config=config)\n", + "\n", + "ds = xr.concat([ds0, ds1], dim=\"leafage_opt\")\n", + "ds" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2439516f-bd60-495f-bbc5-5dfe70555c03", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "fig, [ax1, ax2] = plt.subplots(2, 1, figsize=(5, 6), sharex=True)\n", + "\n", + "ds.emi_apin.mean(\"z\", keep_attrs=True).plot(hue=\"leafage_opt\", marker=\"o\", ax=ax1)\n", + "ds.emi_isop.mean(\"z\", keep_attrs=True).plot(hue=\"leafage_opt\", marker=\"o\", ax=ax2)" + ] } ], "metadata": {