From 14f14fefa980c3a2afcb4a7489621196d0545d85 Mon Sep 17 00:00:00 2001 From: Isabelle Schmitz Date: Thu, 7 May 2026 22:25:47 +0200 Subject: [PATCH 1/3] [FIX] Update Zheng2024 plot to 2D Updated `demo.ipynb` to show a 2D plot for the MFT of Zheng2024 like it is done for the MHT of CALAFAT2025. --- notebooks/demo.ipynb | 56 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index cd1d4d9..e9ea0c6 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -408,7 +408,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5503c4a", + "id": "78db4d9e", "metadata": {}, "outputs": [], "source": [ @@ -443,8 +443,16 @@ " if 'N_ENSEMBLE' in ds_mean.coords:\n", " ds_mean = ds_mean.drop_vars('N_ENSEMBLE')\n", "\n", - " return ds_mean\n", - "\n", + " return ds_mean\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d5503c4a", + "metadata": {}, + "outputs": [], + "source": [ "# Create the ensemble-averaged dataset\n", "calafat_mean = create_ensemble_mean_dataset(standardCALAFAT2025)\n", "\n", @@ -488,36 +496,32 @@ { "cell_type": "code", "execution_count": null, - "id": "b991e9dd", + "id": "3fc7b5fc", "metadata": {}, "outputs": [], "source": [ + "# load ZHENG2024 dataset\n", "standardZHENG2024 = read.zheng2024()\n", - "# Declare latitude index (between 0 and 100)\n", - "lat_idx = 61\n", - "lat_val = standardZHENG2024['LATITUDE'].values[lat_idx]\n", "\n", - "# Set title string based on latitude value\n", - "if lat_val<0:\n", - " title_str = f'ZHENG2024 (lat = {-lat_val:.2f}°S)'\n", - "else:\n", - " title_str = f'ZHENG2024 (lat = {lat_val:.2f}°N)'\n", + "# create mean by using function defined for calafat2025 dataset earlier\n", + "zheng_mean = create_ensemble_mean_dataset(standardZHENG2024)\n", "\n", - "# Subselect data based on latitude index\n", - "data = standardZHENG2024['MFT'][:, lat_idx]\n", + " # Plot the 2D MFT data\n", + "fig, ax = plotters.plot_amoc_2d_data(\n", + " data=zheng_mean,\n", + " varname=\"MFT\",\n", + " title=\"ZHENG2024 Meridional Freshwater Transport\",\n", + " ylabel=\"Latitude (°N)\",\n", + " figsize=(12, 6),\n", + " colormap=\"RdBu_r\", # Red-blue colormap, good for heat transport\n", + " # vmin=-1.0, # Optional: set color scale limits\n", + " # vmax=1.0,s\n", + ")\n", "\n", - "# Plot timeseries\n", - "plotters.plot_amoc_timeseries(\n", - " data=[data],\n", - " varnames=[\"MFT\"],\n", - " labels=[\"\"],\n", - " colors=[\"darkgreen\"],\n", - " resample_monthly=True,\n", - " plot_raw=True,\n", - " lat_idx=lat_idx,\n", - " ylabel='MFT (Sv)',\n", - " title=title_str\n", - " )" + "# Add colorbar label\n", + "cbar = fig.get_axes()[1] if len(fig.get_axes()) > 1 else None\n", + "if cbar:\n", + " cbar.set_ylabel('MFT (Sv)', rotation=270, labelpad=20)" ] }, { From 312824103d4016906572c19c80212c21161fa33a Mon Sep 17 00:00:00 2001 From: Isabelle Schmitz Date: Thu, 7 May 2026 22:30:38 +0200 Subject: [PATCH 2/3] small typo --- notebooks/demo.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index e9ea0c6..bb5f4bf 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -513,7 +513,7 @@ " title=\"ZHENG2024 Meridional Freshwater Transport\",\n", " ylabel=\"Latitude (°N)\",\n", " figsize=(12, 6),\n", - " colormap=\"RdBu_r\", # Red-blue colormap, good for heat transport\n", + " colormap=\"RdBu_r\", # Red-blue colormaps\n", " # vmin=-1.0, # Optional: set color scale limits\n", " # vmax=1.0,s\n", ")\n", From cc43ccf5261283a90353c6109f48a6d0bd26643b Mon Sep 17 00:00:00 2001 From: Isabelle Schmitz Date: Thu, 7 May 2026 22:54:11 +0200 Subject: [PATCH 3/3] Resolved comments Two small typos. Copilot also suggested to remove the manually overwritten colorbar, but I like that it shows how to manipulate the plot without having to go into the function `plot_amoc_2d_data()` itself. --- notebooks/demo.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index bb5f4bf..abf57de 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -506,7 +506,7 @@ "# create mean by using function defined for calafat2025 dataset earlier\n", "zheng_mean = create_ensemble_mean_dataset(standardZHENG2024)\n", "\n", - " # Plot the 2D MFT data\n", + "# Plot the 2D MFT data\n", "fig, ax = plotters.plot_amoc_2d_data(\n", " data=zheng_mean,\n", " varname=\"MFT\",\n", @@ -515,7 +515,7 @@ " figsize=(12, 6),\n", " colormap=\"RdBu_r\", # Red-blue colormaps\n", " # vmin=-1.0, # Optional: set color scale limits\n", - " # vmax=1.0,s\n", + " # vmax=1.0,\n", ")\n", "\n", "# Add colorbar label\n",