Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 30 additions & 26 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d5503c4a",
"id": "78db4d9e",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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 colormaps\n",
" # vmin=-1.0, # Optional: set color scale limits\n",
" # vmax=1.0,\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)"
Comment thread
isaschmitz marked this conversation as resolved.
]
},
{
Expand Down
Loading