\n",
" \n",
- " Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/gmarques/High-mem/proxy/42779/status\n",
+ " Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/gmarques/High-mem/proxy/8787/status\n",
" | \n",
" \n",
" Workers: 0\n",
@@ -237,11 +236,11 @@
" \n",
" \n",
" Scheduler\n",
- " Scheduler-16a3d52b-3b4f-48c1-8d9a-0080a3fbafe3 \n",
+ " Scheduler-71528c26-f25a-433d-bb53-e6eb6a38a888 \n",
" \n",
" \n",
" \n",
- " Comm: tcp://128.117.208.100:32845\n",
+ " Comm: tcp://128.117.208.112:38481\n",
" | \n",
" \n",
" Workers: 0\n",
@@ -249,7 +248,7 @@
" | \n",
" \n",
" \n",
- " Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/gmarques/High-mem/proxy/42779/status\n",
+ " Dashboard: https://jupyterhub.hpc.ucar.edu/stable/user/gmarques/High-mem/proxy/8787/status\n",
" | \n",
" \n",
" Total threads: 0\n",
@@ -287,7 +286,7 @@
""
],
"text/plain": [
- ""
+ ""
]
},
"execution_count": 8,
@@ -320,7 +319,7 @@
" grd = MOM6grid(OUTDIR+'/'+args.static, geom_file)\n",
"else:\n",
" grd = MOM6grid(OUTDIR+'/'+args.static)\n",
- "\n",
+ " \n",
"try:\n",
" depth = grd.depth_ocean\n",
"except:\n",
@@ -337,7 +336,7 @@
"output_type": "stream",
"text": [
"Reading native dataset...\n",
- "Time elasped: 0:02:16.685705\n"
+ "Time elasped: 0:00:41.190045\n"
]
}
],
@@ -393,6 +392,719 @@
"#list(catalog)"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "mld_clima = ds_sel['mlotst'].groupby(\"time.month\").mean('time').compute()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "mld_clima = mld_clima.assign_coords({\n",
+ " \"latitude\": ((\"yh\", \"xh\"), grd.geolat),\n",
+ " \"longitude\": ((\"yh\", \"xh\"), grd.geolon)\n",
+ "})"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Create the faceted plot\n",
+ "fig = plt.figure(figsize=(15, 10)) # Adjust figure size\n",
+ "plot = mld_clima.plot(\n",
+ " x=\"longitude\", \n",
+ " y=\"latitude\", \n",
+ " col=\"month\", \n",
+ " col_wrap=4, # Arrange plots in a grid with 4 columns\n",
+ " cmap=\"viridis\", # Choose a color map\n",
+ " robust=True, # Automatically set vmin/vmax for better scaling\n",
+ " cbar_kwargs={\n",
+ " \"orientation\": \"horizontal\", # Horizontal colorbar\n",
+ " \"pad\": 0.05, # Space between colorbar and plots\n",
+ " \"aspect\": 40, # Control the width of the colorbar\n",
+ " \"shrink\": 0.8, # Shrink the colorbar size\n",
+ " \"label\": \"MLD monthly climatology (m)\" # Customize colorbar label\n",
+ " }\n",
+ ")\n",
+ "plt.suptitle('{}, from {} to {}'.format(args.label, args.start_date, \n",
+ " args.end_date), fontsize=16, fontweight='bold')\n",
+ "# Fine-tune layout\n",
+ "plt.subplots_adjust(top=0.93, bottom=0.26) # Move the plots up to create space below\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Add a 'month' coordinate to 'reference'\n",
+ "mld_obs_with_month = mld_obs.assign_coords(month=mld_clima.month)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <xarray.Dataset> Size: 17MB\n",
+ "Dimensions: (month: 12, yh: 480, xh: 540)\n",
+ "Coordinates:\n",
+ " lon (yh, xh) float64 2MB dask.array<chunksize=(480, 540), meta=np.ndarray>\n",
+ " lat (yh, xh) float64 2MB dask.array<chunksize=(480, 540), meta=np.ndarray>\n",
+ " * month (month) int64 96B 1 2 3 4 5 6 7 8 9 10 11 12\n",
+ "Dimensions without coordinates: yh, xh\n",
+ "Data variables:\n",
+ " mld (month, yh, xh) float32 12MB dask.array<chunksize=(12, 480, 540), meta=np.ndarray> lon (yh, xh) float64 dask.array<chunksize=(480, 540), meta=np.ndarray> - long_name :
- array of t-grid longitudes
- units :
- degrees_east
\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " | \n",
+ " Array | \n",
+ " Chunk | \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " Bytes | \n",
+ " 1.98 MiB | \n",
+ " 1.98 MiB | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Shape | \n",
+ " (480, 540) | \n",
+ " (480, 540) | \n",
+ " \n",
+ " \n",
+ " Dask graph | \n",
+ " 1 chunks in 2 graph layers | \n",
+ " \n",
+ " \n",
+ " Data type | \n",
+ " float64 numpy.ndarray | \n",
+ " \n",
+ " \n",
+ " \n",
+ " | \n",
+ " \n",
+ " \n",
+ " | \n",
+ " \n",
+ " lat (yh, xh) float64 dask.array<chunksize=(480, 540), meta=np.ndarray> - long_name :
- array of t-grid latitudes
- units :
- degrees_north
\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " | \n",
+ " Array | \n",
+ " Chunk | \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " Bytes | \n",
+ " 1.98 MiB | \n",
+ " 1.98 MiB | \n",
+ " \n",
+ " \n",
+ " \n",
+ " Shape | \n",
+ " (480, 540) | \n",
+ " (480, 540) | \n",
+ " \n",
+ " \n",
+ " Dask graph | \n",
+ " 1 chunks in 2 graph layers | \n",
+ " \n",
+ " \n",
+ " Data type | \n",
+ " float64 numpy.ndarray | \n",
+ " \n",
+ " \n",
+ " \n",
+ " | \n",
+ " \n",
+ " \n",
+ " | \n",
+ " \n",
+ " month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12 array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
PandasIndex PandasIndex(Index([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], dtype='int64', name='month'))
"
+ ],
+ "text/plain": [
+ " Size: 17MB\n",
+ "Dimensions: (month: 12, yh: 480, xh: 540)\n",
+ "Coordinates:\n",
+ " lon (yh, xh) float64 2MB dask.array\n",
+ " lat (yh, xh) float64 2MB dask.array\n",
+ " * month (month) int64 96B 1 2 3 4 5 6 7 8 9 10 11 12\n",
+ "Dimensions without coordinates: yh, xh\n",
+ "Data variables:\n",
+ " mld (month, yh, xh) float32 12MB dask.array"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "mld_obs_monthly = mld_obs_with_month.groupby(\"month\").mean(dim=\"time\")\n",
+ "mld_obs_monthly"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "bias = mld_clima - mld_obs_monthly.mld"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ " | |