From 44fe9e6a147a2e7374c781b187445960c78cda51 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Tue, 14 Jan 2025 10:45:17 -0700 Subject: [PATCH] Fix some titles and get the full sea ice diagnostics working again --- examples/coupled_model/config.yml | 8 ++-- .../Hemis_seaice_visual_compare_full.ipynb | 42 +++++++++++-------- ...Hemis_seaice_visual_compare_obs_lens.ipynb | 2 +- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/examples/coupled_model/config.yml b/examples/coupled_model/config.yml index c88ed43..f69b37f 100644 --- a/examples/coupled_model/config.yml +++ b/examples/coupled_model/config.yml @@ -76,11 +76,11 @@ timeseries: level: 'lev' ice: - vars: ['hi', 'hs', 'snowfrac', 'Tsfc'] #['process_all'] + vars: ['aice','hi', 'hs'] #['process_all'] derive_vars: [] hist_str: 'h' - start_years: [2] - end_years: [102] + start_years: [1] + end_years: [100] level: 'lev' glc: @@ -196,7 +196,7 @@ book_toc: - caption: Sea Ice chapters: - - file: ice/seaice + - file: ice/Hemis_seaice_visual_compare_full ##################################### # Keys for Jupyter Book _config.yml # diff --git a/nblibrary/ice/Hemis_seaice_visual_compare_full.ipynb b/nblibrary/ice/Hemis_seaice_visual_compare_full.ipynb index dc7f758..66f96d6 100644 --- a/nblibrary/ice/Hemis_seaice_visual_compare_full.ipynb +++ b/nblibrary/ice/Hemis_seaice_visual_compare_full.ipynb @@ -67,7 +67,7 @@ "endyr1 = 2013\n", "begyr2 = 1850\n", "endyr2 = 2013\n", - "nyears = 35" + "climo_nyears = 35" ] }, { @@ -160,7 +160,7 @@ " + cbegyr1\n", " + \"01-\"\n", " + cendyr1\n", - " + \"02.nc\",\n", + " + \"12.nc\",\n", " data_vars=\"minimal\",\n", " compat=\"override\",\n", " coords=\"minimal\",\n", @@ -258,8 +258,8 @@ " vmax = cice_vars[var][0][\"levels\"][-1]\n", " levels = np.array(cice_vars[var][0][\"levels\"])\n", " title = cice_vars[var][1][\"title\"]\n", - " field1 = ds1_ann[var].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", - " field2 = ds2_ann[var].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", + " field1 = ds1_ann[var].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", + " field2 = ds2_ann[var].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", " plot_diff(field1, field2, levels, case1, case2, title, \"N\", TLAT, TLON)" ] }, @@ -283,8 +283,8 @@ " vmax = cice_vars[var][0][\"levels\"][1]\n", " levels = np.array(cice_vars[var][0][\"levels\"])\n", " title = cice_vars[var][1][\"title\"]\n", - " field1 = ds1_ann[var].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", - " field2 = ds2_ann[var].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", + " field1 = ds1_ann[var].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", + " field2 = ds2_ann[var].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", " plot_diff(field1, field2, levels, case1, case2, title, \"S\", TLAT, TLON)" ] }, @@ -644,10 +644,16 @@ "print(ds1[\"aice\"])\n", "\n", "aice1_month = (\n", - " ds1[\"aice\"][1535:1955, :, :].groupby(\"time.month\").mean(dim=\"time\", skipna=True)\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\"][923:1343, :, :].groupby(\"time.month\").mean(dim=\"time\", skipna=True)\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", @@ -725,9 +731,9 @@ "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", "\n", - "x1 = np.linspace(1850, 2012, 163)\n", - "x2 = np.linspace(1850, 2013, 164)\n", - "x3 = np.linspace(1979, 2014, 36)\n", + "x1 = np.linspace(1, 18, 18)\n", + "x2 = np.linspace(1, 100, 100)\n", + "x3 = np.linspace(1, 36, 36)\n", "\n", "plt.plot(x1, ds1_sep)\n", "plt.plot(x2, ds2_sep)\n", @@ -763,9 +769,9 @@ "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", - "x1 = np.linspace(1850, 2013, 163)\n", - "x2 = np.linspace(1850, 2014, 164)\n", - "x3 = np.linspace(1979, 2014, 36)\n", + "x1 = np.linspace(1, 18, 18)\n", + "x2 = np.linspace(1, 100, 100)\n", + "x3 = np.linspace(1, 36, 36)\n", "\n", "plt.plot(x1, ds1_sep_sh)\n", "plt.plot(x2, ds2_sep_sh)\n", @@ -827,10 +833,10 @@ }, "outputs": [], "source": [ - "uvel1 = ds1_ann[\"uvel\"].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", - "vvel1 = ds1_ann[\"vvel\"].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", - "uvel2 = ds2_ann[\"uvel\"].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", - "vvel2 = ds2_ann[\"vvel\"].isel(time=slice(-nyears, None)).mean(\"time\").squeeze()\n", + "uvel1 = ds1_ann[\"uvel\"].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", + "vvel1 = ds1_ann[\"vvel\"].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", + "uvel2 = ds2_ann[\"uvel\"].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", + "vvel2 = ds2_ann[\"vvel\"].isel(time=slice(-climo_nyears, None)).mean(\"time\").squeeze()\n", "\n", "vect_diff(uvel1, vvel1, uvel2, vvel2, angle, \"N\", case1, case2, TLAT, TLON)" ] diff --git a/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb b/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb index 56cbefd..a63d4ed 100644 --- a/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb +++ b/nblibrary/ice/Hemis_seaice_visual_compare_obs_lens.ipynb @@ -574,7 +574,7 @@ "plt.plot(ext2_sh)\n", "plt.plot(nsidc_clim_sh)\n", "\n", - "plt.title(\"NH Climatological Seasonal Cycle\")\n", + "plt.title(\"SH Climatological Seasonal Cycle\")\n", "plt.ylim((0, 25))\n", "plt.xlabel(\"Month\")\n", "plt.ylabel(\"Climatological Seasonal Cycle Ice Extent $m x 10^{12}$\")\n",