diff --git a/Contributors.md b/Contributors.md index 4516b3a..fbb7f5a 100644 --- a/Contributors.md +++ b/Contributors.md @@ -6,6 +6,7 @@ - Katie Dagon (NCAR), [@katiedagon](https://github.com/katiedagon) - Anna-Lena Deppenmeier (NCAR; now University of Liverpool), [@ALDepp](https://github.com/ALDepp) - Brian Dobbins (NCAR), [@briandobbins](https://github.com/briandobbins) + - Alice DuVivier (NCAR), [@duvivier](https://github.com/duvivier) - Orhan Eroglu (NCAR), [@erogluorhan](https://github.com/erogluorhan) - John Fasullo (NCAR) - Katelyn FitzGerald (NCAR), [@kafitzgerald](https://github.com/kafitzgerald) diff --git a/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb b/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb index 7a9e0e2..5680972 100644 --- a/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb +++ b/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb @@ -129,6 +129,22 @@ "client" ] }, + { + "cell_type": "markdown", + "id": "a9c16590-9545-42cc-be78-f17bc16c9e40", + "metadata": {}, + "source": [ + "# Read in data" + ] + }, + { + "cell_type": "markdown", + "id": "7e9d81ec-f6f6-4c21-ad45-3d4e6c2377eb", + "metadata": {}, + "source": [ + "### New CESM cases to compare" + ] + }, { "cell_type": "code", "execution_count": null, @@ -186,6 +202,14 @@ "base_end_year = int(base_end_date.split(\"-\")[0])" ] }, + { + "cell_type": "markdown", + "id": "e1e1cf81-d595-48de-8ca8-c47b408e105d", + "metadata": {}, + "source": [ + "### CESM1 and CESM2 large ensemble data" + ] + }, { "cell_type": "code", "execution_count": null, @@ -262,10 +286,252 @@ "cesm2_hstot_sh_month = ds_cesm2_hstot_sh[\"hs_monthly\"][:, 110:145, :].mean(dim=\"nyr\")" ] }, + { + "cell_type": "markdown", + "id": "5a26f440-0425-4b42-a380-7e0609dc1adf", + "metadata": {}, + "source": [ + "### NSIDC data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "370ad77d-303f-4b8e-946e-1278d413c963", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "### Read in the NH NSIDC data from files\n", + "\n", + "jan_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_01_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "feb_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_02_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "mar_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_03_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "apr_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_04_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "may_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_05_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "jun_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_06_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "jul_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_07_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "aug_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_08_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "sep_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_09_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "oct_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_10_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "nov_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_11_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "dec_nsidc_nh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"N_12_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "\n", + "jan_area_nh = jan_nsidc_nh.iloc[:, 5].values\n", + "feb_area_nh = feb_nsidc_nh.iloc[:, 5].values\n", + "mar_area_nh = mar_nsidc_nh.iloc[:, 5].values\n", + "apr_area_nh = apr_nsidc_nh.iloc[:, 5].values\n", + "may_area_nh = may_nsidc_nh.iloc[:, 5].values\n", + "jun_area_nh = jun_nsidc_nh.iloc[:, 5].values\n", + "jul_area_nh = jul_nsidc_nh.iloc[:, 5].values\n", + "aug_area_nh = aug_nsidc_nh.iloc[:, 5].values\n", + "sep_area_nh = sep_nsidc_nh.iloc[:, 5].values\n", + "oct_area_nh = oct_nsidc_nh.iloc[:, 5].values\n", + "nov_area_nh = nov_nsidc_nh.iloc[:, 5].values\n", + "dec_area_nh = dec_nsidc_nh.iloc[:, 5].values\n", + "\n", + "jan_ext_nh = jan_nsidc_nh.iloc[:, 4].values\n", + "feb_ext_nh = feb_nsidc_nh.iloc[:, 4].values\n", + "mar_ext_nh = mar_nsidc_nh.iloc[:, 4].values\n", + "apr_ext_nh = apr_nsidc_nh.iloc[:, 4].values\n", + "may_ext_nh = may_nsidc_nh.iloc[:, 4].values\n", + "jun_ext_nh = jun_nsidc_nh.iloc[:, 4].values\n", + "jul_ext_nh = jul_nsidc_nh.iloc[:, 4].values\n", + "aug_ext_nh = aug_nsidc_nh.iloc[:, 4].values\n", + "sep_ext_nh = sep_nsidc_nh.iloc[:, 4].values\n", + "oct_ext_nh = oct_nsidc_nh.iloc[:, 4].values\n", + "nov_ext_nh = nov_nsidc_nh.iloc[:, 4].values\n", + "dec_ext_nh = dec_nsidc_nh.iloc[:, 4].values\n", + "\n", + "nsidc_clim_nh_ext = [\n", + " np.nanmean(jan_ext_nh[0:35]),\n", + " np.nanmean(feb_ext_nh[0:35]),\n", + " np.nanmean(mar_ext_nh[0:35]),\n", + " np.nanmean(apr_ext_nh[0:35]),\n", + " np.nanmean(may_ext_nh[0:35]),\n", + " np.nanmean(jun_ext_nh[0:35]),\n", + " np.nanmean(jul_ext_nh[0:35]),\n", + " np.nanmean(aug_ext_nh[0:35]),\n", + " np.nanmean(sep_ext_nh[0:35]),\n", + " np.nanmean(oct_ext_nh[0:35]),\n", + " np.nanmean(nov_ext_nh[0:35]),\n", + " np.nanmean(dec_ext_nh[0:35]),\n", + "]\n", + "\n", + "nsidc_clim_nh_area = [\n", + " np.nanmean(jan_area_nh[0:35]),\n", + " np.nanmean(feb_area_nh[0:35]),\n", + " np.nanmean(mar_area_nh[0:35]),\n", + " np.nanmean(apr_area_nh[0:35]),\n", + " np.nanmean(may_area_nh[0:35]),\n", + " np.nanmean(jun_area_nh[0:35]),\n", + " np.nanmean(jul_area_nh[0:35]),\n", + " np.nanmean(aug_area_nh[0:35]),\n", + " np.nanmean(sep_area_nh[0:35]),\n", + " np.nanmean(oct_area_nh[0:35]),\n", + " np.nanmean(nov_area_nh[0:35]),\n", + " np.nanmean(dec_area_nh[0:35]),\n", + "]\n", + "\n", + "# plt.plot(nsidc_clim_nh_area)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "23ab7224-a908-4efd-9a79-45e50e2841b1", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "### Read in the SH NSIDC data from files\n", + "\n", + "jan_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_01_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "feb_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_02_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "mar_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_03_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "apr_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_04_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "may_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_05_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "jun_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_06_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "jul_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_07_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "aug_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_08_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "sep_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_09_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "oct_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_10_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "nov_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_11_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "dec_nsidc_sh = pd.read_csv(\n", + " os.path.join(path_nsidc, \"S_12_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + ")\n", + "\n", + "jan_area_sh = jan_nsidc_sh.iloc[:, 5].values\n", + "feb_area_sh = feb_nsidc_sh.iloc[:, 5].values\n", + "mar_area_sh = mar_nsidc_sh.iloc[:, 5].values\n", + "apr_area_sh = apr_nsidc_sh.iloc[:, 5].values\n", + "may_area_sh = may_nsidc_sh.iloc[:, 5].values\n", + "jun_area_sh = jun_nsidc_sh.iloc[:, 5].values\n", + "jul_area_sh = jul_nsidc_sh.iloc[:, 5].values\n", + "aug_area_sh = aug_nsidc_sh.iloc[:, 5].values\n", + "sep_area_sh = sep_nsidc_sh.iloc[:, 5].values\n", + "oct_area_sh = oct_nsidc_sh.iloc[:, 5].values\n", + "nov_area_sh = nov_nsidc_sh.iloc[:, 5].values\n", + "dec_area_sh = dec_nsidc_sh.iloc[:, 5].values\n", + "\n", + "jan_ext_sh = jan_nsidc_sh.iloc[:, 4].values\n", + "feb_ext_sh = feb_nsidc_sh.iloc[:, 4].values\n", + "mar_ext_sh = mar_nsidc_sh.iloc[:, 4].values\n", + "apr_ext_sh = apr_nsidc_sh.iloc[:, 4].values\n", + "may_ext_sh = may_nsidc_sh.iloc[:, 4].values\n", + "jun_ext_sh = jun_nsidc_sh.iloc[:, 4].values\n", + "jul_ext_sh = jul_nsidc_sh.iloc[:, 4].values\n", + "aug_ext_sh = aug_nsidc_sh.iloc[:, 4].values\n", + "sep_ext_sh = sep_nsidc_sh.iloc[:, 4].values\n", + "oct_ext_sh = oct_nsidc_sh.iloc[:, 4].values\n", + "nov_ext_sh = nov_nsidc_sh.iloc[:, 4].values\n", + "dec_ext_sh = dec_nsidc_sh.iloc[:, 4].values\n", + "\n", + "nsidc_clim_sh_ext = [\n", + " np.nanmean(jan_ext_sh[0:35]),\n", + " np.nanmean(feb_ext_sh[0:35]),\n", + " np.nanmean(mar_ext_sh[0:35]),\n", + " np.nanmean(apr_ext_sh[0:35]),\n", + " np.nanmean(may_ext_sh[0:35]),\n", + " np.nanmean(jun_ext_sh[0:35]),\n", + " np.nanmean(jul_ext_sh[0:35]),\n", + " np.nanmean(aug_ext_sh[0:35]),\n", + " np.nanmean(sep_ext_sh[0:35]),\n", + " np.nanmean(oct_ext_sh[0:35]),\n", + " np.nanmean(nov_ext_sh[0:35]),\n", + " np.nanmean(dec_ext_sh[0:35]),\n", + "]\n", + "\n", + "nsidc_clim_sh_area = [\n", + " np.nanmean(jan_area_sh[0:35]),\n", + " np.nanmean(feb_area_sh[0:35]),\n", + " np.nanmean(mar_area_sh[0:35]),\n", + " np.nanmean(apr_area_sh[0:35]),\n", + " np.nanmean(may_area_sh[0:35]),\n", + " np.nanmean(jun_area_sh[0:35]),\n", + " np.nanmean(jul_area_sh[0:35]),\n", + " np.nanmean(aug_area_sh[0:35]),\n", + " np.nanmean(sep_area_sh[0:35]),\n", + " np.nanmean(oct_area_sh[0:35]),\n", + " np.nanmean(nov_area_sh[0:35]),\n", + " np.nanmean(dec_area_sh[0:35]),\n", + "]\n", + "\n", + "# plt.plot(nsidc_clim_sh_area)" + ] + }, + { + "cell_type": "markdown", + "id": "230e78fa-4e86-499f-89ef-60605e2ab170", + "metadata": {}, + "source": [ + "# Define functions" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "4f8d57eb-8411-4b70-a200-35b99d3152f2", + "id": "4986f64d-9753-4904-a7b9-a98cc8947a98", "metadata": { "editable": true, "slideshow": { @@ -303,6 +569,44 @@ " )" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "6510f578-bebb-41d3-99d6-296d3c0e5f84", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "def setBoxColor(boxplot, colors):\n", + "\n", + " # Set edge color of the outside and median lines of the boxes\n", + " for element in [\"boxes\", \"medians\"]:\n", + " for box, color in zip(boxplot[element], colors):\n", + " plt.setp(box, color=color, linewidth=3)\n", + "\n", + " # Set the color of the whiskers and caps of the boxes\n", + " for element in [\"whiskers\", \"caps\"]:\n", + " for box, color in zip(\n", + " zip(boxplot[element][::2], boxplot[element][1::2]), colors\n", + " ):\n", + " plt.setp(box, color=color, linewidth=3)" + ] + }, + { + "cell_type": "markdown", + "id": "dbd856dc-f25b-40da-b5f3-d78b740ad926", + "metadata": {}, + "source": [ + "# Annual Mean Timeseries plots" + ] + }, { "cell_type": "code", "execution_count": null, @@ -318,6 +622,9 @@ }, "outputs": [], "source": [ + "# Northern hemisphere timeseries plot\n", + "tag = \"NH\"\n", + "\n", "ds1_area_ann = (tarea * ds1_ann[\"aice\"]).where(TLAT > 0).sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", "ds2_area_ann = (tarea * ds2_ann[\"aice\"]).where(TLAT > 0).sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", "\n", @@ -348,10 +655,10 @@ "da_plot_len_time_might_be_one(ds1_vhi_ann, alt_time=ds2_ann.time, color=\"red\")\n", "da_plot_len_time_might_be_one(ds2_vhi_ann, alt_time=ds1_ann.time, color=\"blue\")\n", "\n", - "plt.title(\"NH Annual Mean Integrated Timeseries\")\n", + "plt.title(tag + \" Annual Mean Hemispheric Integrated Timeseries\")\n", "plt.ylim((0, 5))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"NH Annual Mean Sea Ice Volume $m x 10^{13}$\")\n", + "plt.ylabel(tag + \" Sea Ice Volume $m^{3} x 10^{13}$\")\n", "plt.legend(handles=[p1, p2, p3, p4])\n", "\n", "ax = fig.add_subplot(3, 1, 2)\n", @@ -370,7 +677,7 @@ "\n", "plt.ylim((0, 0.5))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"NH Annual Mean Snow Volume $m x 10^{13}$\")\n", + "plt.ylabel(tag + \" Snow Volume $m^{3} x 10^{13}$\")\n", "plt.legend(handles=[p1, p2, p3, p4])\n", "\n", "ax = fig.add_subplot(3, 1, 3)\n", @@ -387,16 +694,16 @@ "da_plot_len_time_might_be_one(ds1_area_ann, alt_time=ds2_ann.time, color=\"red\")\n", "da_plot_len_time_might_be_one(ds2_area_ann, alt_time=ds1_ann.time, color=\"blue\")\n", "\n", - "plt.ylim((0, 15))\n", + "plt.ylim((0, 25))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"NH Annual Mean Sea Ice Area $m x 10^{12}$\")\n", + "plt.ylabel(tag + \" Sea Ice Area $m^{2} x 10^{12}$\")\n", "plt.legend(handles=[p1, p2, p3, p4])" ] }, { "cell_type": "code", "execution_count": null, - "id": "45366ccd-555b-49aa-93a2-51b83e802d16", + "id": "f3fb7098-2b98-4a30-98fc-8e25fd0b5d7f", "metadata": { "editable": true, "slideshow": { @@ -408,6 +715,9 @@ }, "outputs": [], "source": [ + "# Southern hemisphere timeseries plot\n", + "tag = \"SH\"\n", + "\n", "ds1_area_ann = (tarea * ds1_ann[\"aice\"]).where(TLAT < 0).sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", "ds2_area_ann = (tarea * ds2_ann[\"aice\"]).where(TLAT < 0).sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", "\n", @@ -417,6 +727,11 @@ "ds1_vhs_ann = (tarea * ds1_ann[\"hs\"]).where(TLAT < 0).sum(dim=[\"nj\", \"ni\"]) * 1.0e-13\n", "ds2_vhs_ann = (tarea * ds2_ann[\"hs\"]).where(TLAT < 0).sum(dim=[\"nj\", \"ni\"]) * 1.0e-13\n", "\n", + "p1 = mlines.Line2D([], [], color=\"lightgrey\", label=\"CESM1-LENS\")\n", + "p2 = mlines.Line2D([], [], color=\"lightblue\", label=\"CESM2-LENS\")\n", + "p3 = mlines.Line2D([], [], color=\"red\", label=case_name)\n", + "p4 = mlines.Line2D([], [], color=\"blue\", label=base_case_name)\n", + "\n", "fig = plt.figure(figsize=(10, 10), tight_layout=True)\n", "\n", "ax = fig.add_subplot(3, 1, 1)\n", @@ -433,10 +748,10 @@ "da_plot_len_time_might_be_one(ds1_vhi_ann, alt_time=ds2_ann.time, color=\"red\")\n", "da_plot_len_time_might_be_one(ds2_vhi_ann, alt_time=ds1_ann.time, color=\"blue\")\n", "\n", - "plt.title(\"SH Annual Mean Integrated Timeseries\")\n", - "plt.ylim((0, 3))\n", + "plt.title(tag + \" Annual Mean Hemispheric Integrated Timeseries\")\n", + "plt.ylim((0, 5))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"SH Annual Mean Sea Ice Volume $m x 10^{13}$\")\n", + "plt.ylabel(tag + \" Sea Ice Volume $m^{3} x 10^{13}$\")\n", "plt.legend(handles=[p1, p2, p3, p4])\n", "\n", "ax = fig.add_subplot(3, 1, 2)\n", @@ -455,7 +770,7 @@ "\n", "plt.ylim((0, 0.5))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"SH Annual Mean Snow Volume $m x 10^{13}$\")\n", + "plt.ylabel(tag + \" Snow Volume $m^{3} x 10^{13}$\")\n", "plt.legend(handles=[p1, p2, p3, p4])\n", "\n", "ax = fig.add_subplot(3, 1, 3)\n", @@ -472,16 +787,24 @@ "da_plot_len_time_might_be_one(ds1_area_ann, alt_time=ds2_ann.time, color=\"red\")\n", "da_plot_len_time_might_be_one(ds2_area_ann, alt_time=ds1_ann.time, color=\"blue\")\n", "\n", - "plt.ylim((0, 20))\n", + "plt.ylim((0, 25))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"SH Annual Mean Sea Ice Area $m x 10^{12}$\")\n", + "plt.ylabel(tag + \" Sea Ice Area $m^{2} x 10^{12}$\")\n", "plt.legend(handles=[p1, p2, p3, p4])" ] }, + { + "cell_type": "markdown", + "id": "817ac73e-7142-44f4-82de-e6921201115d", + "metadata": {}, + "source": [ + "# Annual cycle plots - Ice Area" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "de2232e9-2705-4894-b98a-a93082ae7f79", + "id": "a2afd92b-da90-4596-b1a0-6ed564f843c7", "metadata": { "editable": true, "slideshow": { @@ -493,108 +816,740 @@ }, "outputs": [], "source": [ - "### Read in the NSIDC data from files\n", - "\n", - "jan_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_01_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "feb_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_02_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "mar_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_03_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "apr_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_04_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "may_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_05_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "jun_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_06_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "jul_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_07_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "aug_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_08_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "sep_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_09_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "oct_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_10_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "nov_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_11_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "dec_nsidc = pd.read_csv(\n", - " os.path.join(path_nsidc, \"N_12_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", + "# get monthly means from test data\n", + "aice1_month = (\n", + " ds1[\"aice\"]\n", + " .isel(time=slice(-climo_nyears, None))\n", + " .groupby(\"time.month\")\n", + " .mean(dim=\"time\", skipna=True)\n", ")\n", - "\n", - "jan_area = jan_nsidc.iloc[:, 5].values\n", - "feb_area = feb_nsidc.iloc[:, 5].values\n", - "mar_area = mar_nsidc.iloc[:, 5].values\n", - "apr_area = apr_nsidc.iloc[:, 5].values\n", - "may_area = may_nsidc.iloc[:, 5].values\n", - "jun_area = jun_nsidc.iloc[:, 5].values\n", - "jul_area = jul_nsidc.iloc[:, 5].values\n", - "aug_area = aug_nsidc.iloc[:, 5].values\n", - "sep_area = sep_nsidc.iloc[:, 5].values\n", - "oct_area = oct_nsidc.iloc[:, 5].values\n", - "nov_area = nov_nsidc.iloc[:, 5].values\n", - "dec_area = dec_nsidc.iloc[:, 5].values\n", - "\n", - "jan_ext = jan_nsidc.iloc[:, 4].values\n", - "feb_ext = feb_nsidc.iloc[:, 4].values\n", - "mar_ext = mar_nsidc.iloc[:, 4].values\n", - "apr_ext = apr_nsidc.iloc[:, 4].values\n", - "may_ext = may_nsidc.iloc[:, 4].values\n", - "jun_ext = jun_nsidc.iloc[:, 4].values\n", - "jul_ext = jul_nsidc.iloc[:, 4].values\n", - "aug_ext = aug_nsidc.iloc[:, 4].values\n", - "sep_ext = sep_nsidc.iloc[:, 4].values\n", - "oct_ext = oct_nsidc.iloc[:, 4].values\n", - "nov_ext = nov_nsidc.iloc[:, 4].values\n", - "dec_ext = dec_nsidc.iloc[:, 4].values\n", - "\n", - "nsidc_clim_ext = [\n", - " np.nanmean(jan_ext[0:35]),\n", - " np.nanmean(feb_ext[0:35]),\n", - " np.nanmean(mar_ext[0:35]),\n", - " np.nanmean(apr_ext[0:35]),\n", - " np.nanmean(may_ext[0:35]),\n", - " np.nanmean(jun_ext[0:35]),\n", - " np.nanmean(jul_ext[0:35]),\n", - " np.nanmean(aug_ext[0:35]),\n", - " np.nanmean(sep_ext[0:35]),\n", - " np.nanmean(oct_ext[0:35]),\n", - " np.nanmean(nov_ext[0:35]),\n", - " np.nanmean(dec_ext[0:35]),\n", - "]\n", - "\n", - "nsidc_clim_area = [\n", - " np.nanmean(jan_area[0:35]),\n", - " np.nanmean(feb_area[0:35]),\n", - " np.nanmean(mar_area[0:35]),\n", - " np.nanmean(apr_area[0:35]),\n", - " np.nanmean(may_area[0:35]),\n", - " np.nanmean(jun_area[0:35]),\n", - " np.nanmean(jul_area[0:35]),\n", - " np.nanmean(aug_area[0:35]),\n", - " np.nanmean(sep_area[0:35]),\n", - " np.nanmean(oct_area[0:35]),\n", - " np.nanmean(nov_area[0:35]),\n", - " np.nanmean(dec_area[0:35]),\n", - "]\n", - "\n", - "# plt.plot(nsidc_clim)" - ] - }, + "aice2_month = (\n", + " ds2[\"aice\"]\n", + " .isel(time=slice(-climo_nyears, None))\n", + " .groupby(\"time.month\")\n", + " .mean(dim=\"time\", skipna=True)\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0f941b4b-34f9-4020-90fa-f196d396109d", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "# Northern hemisphere annual cycle plot\n", + "tag = \"NH\"\n", + "\n", + "mask_tmp1_nh = np.where(np.logical_and(aice1_month > 0.15, ds1[\"TLAT\"] > 0), 1.0, 0.0)\n", + "mask_tmp2_nh = np.where(np.logical_and(aice2_month > 0.15, ds1[\"TLAT\"] > 0), 1.0, 0.0)\n", + "\n", + "mask_nh_tmp = np.where(ds1[\"TLAT\"] > 0, tarea, 0.0)\n", + "mask_nh = xr.DataArray(data=mask_nh_tmp, dims=[\"nj\", \"ni\"])\n", + "\n", + "area1 = (aice1_month * mask_nh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", + "area2 = (aice2_month * mask_nh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", + "\n", + "p1 = mlines.Line2D([], [], color=\"lightgrey\", label=\"CESM1-LENS\")\n", + "p2 = mlines.Line2D([], [], color=\"lightblue\", label=\"CESM2-LENS\")\n", + "p3 = mlines.Line2D([], [], color=\"red\", label=case_name)\n", + "p4 = mlines.Line2D([], [], color=\"blue\", label=base_case_name)\n", + "p5 = mlines.Line2D([], [], color=\"black\", label=\"NSIDC\")\n", + "\n", + "months = np.linspace(1, 12, 12)\n", + "\n", + "for i in range(0, 38):\n", + " plt.plot(months, cesm1_aicetot_nh_month[i, :] * 1.0e-12, color=\"lightgrey\")\n", + "for i in range(0, 49):\n", + " plt.plot(months, cesm2_aicetot_nh_month[i, :] * 1.0e-12, color=\"lightblue\")\n", + "plt.plot(months, area1, color=\"red\")\n", + "plt.plot(months, area2, color=\"blue\")\n", + "plt.plot(months, nsidc_clim_nh_area, color=\"black\")\n", + "\n", + "plt.title(tag + \" Climatological Seasonal Cycle\")\n", + "plt.ylim((0, 30))\n", + "plt.xlabel(\"Month\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2} x 10^{12}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4, p5])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bdcfc214-ab3c-4444-86ff-6cb9bea19236", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "# Southern hemisphere annual cycle plot\n", + "tag = \"SH\"\n", + "\n", + "mask_tmp1_sh = np.where(np.logical_and(aice1_month > 0.15, ds1[\"TLAT\"] < 0), 1.0, 0.0)\n", + "mask_tmp2_sh = np.where(np.logical_and(aice2_month > 0.15, ds1[\"TLAT\"] < 0), 1.0, 0.0)\n", + "\n", + "mask_sh_tmp = np.where(ds1[\"TLAT\"] < 0, tarea, 0.0)\n", + "mask_sh = xr.DataArray(data=mask_sh_tmp, dims=[\"nj\", \"ni\"])\n", + "\n", + "area1 = (aice1_month * mask_sh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", + "area2 = (aice2_month * mask_sh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", + "\n", + "for i in range(0, 38):\n", + " plt.plot(months, cesm1_aicetot_sh_month[i, :] * 1.0e-12, color=\"lightgrey\")\n", + "for i in range(0, 49):\n", + " plt.plot(months, cesm2_aicetot_sh_month[i, :] * 1.0e-12, color=\"lightblue\")\n", + "plt.plot(months, area1, color=\"red\")\n", + "plt.plot(months, area2, color=\"blue\")\n", + "plt.plot(months, nsidc_clim_sh_area, color=\"black\")\n", + "\n", + "plt.title(tag + \" Climatological Seasonal Cycle\")\n", + "plt.ylim((0, 30))\n", + "plt.xlabel(\"Month\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2} x 10^{12}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4, p5])" + ] + }, + { + "cell_type": "markdown", + "id": "0175b649-7dc4-4658-aa4e-cde5b8ae4a4a", + "metadata": {}, + "source": [ + "# Annual cycle plots - Ice Volume" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6b96dcd0-aec3-4acd-a21a-64b7c476f234", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "# get monthly means from test data\n", + "hi1_month = (\n", + " ds1[\"hi\"]\n", + " .isel(time=slice(-climo_nyears, None))\n", + " .groupby(\"time.month\")\n", + " .mean(dim=\"time\", skipna=True)\n", + ")\n", + "hi2_month = (\n", + " ds2[\"hi\"]\n", + " .isel(time=slice(-climo_nyears, None))\n", + " .groupby(\"time.month\")\n", + " .mean(dim=\"time\", skipna=True)\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "10be50a9-9057-48e0-b8e6-93ff7c04c2ec", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "# Northern hemisphere annual cycle plot\n", + "tag = \"NH\"\n", + "\n", + "mask_tmp1_nh = np.where(np.logical_and(hi1_month > 0, ds1[\"TLAT\"] > 0), 1.0, 0.0)\n", + "mask_tmp2_nh = np.where(np.logical_and(hi2_month > 0, ds1[\"TLAT\"] > 0), 1.0, 0.0)\n", + "\n", + "mask_nh_tmp = np.where(ds1[\"TLAT\"] > 0, tarea, 0.0)\n", + "mask_nh = xr.DataArray(data=mask_nh_tmp, dims=[\"nj\", \"ni\"])\n", + "\n", + "vol1 = (hi1_month * mask_nh).sum([\"ni\", \"nj\"]) * 1.0e-13\n", + "vol2 = (hi2_month * mask_nh).sum([\"ni\", \"nj\"]) * 1.0e-13\n", + "\n", + "p1 = mlines.Line2D([], [], color=\"lightgrey\", label=\"CESM1-LENS\")\n", + "p2 = mlines.Line2D([], [], color=\"lightblue\", label=\"CESM2-LENS\")\n", + "p3 = mlines.Line2D([], [], color=\"red\", label=case_name)\n", + "p4 = mlines.Line2D([], [], color=\"blue\", label=base_case_name)\n", + "\n", + "months = np.linspace(1, 12, 12)\n", + "\n", + "for i in range(0, 38):\n", + " plt.plot(months, cesm1_hitot_nh_month[i, :] * 1.0e-13, color=\"lightgrey\")\n", + "for i in range(0, 49):\n", + " plt.plot(months, cesm2_hitot_nh_month[i, :] * 1.0e-13, color=\"lightblue\")\n", + "plt.plot(months, vol1, color=\"red\")\n", + "plt.plot(months, vol2, color=\"blue\")\n", + "\n", + "plt.title(tag + \" Climatological Seasonal Cycle\")\n", + "plt.ylim((0, 8))\n", + "plt.xlabel(\"Month\")\n", + "plt.ylabel(\"Sea Ice Volume $m^{3} x 10^{13}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9b1fa712-7f36-4e5b-b932-f0e50e6feab9", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "# Southern hemisphere annual cycle plot\n", + "tag = \"SH\"\n", + "\n", + "mask_tmp1_sh = np.where(np.logical_and(hi1_month > 0, ds1[\"TLAT\"] < 0), 1.0, 0.0)\n", + "mask_tmp2_sh = np.where(np.logical_and(hi2_month > 0, ds1[\"TLAT\"] < 0), 1.0, 0.0)\n", + "\n", + "mask_sh_tmp = np.where(ds1[\"TLAT\"] < 0, tarea, 0.0)\n", + "mask_sh = xr.DataArray(data=mask_sh_tmp, dims=[\"nj\", \"ni\"])\n", + "\n", + "vol1 = (hi1_month * mask_sh).sum([\"ni\", \"nj\"]) * 1.0e-13\n", + "vol2 = (hi2_month * mask_sh).sum([\"ni\", \"nj\"]) * 1.0e-13\n", + "\n", + "p1 = mlines.Line2D([], [], color=\"lightgrey\", label=\"CESM1-LENS\")\n", + "p2 = mlines.Line2D([], [], color=\"lightblue\", label=\"CESM2-LENS\")\n", + "p3 = mlines.Line2D([], [], color=\"red\", label=case_name)\n", + "p4 = mlines.Line2D([], [], color=\"blue\", label=base_case_name)\n", + "\n", + "months = np.linspace(1, 12, 12)\n", + "\n", + "for i in range(0, 38):\n", + " plt.plot(months, cesm1_hitot_sh_month[i, :] * 1.0e-13, color=\"lightgrey\")\n", + "for i in range(0, 49):\n", + " plt.plot(months, cesm2_hitot_sh_month[i, :] * 1.0e-13, color=\"lightblue\")\n", + "plt.plot(months, vol1, color=\"red\")\n", + "plt.plot(months, vol2, color=\"blue\")\n", + "\n", + "plt.title(tag + \" Climatological Seasonal Cycle\")\n", + "plt.ylim((0, 5))\n", + "plt.xlabel(\"Month\")\n", + "plt.ylabel(\"Sea Ice Volume $m^{3} x 10^{13}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4])" + ] + }, + { + "cell_type": "markdown", + "id": "160a9f24-49af-4900-81cf-389c09583fb4", + "metadata": {}, + "source": [ + "# Monthly Analysis for Minimum and Maximum Months" + ] + }, + { + "cell_type": "markdown", + "id": "51f1ba93-2694-4566-8589-91f2bc56ba89", + "metadata": {}, + "source": [ + "## NH\n", + "- Maximum - March\n", + "- Minimum - September" + ] + }, + { + "cell_type": "markdown", + "id": "0d45be87-a3e8-4348-9984-e44db4d7634b", + "metadata": {}, + "source": [ + "### Ice Area" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d116d72-6ae4-4480-89f4-dc9333d909aa", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "ds1_area = (tarea * ds1.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT > 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", + "ds2_area = (tarea * ds2.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT > 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "715d863b-7be6-4c16-b59b-260805deee18", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "tag = \"NH\"\n", + "\n", + "ds1_mar_nh = ds1_area.sel(time=(ds1_area.time.dt.month == 3))\n", + "ds2_mar_nh = ds2_area.sel(time=(ds2_area.time.dt.month == 3))\n", + "\n", + "cesm1_aicetot_nh_mar = ds_cesm1_aicetot_nh[\"aice_monthly\"].isel(nmonth=2)\n", + "cesm2_aicetot_nh_mar = ds_cesm2_aicetot_nh[\"aice_monthly\"].isel(nmonth=2)\n", + "\n", + "x1 = np.linspace(end_year - len(ds1_mar_nh.time), end_year, len(ds1_mar_nh.time))\n", + "x2 = np.linspace(end_year - len(ds2_mar_nh.time), base_end_year, len(ds2_mar_nh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_nh.year[60], ds_cesm1_aicetot_nh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_nh.year[110], ds_cesm2_aicetot_nh.year[145], 36)\n", + "obs_first_year = 0\n", + "if first_year > 1:\n", + " obs_first_year = 1979\n", + "x5 = np.linspace(1, 36, 36) + obs_first_year\n", + "\n", + "\n", + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", + "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", + "for i in range(0, 38):\n", + " ax.plot(\n", + " x3,\n", + " cesm1_aicetot_nh_mar.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-12,\n", + " color=\"lightgrey\",\n", + " )\n", + "for i in range(0, 49):\n", + " ax.plot(\n", + " x4,\n", + " cesm2_aicetot_nh_mar.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-12,\n", + " color=\"lightblue\",\n", + " )\n", + "plt_plot_len_x_might_be_one(ds1_mar_nh, x1, x2, color=\"red\")\n", + "plt_plot_len_x_might_be_one(ds2_mar_nh, x2, x1, color=\"blue\")\n", + "ax.plot(x5, mar_area_nh[0:36], color=\"black\")\n", + "\n", + "plt.title(tag + \" March Mean Sea Ice Area\")\n", + "plt.ylim((5, 25))\n", + "plt.xlabel(\"Year\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4, p5])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_aicetot_nh_mar.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_aicetot_nh_mar.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_mar_nh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_mar_nh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots3 = ax.boxplot(\n", + " mar_area_nh[0:35], showfliers=False, autorange=False, positions=[0.75]\n", + ")\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots3, 8 * [\"black\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" March Mean Sea Ice Area Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.ylim((5, 25))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6fe23323-c7f4-4156-8843-837fb63aced5", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "tag = \"NH\"\n", + "\n", + "ds1_sep_nh = ds1_area.sel(time=(ds1_area.time.dt.month == 9))\n", + "ds2_sep_nh = ds2_area.sel(time=(ds2_area.time.dt.month == 9))\n", + "\n", + "cesm1_aicetot_nh_sep = ds_cesm1_aicetot_nh[\"aice_monthly\"].isel(nmonth=8)\n", + "cesm2_aicetot_nh_sep = ds_cesm2_aicetot_nh[\"aice_monthly\"].isel(nmonth=8)\n", + "\n", + "x1 = np.linspace(end_year - len(ds1_sep_nh.time), end_year, len(ds1_sep_nh.time))\n", + "x2 = np.linspace(end_year - len(ds2_sep_nh.time), base_end_year, len(ds2_sep_nh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_nh.year[60], ds_cesm1_aicetot_nh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_nh.year[110], ds_cesm2_aicetot_nh.year[145], 36)\n", + "obs_first_year = 0\n", + "if first_year > 1:\n", + " obs_first_year = 1979\n", + "x5 = np.linspace(1, 36, 36) + obs_first_year\n", + "\n", + "\n", + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", + "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", + "for i in range(0, 38):\n", + " ax.plot(\n", + " x3,\n", + " cesm1_aicetot_nh_sep.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-12,\n", + " color=\"lightgrey\",\n", + " )\n", + "for i in range(0, 49):\n", + " ax.plot(\n", + " x4,\n", + " cesm2_aicetot_nh_sep.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-12,\n", + " color=\"lightblue\",\n", + " )\n", + "plt_plot_len_x_might_be_one(ds1_sep_nh, x1, x2, color=\"red\")\n", + "plt_plot_len_x_might_be_one(ds2_sep_nh, x2, x1, color=\"blue\")\n", + "ax.plot(x5, sep_area_nh[0:36], color=\"black\")\n", + "\n", + "plt.title(tag + \" September Mean Sea Ice Area\")\n", + "plt.ylim((0, 15))\n", + "plt.xlabel(\"Year\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4, p5])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_aicetot_nh_sep.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_aicetot_nh_sep.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_sep_nh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_sep_nh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots3 = ax.boxplot(\n", + " sep_area_nh[0:35], showfliers=False, autorange=False, positions=[0.75]\n", + ")\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots3, 8 * [\"black\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" September Mean Sea Ice Area Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.ylim((0, 15))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" + ] + }, + { + "cell_type": "markdown", + "id": "e68e1045-d92f-49ca-90b8-fa03de687032", + "metadata": {}, + "source": [ + "### Ice Volume" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26f8c5c5-fcfe-4d37-8f31-0142d613aeb7", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "ds1_vol = (tarea * ds1.hi).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT > 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-13\n", + "ds2_vol = (tarea * ds2.hi).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT > 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-13" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "daac85cc-dd35-45f1-b37b-582409059d88", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "tag = \"NH\"\n", + "\n", + "ds1_mar_nh = ds1_vol.sel(time=(ds1_vol.time.dt.month == 3))\n", + "ds2_mar_nh = ds2_vol.sel(time=(ds2_vol.time.dt.month == 3))\n", + "\n", + "cesm1_hitot_nh_mar = ds_cesm1_hitot_nh[\"hi_monthly\"].isel(nmonth=2)\n", + "cesm2_hitot_nh_mar = ds_cesm2_hitot_nh[\"hi_monthly\"].isel(nmonth=2)\n", + "\n", + "x1 = np.linspace(end_year - len(ds1_mar_nh.time), end_year, len(ds1_mar_nh.time))\n", + "x2 = np.linspace(end_year - len(ds2_mar_nh.time), base_end_year, len(ds2_mar_nh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_nh.year[60], ds_cesm1_aicetot_nh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_nh.year[110], ds_cesm2_aicetot_nh.year[145], 36)\n", + "obs_first_year = 0\n", + "if first_year > 1:\n", + " obs_first_year = 1979\n", + "\n", + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", + "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", + "for i in range(0, 38):\n", + " ax.plot(\n", + " x3,\n", + " cesm1_hitot_nh_mar.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-13,\n", + " color=\"lightgrey\",\n", + " )\n", + "for i in range(0, 49):\n", + " ax.plot(\n", + " x4,\n", + " cesm2_hitot_nh_mar.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-13,\n", + " color=\"lightblue\",\n", + " )\n", + "plt_plot_len_x_might_be_one(ds1_mar_nh, x1, x2, color=\"red\")\n", + "plt_plot_len_x_might_be_one(ds2_mar_nh, x2, x1, color=\"blue\")\n", + "\n", + "plt.title(tag + \" March Mean Sea Ice Volume\")\n", + "plt.ylim((0, 10))\n", + "plt.xlabel(\"Year\")\n", + "plt.ylabel(\"Sea Ice Volume $m^{3}x10^{13}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_hitot_nh_mar.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\")) * 1.0e-13\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_hitot_nh_mar.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-13\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_mar_nh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_mar_nh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" March Mean Sea Ice Volume Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{3}x10^{13}$\")\n", + "plt.ylim((0, 10))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1b15bc53-c4be-42b2-8691-451cdc73aee8", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "tag = \"NH\"\n", + "\n", + "ds1_sep_nh = ds1_vol.sel(time=(ds1_vol.time.dt.month == 9))\n", + "ds2_sep_nh = ds2_vol.sel(time=(ds2_vol.time.dt.month == 9))\n", + "\n", + "cesm1_hitot_nh_sep = ds_cesm1_hitot_nh[\"hi_monthly\"].isel(nmonth=8)\n", + "cesm2_hitot_nh_sep = ds_cesm2_hitot_nh[\"hi_monthly\"].isel(nmonth=8)\n", + "\n", + "x1 = np.linspace(end_year - len(ds1_sep_nh.time), end_year, len(ds1_sep_nh.time))\n", + "x2 = np.linspace(end_year - len(ds2_sep_nh.time), base_end_year, len(ds2_sep_nh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_nh.year[60], ds_cesm1_aicetot_nh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_nh.year[110], ds_cesm2_aicetot_nh.year[145], 36)\n", + "obs_first_year = 0\n", + "if first_year > 1:\n", + " obs_first_year = 1979\n", + "\n", + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", + "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", + "for i in range(0, 38):\n", + " ax.plot(\n", + " x3,\n", + " cesm1_hitot_nh_sep.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-13,\n", + " color=\"lightgrey\",\n", + " )\n", + "for i in range(0, 49):\n", + " ax.plot(\n", + " x4,\n", + " cesm2_hitot_nh_sep.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-13,\n", + " color=\"lightblue\",\n", + " )\n", + "plt_plot_len_x_might_be_one(ds1_sep_nh, x1, x2, color=\"red\")\n", + "plt_plot_len_x_might_be_one(ds2_sep_nh, x2, x1, color=\"blue\")\n", + "\n", + "plt.title(tag + \" September Mean Sea Ice Volume\")\n", + "plt.ylim((0, 6))\n", + "plt.xlabel(\"Year\")\n", + "plt.ylabel(\"Sea Ice Volume $m^{3}x10^{13}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_hitot_nh_sep.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\")) * 1.0e-13\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_hitot_nh_sep.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-13\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_sep_nh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_sep_nh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" September Mean Sea Ice Volume Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{3}x10^{13}$\")\n", + "plt.ylim((0, 6))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" + ] + }, + { + "cell_type": "markdown", + "id": "cbc72c72-29b9-4c8d-a5e9-1753b485fd02", + "metadata": {}, + "source": [ + "## SH\n", + "- Maximum - September\n", + "- Minimum - February" + ] + }, + { + "cell_type": "markdown", + "id": "05a5993d-f2ad-4216-8234-008c85e0cb39", + "metadata": {}, + "source": [ + "### Ice Area" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3112d1e9-cf3a-4c85-8bd7-f0aea5e99717", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "ds1_area = (tarea * ds1.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT < 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", + "ds2_area = (tarea * ds2.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT < 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "23ab7224-a908-4efd-9a79-45e50e2841b1", + "id": "56cbf59c-69c5-45d9-a0b0-38f490161484", "metadata": { "editable": true, "slideshow": { @@ -606,107 +1561,91 @@ }, "outputs": [], "source": [ - "### Read in the SH NSIDC data from files\n", + "tag = \"SH\"\n", "\n", - "jan_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_01_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "feb_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_02_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "mar_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_03_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "apr_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_04_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "may_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_05_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "jun_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_06_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "jul_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_07_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "aug_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_08_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "sep_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_09_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "oct_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_10_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "nov_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_11_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", - "dec_nsidc_sh = pd.read_csv(\n", - " os.path.join(path_nsidc, \"S_12_extent_v3.0.csv\"), na_values=[\"-99.9\"]\n", - ")\n", + "ds1_feb_sh = ds1_area.sel(time=(ds1_area.time.dt.month == 2))\n", + "ds2_feb_sh = ds2_area.sel(time=(ds2_area.time.dt.month == 2))\n", "\n", - "jan_area_sh = jan_nsidc_sh.iloc[:, 5].values\n", - "feb_area_sh = feb_nsidc_sh.iloc[:, 5].values\n", - "mar_area_sh = mar_nsidc_sh.iloc[:, 5].values\n", - "apr_area_sh = apr_nsidc_sh.iloc[:, 5].values\n", - "may_area_sh = may_nsidc_sh.iloc[:, 5].values\n", - "jun_area_sh = jun_nsidc_sh.iloc[:, 5].values\n", - "jul_area_sh = jul_nsidc_sh.iloc[:, 5].values\n", - "aug_area_sh = aug_nsidc_sh.iloc[:, 5].values\n", - "sep_area_sh = sep_nsidc_sh.iloc[:, 5].values\n", - "oct_area_sh = oct_nsidc_sh.iloc[:, 5].values\n", - "nov_area_sh = nov_nsidc_sh.iloc[:, 5].values\n", - "dec_area_sh = dec_nsidc_sh.iloc[:, 5].values\n", + "cesm1_aicetot_sh_mar = ds_cesm1_aicetot_sh[\"aice_monthly\"].isel(nmonth=1)\n", + "cesm2_aicetot_sh_mar = ds_cesm2_aicetot_sh[\"aice_monthly\"].isel(nmonth=1)\n", "\n", - "jan_ext_sh = jan_nsidc_sh.iloc[:, 4].values\n", - "feb_ext_sh = feb_nsidc_sh.iloc[:, 4].values\n", - "mar_ext_sh = mar_nsidc_sh.iloc[:, 4].values\n", - "apr_ext_sh = apr_nsidc_sh.iloc[:, 4].values\n", - "may_ext_sh = may_nsidc_sh.iloc[:, 4].values\n", - "jun_ext_sh = jun_nsidc_sh.iloc[:, 4].values\n", - "jul_ext_sh = jul_nsidc_sh.iloc[:, 4].values\n", - "aug_ext_sh = aug_nsidc_sh.iloc[:, 4].values\n", - "sep_ext_sh = sep_nsidc_sh.iloc[:, 4].values\n", - "oct_ext_sh = oct_nsidc_sh.iloc[:, 4].values\n", - "nov_ext_sh = nov_nsidc_sh.iloc[:, 4].values\n", - "dec_ext_sh = dec_nsidc_sh.iloc[:, 4].values\n", + "x1 = np.linspace(end_year - len(ds1_feb_sh.time), end_year, len(ds1_feb_sh.time))\n", + "x2 = np.linspace(end_year - len(ds2_feb_sh.time), base_end_year, len(ds2_feb_sh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_sh.year[60], ds_cesm1_aicetot_sh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_sh.year[110], ds_cesm2_aicetot_sh.year[145], 36)\n", + "obs_first_year = 0\n", + "if first_year > 1:\n", + " obs_first_year = 1979\n", + "x5 = np.linspace(1, 36, 36) + obs_first_year\n", "\n", - "nsidc_clim_sh_ext = [\n", - " np.nanmean(jan_ext_sh[0:35]),\n", - " np.nanmean(feb_ext_sh[0:35]),\n", - " np.nanmean(mar_ext_sh[0:35]),\n", - " np.nanmean(apr_ext_sh[0:35]),\n", - " np.nanmean(may_ext_sh[0:35]),\n", - " np.nanmean(jun_ext_sh[0:35]),\n", - " np.nanmean(jul_ext_sh[0:35]),\n", - " np.nanmean(aug_ext_sh[0:35]),\n", - " np.nanmean(sep_ext_sh[0:35]),\n", - " np.nanmean(oct_ext_sh[0:35]),\n", - " np.nanmean(nov_ext_sh[0:35]),\n", - " np.nanmean(dec_ext_sh[0:35]),\n", - "]\n", "\n", - "nsidc_clim_sh_area = [\n", - " np.nanmean(jan_area_sh[0:35]),\n", - " np.nanmean(feb_area_sh[0:35]),\n", - " np.nanmean(mar_area_sh[0:35]),\n", - " np.nanmean(apr_area_sh[0:35]),\n", - " np.nanmean(may_area_sh[0:35]),\n", - " np.nanmean(jun_area_sh[0:35]),\n", - " np.nanmean(jul_area_sh[0:35]),\n", - " np.nanmean(aug_area_sh[0:35]),\n", - " np.nanmean(sep_area_sh[0:35]),\n", - " np.nanmean(oct_area_sh[0:35]),\n", - " np.nanmean(nov_area_sh[0:35]),\n", - " np.nanmean(dec_area_sh[0:35]),\n", - "]\n", - "# plt.plot(nsidc_clim_sh)" + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", + "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", + "for i in range(0, 38):\n", + " ax.plot(\n", + " x3,\n", + " cesm1_aicetot_sh_mar.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-12,\n", + " color=\"lightgrey\",\n", + " )\n", + "for i in range(0, 49):\n", + " ax.plot(\n", + " x4,\n", + " cesm2_aicetot_sh_mar.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-12,\n", + " color=\"lightblue\",\n", + " )\n", + "plt_plot_len_x_might_be_one(ds1_feb_sh, x1, x2, color=\"red\")\n", + "plt_plot_len_x_might_be_one(ds2_feb_sh, x2, x1, color=\"blue\")\n", + "ax.plot(x5, feb_area_sh[0:36], color=\"black\")\n", + "\n", + "plt.title(tag + \" February Mean Sea Ice Area\")\n", + "plt.ylim((0, 10))\n", + "plt.xlabel(\"Year\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4, p5])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_aicetot_sh_mar.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_aicetot_sh_mar.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_feb_sh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_feb_sh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots3 = ax.boxplot(\n", + " feb_area_sh[0:35], showfliers=False, autorange=False, positions=[0.75]\n", + ")\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots3, 8 * [\"black\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" February Mean Sea Ice Area Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.ylim((0, 10))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" ] }, { "cell_type": "code", "execution_count": null, - "id": "dcfc33a9-1dce-4dc7-95e3-dbdccee3575a", + "id": "82a58805-082b-43d6-a0ec-49cc9725cfdd", "metadata": { "editable": true, "slideshow": { @@ -718,60 +1657,99 @@ }, "outputs": [], "source": [ - "aice1_month = (\n", - " ds1[\"aice\"]\n", - " .isel(time=slice(-climo_nyears, None))\n", - " .groupby(\"time.month\")\n", - " .mean(dim=\"time\", skipna=True)\n", - ")\n", - "aice2_month = (\n", - " ds2[\"aice\"]\n", - " .isel(time=slice(-climo_nyears, None))\n", - " .groupby(\"time.month\")\n", - " .mean(dim=\"time\", skipna=True)\n", - ")\n", - "mask_tmp1 = np.where(np.logical_and(aice1_month > 0.15, ds1[\"TLAT\"] > 0), 1.0, 0.0)\n", - "mask_tmp2 = np.where(np.logical_and(aice2_month > 0.15, ds1[\"TLAT\"] > 0), 1.0, 0.0)\n", - "\n", - "mask_ext1 = xr.DataArray(data=mask_tmp1, dims=[\"month\", \"nj\", \"ni\"])\n", - "mask_ext2 = xr.DataArray(data=mask_tmp2, dims=[\"month\", \"nj\", \"ni\"])\n", + "tag = \"SH\"\n", "\n", - "mask_nh_tmp = np.where(ds1[\"TLAT\"] > 0, tarea, 0.0)\n", - "mask_nh = xr.DataArray(data=mask_nh_tmp, dims=[\"nj\", \"ni\"])\n", + "ds1_sep_sh = ds1_area.sel(time=(ds1_area.time.dt.month == 9))\n", + "ds2_sep_sh = ds2_area.sel(time=(ds2_area.time.dt.month == 9))\n", "\n", - "ext1 = (mask_ext1 * tarea).sum([\"ni\", \"nj\"]) * 1.0e-12\n", - "ext2 = (mask_ext2 * tarea).sum([\"ni\", \"nj\"]) * 1.0e-12\n", + "cesm1_aicetot_sh_sep = ds_cesm1_aicetot_sh[\"aice_monthly\"].isel(nmonth=8)\n", + "cesm2_aicetot_sh_sep = ds_cesm2_aicetot_sh[\"aice_monthly\"].isel(nmonth=8)\n", "\n", - "area1 = (aice1_month * mask_nh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", - "area2 = (aice2_month * mask_nh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", + "x1 = np.linspace(end_year - len(ds1_sep_sh.time), end_year, len(ds1_sep_sh.time))\n", + "x2 = np.linspace(end_year - len(ds2_sep_sh.time), base_end_year, len(ds2_sep_sh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_sh.year[60], ds_cesm1_aicetot_sh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_sh.year[110], ds_cesm2_aicetot_sh.year[145], 36)\n", + "obs_first_year = 0\n", + "if first_year > 1:\n", + " obs_first_year = 1979\n", + "x5 = np.linspace(1, 36, 36) + obs_first_year\n", "\n", - "p1 = mlines.Line2D([], [], color=\"lightgrey\", label=\"CESM1-LENS\")\n", - "p2 = mlines.Line2D([], [], color=\"lightblue\", label=\"CESM2-LENS\")\n", - "p3 = mlines.Line2D([], [], color=\"red\", label=case_name)\n", - "p4 = mlines.Line2D([], [], color=\"blue\", label=base_case_name)\n", - "p5 = mlines.Line2D([], [], color=\"black\", label=\"NSIDC\")\n", "\n", - "months = np.linspace(1, 12, 12)\n", + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", "for i in range(0, 38):\n", - " plt.plot(months, cesm1_aicetot_nh_month[i, :] * 1.0e-12, color=\"lightgrey\")\n", + " ax.plot(\n", + " x3,\n", + " cesm1_aicetot_sh_sep.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-12,\n", + " color=\"lightgrey\",\n", + " )\n", "for i in range(0, 49):\n", - " plt.plot(months, cesm2_aicetot_nh_month[i, :] * 1.0e-12, color=\"lightblue\")\n", - "plt.plot(months, area1, color=\"red\")\n", - "plt.plot(months, area2, color=\"blue\")\n", - "plt.plot(months, nsidc_clim_area, color=\"black\")\n", + " ax.plot(\n", + " x4,\n", + " cesm2_aicetot_sh_sep.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-12,\n", + " color=\"lightblue\",\n", + " )\n", + "plt_plot_len_x_might_be_one(ds1_sep_sh, x1, x2, color=\"red\")\n", + "plt_plot_len_x_might_be_one(ds2_sep_sh, x2, x1, color=\"blue\")\n", + "ax.plot(x5, sep_area_sh[0:36], color=\"black\")\n", "\n", - "plt.title(\"NH Climatological Seasonal Cycle\")\n", - "plt.ylim((0, 25))\n", - "plt.xlabel(\"Month\")\n", - "plt.ylabel(\"Climatological Seasonal Cycle Ice Area $m x 10^{12}$\")\n", - "plt.legend(handles=[p1, p2, p3, p4, p5])" + "plt.title(tag + \" September Mean Sea Ice Area\")\n", + "plt.ylim((10, 30))\n", + "plt.xlabel(\"Year\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4, p5])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_aicetot_sh_sep.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_aicetot_sh_sep.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-12\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_sep_sh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_sep_sh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots3 = ax.boxplot(\n", + " sep_area_sh[0:35], showfliers=False, autorange=False, positions=[0.75]\n", + ")\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots3, 8 * [\"black\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" September Mean Sea Ice Area Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{2}x10^{12}$\")\n", + "plt.ylim((10, 30))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" + ] + }, + { + "cell_type": "markdown", + "id": "a953dd44-1ae4-41d8-afd5-0a00907cdb9a", + "metadata": {}, + "source": [ + "### Ice Volume" ] }, { "cell_type": "code", "execution_count": null, - "id": "bdcfc214-ab3c-4444-86ff-6cb9bea19236", + "id": "aae93437-7ba5-46a1-9e5a-aa2141e9a0f6", "metadata": { "editable": true, "slideshow": { @@ -783,40 +1761,18 @@ }, "outputs": [], "source": [ - "mask_tmp1_sh = np.where(np.logical_and(aice1_month > 0.15, ds1[\"TLAT\"] < 0), 1.0, 0.0)\n", - "mask_tmp2_sh = np.where(np.logical_and(aice2_month > 0.15, ds1[\"TLAT\"] < 0), 1.0, 0.0)\n", - "\n", - "mask_ext1_sh = xr.DataArray(data=mask_tmp1_sh, dims=[\"month\", \"nj\", \"ni\"])\n", - "mask_ext2_sh = xr.DataArray(data=mask_tmp2_sh, dims=[\"month\", \"nj\", \"ni\"])\n", - "\n", - "mask_sh_tmp = np.where(ds1[\"TLAT\"] < 0, tarea, 0.0)\n", - "mask_sh = xr.DataArray(data=mask_sh_tmp, dims=[\"nj\", \"ni\"])\n", - "\n", - "ext1_sh = (mask_ext1_sh * tarea).sum([\"ni\", \"nj\"]) * 1.0e-12\n", - "ext2_sh = (mask_ext2_sh * tarea).sum([\"ni\", \"nj\"]) * 1.0e-12\n", - "\n", - "area1 = (aice1_month * mask_sh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", - "area2 = (aice2_month * mask_sh).sum([\"ni\", \"nj\"]) * 1.0e-12\n", - "\n", - "for i in range(0, 38):\n", - " plt.plot(months, cesm1_aicetot_sh_month[i, :] * 1.0e-12, color=\"lightgrey\")\n", - "for i in range(0, 49):\n", - " plt.plot(months, cesm2_aicetot_sh_month[i, :] * 1.0e-12, color=\"lightblue\")\n", - "plt.plot(months, area1, color=\"red\")\n", - "plt.plot(months, area2, color=\"blue\")\n", - "plt.plot(months, nsidc_clim_sh_area, color=\"black\")\n", - "\n", - "plt.title(\"SH Climatological Seasonal Cycle\")\n", - "plt.ylim((0, 30))\n", - "plt.xlabel(\"Month\")\n", - "plt.ylabel(\"Climatological Seasonal Cycle Ice Area $m x 10^{12}$\")\n", - "plt.legend(handles=[p1, p2, p3, p4, p5])" + "ds1_vol = (tarea * ds1.hi).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT < 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-13\n", + "ds2_vol = (tarea * ds2.hi).isel(time=slice(-climo_nyears * 12, None)).where(\n", + " TLAT < 0\n", + ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-13" ] }, { "cell_type": "code", "execution_count": null, - "id": "00fc5097-af7d-4cf2-94ab-bb4e0a63960c", + "id": "c5e9f371-23d8-48e5-83bd-d05f62007dfc", "metadata": { "editable": true, "slideshow": { @@ -828,55 +1784,83 @@ }, "outputs": [], "source": [ - "ds1_area = (tarea * ds1.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", - " TLAT > 0\n", - ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", - "ds2_area = (tarea * ds2.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", - " TLAT > 0\n", - ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", + "tag = \"SH\"\n", "\n", - "ds1_sep = ds1_area.sel(time=(ds1_area.time.dt.month == 9))\n", - "ds2_sep = ds2_area.sel(time=(ds2_area.time.dt.month == 9))\n", + "ds1_feb_sh = ds1_vol.sel(time=(ds1_vol.time.dt.month == 3))\n", + "ds2_feb_sh = ds2_vol.sel(time=(ds2_vol.time.dt.month == 3))\n", "\n", - "cesm1_aicetot_nh_sep = ds_cesm1_aicetot_nh[\"aice_monthly\"].isel(nmonth=8)\n", - "cesm2_aicetot_nh_sep = ds_cesm2_aicetot_nh[\"aice_monthly\"].isel(nmonth=8)\n", + "cesm1_hitot_sh_mar = ds_cesm1_hitot_sh[\"hi_monthly\"].isel(nmonth=2)\n", + "cesm2_hitot_sh_mar = ds_cesm2_hitot_sh[\"hi_monthly\"].isel(nmonth=2)\n", "\n", - "x1 = np.linspace(end_year - len(ds1_sep.time), end_year, len(ds1_sep.time))\n", - "x2 = np.linspace(end_year - len(ds2_sep.time), base_end_year, len(ds2_sep.time))\n", - "x3 = np.linspace(ds_cesm1_aicetot_nh.year[60], ds_cesm1_aicetot_nh.year[95], 36)\n", - "x4 = np.linspace(ds_cesm2_aicetot_nh.year[110], ds_cesm2_aicetot_nh.year[145], 36)\n", + "x1 = np.linspace(end_year - len(ds1_feb_sh.time), end_year, len(ds1_feb_sh.time))\n", + "x2 = np.linspace(end_year - len(ds2_feb_sh.time), base_end_year, len(ds2_feb_sh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_sh.year[60], ds_cesm1_aicetot_sh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_sh.year[110], ds_cesm2_aicetot_sh.year[145], 36)\n", "obs_first_year = 0\n", "if first_year > 1:\n", " obs_first_year = 1979\n", - "x5 = np.linspace(1, 36, 36) + obs_first_year\n", "\n", + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", + "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", "for i in range(0, 38):\n", - " plt.plot(\n", + " ax.plot(\n", " x3,\n", - " cesm1_aicetot_nh_sep.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-12,\n", + " cesm1_hitot_sh_mar.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-13,\n", " color=\"lightgrey\",\n", " )\n", "for i in range(0, 49):\n", - " plt.plot(\n", + " ax.plot(\n", " x4,\n", - " cesm2_aicetot_nh_sep.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-12,\n", + " cesm2_hitot_sh_mar.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-13,\n", " color=\"lightblue\",\n", " )\n", - "plt_plot_len_x_might_be_one(ds1_sep, x1, x2, color=\"red\")\n", - "plt_plot_len_x_might_be_one(ds2_sep, x2, x1, color=\"blue\")\n", - "plt.plot(x5, sep_area[0:36], color=\"black\")\n", + "plt_plot_len_x_might_be_one(ds1_feb_sh, x1, x2, color=\"red\")\n", + "plt_plot_len_x_might_be_one(ds2_feb_sh, x2, x1, color=\"blue\")\n", "\n", - "plt.title(\"NH September Mean Sea Ice Area\")\n", - "plt.ylim((0, 25))\n", + "plt.title(tag + \" February Mean Sea Ice Volume\")\n", + "plt.ylim((0, 2))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"Sea Ice Area $mx10^{12}$\")\n", - "plt.legend(handles=[p1, p2, p3, p4, p5])" + "plt.ylabel(\"Sea Ice Volume $m^{3}x10^{13}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_hitot_sh_mar.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\")) * 1.0e-13\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_hitot_sh_mar.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-13\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_feb_sh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_feb_sh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" February Mean Sea Ice Volume Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{3}x10^{13}$\")\n", + "plt.ylim((0, 2))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" ] }, { "cell_type": "code", "execution_count": null, - "id": "2f26a3f2-6a7c-4878-a352-f289a7efbd81", + "id": "9a78308f-a7fc-4872-ae9c-80cb51f740e5", "metadata": { "editable": true, "slideshow": { @@ -888,54 +1872,85 @@ }, "outputs": [], "source": [ - "ds1_area_sh = (tarea * ds1.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", - " TLAT < 0\n", - ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", - "ds2_area_sh = (tarea * ds2.aice).isel(time=slice(-climo_nyears * 12, None)).where(\n", - " TLAT < 0\n", - ").sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", - "\n", - "ds1_feb_sh = ds1_area_sh.sel(time=(ds1_area_sh.time.dt.month == 2))\n", - "ds2_feb_sh = ds2_area_sh.sel(time=(ds2_area_sh.time.dt.month == 2))\n", + "tag = \"SH\"\n", "\n", - "ds1_sep_sh = ds1_area_sh.sel(time=(ds1_area_sh.time.dt.month == 9))\n", - "ds2_sep_sh = ds2_area_sh.sel(time=(ds2_area_sh.time.dt.month == 9))\n", - "\n", - "cesm1_aicetot_sh_sep = ds_cesm1_aicetot_sh[\"aice_monthly\"].isel(nmonth=8)\n", - "cesm2_aicetot_sh_sep = ds_cesm2_aicetot_sh[\"aice_monthly\"].isel(nmonth=8)\n", - "\n", - "x1 = np.linspace(end_year - len(ds1_sep.time), end_year, len(ds1_sep.time))\n", - "x2 = np.linspace(end_year - len(ds2_sep.time), base_end_year, len(ds2_sep.time))\n", - "x3 = np.linspace(ds_cesm1_aicetot_nh.year[60], ds_cesm1_aicetot_nh.year[95], 36)\n", - "x4 = np.linspace(ds_cesm2_aicetot_nh.year[110], ds_cesm2_aicetot_nh.year[145], 36)\n", + "ds1_sep_sh = ds1_vol.sel(time=(ds1_vol.time.dt.month == 9))\n", + "ds2_sep_sh = ds2_vol.sel(time=(ds2_vol.time.dt.month == 9))\n", "\n", + "cesm1_hitot_sh_sep = ds_cesm1_hitot_sh[\"hi_monthly\"].isel(nmonth=8)\n", + "cesm2_hitot_sh_sep = ds_cesm2_hitot_sh[\"hi_monthly\"].isel(nmonth=8)\n", "\n", + "x1 = np.linspace(end_year - len(ds1_sep_sh.time), end_year, len(ds1_sep_sh.time))\n", + "x2 = np.linspace(end_year - len(ds2_sep_sh.time), base_end_year, len(ds2_sep_sh.time))\n", + "x3 = np.linspace(ds_cesm1_aicetot_sh.year[60], ds_cesm1_aicetot_sh.year[95], 36)\n", + "x4 = np.linspace(ds_cesm2_aicetot_sh.year[110], ds_cesm2_aicetot_sh.year[145], 36)\n", "obs_first_year = 0\n", "if first_year > 1:\n", " obs_first_year = 1979\n", - "x5 = np.linspace(1, 36, 36) + obs_first_year\n", "\n", + "# Make Plot - two subplots - note it's nrow x ncol x index (starting upper left)\n", + "fig = plt.figure(figsize=(20, 7))\n", + "\n", + "### First panel, timeseries\n", + "ax = fig.add_subplot(1, 2, 1)\n", "for i in range(0, 38):\n", - " plt.plot(\n", + " ax.plot(\n", " x3,\n", - " cesm1_aicetot_sh_sep.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-12,\n", + " cesm1_hitot_sh_sep.isel(n_members=i, nyr=slice(60, 96)) * 1.0e-13,\n", " color=\"lightgrey\",\n", " )\n", "for i in range(0, 49):\n", - " plt.plot(\n", + " ax.plot(\n", " x4,\n", - " cesm2_aicetot_sh_sep.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-12,\n", + " cesm2_hitot_sh_sep.isel(n_members=i, nyr=slice(110, 146)) * 1.0e-13,\n", " color=\"lightblue\",\n", " )\n", "plt_plot_len_x_might_be_one(ds1_sep_sh, x1, x2, color=\"red\")\n", "plt_plot_len_x_might_be_one(ds2_sep_sh, x2, x1, color=\"blue\")\n", - "plt.plot(x5, sep_area_sh[0:36], color=\"black\")\n", "\n", - "plt.title(\"SH September Mean Sea Ice Area\")\n", - "plt.ylim((0, 25))\n", + "plt.title(tag + \" September Mean Sea Ice Volume\")\n", + "plt.ylim((0, 6))\n", "plt.xlabel(\"Year\")\n", - "plt.ylabel(\"Sea Ice Area $mx10^{12}$\")\n", - "plt.legend(handles=[p1, p2, p3, p4, p5])" + "plt.ylabel(\"Sea Ice Volume $m^{3}x10^{13}$\")\n", + "plt.legend(handles=[p1, p2, p3, p4])\n", + "\n", + "### Second panel, boxplot\n", + "ax = fig.add_subplot(1, 2, 2)\n", + "# get just last years of large ensembles and one dimensionalize them\n", + "cesm1_tmp = (\n", + " cesm1_hitot_sh_sep.isel(nyr=slice(60, 96)).stack(new=(\"n_members\", \"nyr\")) * 1.0e-13\n", + ")\n", + "cesm2_tmp = (\n", + " cesm2_hitot_sh_sep.isel(nyr=slice(110, 146)).stack(new=(\"n_members\", \"nyr\"))\n", + " * 1.0e-13\n", + ")\n", + "\n", + "# plot boxes\n", + "boxplots1 = ax.boxplot(ds1_sep_sh, showfliers=False, autorange=False, positions=[0.25])\n", + "boxplots2 = ax.boxplot(ds2_sep_sh, showfliers=False, autorange=False, positions=[0.5])\n", + "boxplots4 = ax.boxplot(cesm1_tmp, showfliers=False, autorange=False, positions=[1.0])\n", + "boxplots5 = ax.boxplot(cesm2_tmp, showfliers=False, autorange=False, positions=[1.25])\n", + "\n", + "# set colors for each box\n", + "setBoxColor(boxplots1, 8 * [\"red\"])\n", + "setBoxColor(boxplots2, 8 * [\"blue\"])\n", + "setBoxColor(boxplots4, 8 * [\"lightgrey\"])\n", + "setBoxColor(boxplots5, 8 * [\"lightblue\"])\n", + "\n", + "# set plot details\n", + "plt.title(tag + \" September Mean Sea Ice Volume Range\")\n", + "plt.ylabel(\"Sea Ice Area $m^{3}x10^{13}$\")\n", + "plt.ylim((0, 6))\n", + "plt.xlim([0, 1.5])\n", + "plt.xticks(visible=False)" + ] + }, + { + "cell_type": "markdown", + "id": "434453cd-b250-4786-b1e2-c56830a9ff80", + "metadata": {}, + "source": [ + "# Labrador Sea Timeseries" ] }, { @@ -964,15 +1979,27 @@ "ds1_lab = (mask * tarea * ds1.aice).sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", "ds2_lab = (mask * tarea * ds2.aice).sum(dim=[\"nj\", \"ni\"]) * 1.0e-12\n", "\n", - "ds1_lab.plot(color=\"red\")\n", - "ds2_lab.plot(color=\"blue\")\n", + "# just want maximum extent (so March)\n", + "ds1_lab_mar = ds1_lab.sel(time=ds1_lab.time.dt.month == 3)\n", + "ds2_lab_mar = ds2_lab.sel(time=ds2_lab.time.dt.month == 3)\n", "\n", - "plt.title(\"Labrador Sea Montly Mean Sea Ice Area\")\n", + "ds1_lab_mar.plot(color=\"red\")\n", + "ds2_lab_mar.plot(color=\"blue\")\n", + "\n", + "plt.title(\"Labrador Sea March Mean Sea Ice Area\")\n", "plt.ylim((0, 10))\n", - "plt.xlabel(\"Month\")\n", + "plt.xlabel(\"Year\")\n", "plt.ylabel(\"Labrador Sea Ice Area $m x 10^{12}$\")\n", "plt.legend([case_name, base_case_name])" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4b5a2683-61de-4a4d-8f22-d05d185977c2", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {