Skip to content

Commit 6ab1e02

Browse files
committed
add bias
1 parent 75051f7 commit 6ab1e02

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

notebooks/wp5/steric_sea_level_ora5.ipynb

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,28 @@
527527
"metadata": {},
528528
"outputs": [],
529529
"source": [
530-
"for label, ds in zip([\"ORAS5\", \"ARGO\"], [ds_reanalysis_trend, ds_argo_trend]):\n",
531-
" da = ds.to_dataarray()\n",
532-
" facet = plot.projected_map(da, col=\"variable\", robust=True)\n",
533-
" for ax in facet.axs.flatten():\n",
534-
" ax.set_extent(\n",
535-
" [lon_slice.start, lon_slice.stop, lat_slice.start, lat_slice.stop]\n",
536-
" )\n",
537-
" facet.fig.suptitle(label)\n",
538-
" plt.show()"
530+
"ds_reanalysis_trend_interp = diagnostics.regrid(\n",
531+
" ds_reanalysis_trend, ds_argo_trend, method=\"nearest_s2d\"\n",
532+
")\n",
533+
"ds_trend = xr.concat(\n",
534+
" [\n",
535+
" ds_reanalysis_trend_interp.expand_dims(product=[\"ORAS5\"]),\n",
536+
" ds_argo_trend.expand_dims(product=[\"ARGO\"]),\n",
537+
" ],\n",
538+
" \"product\",\n",
539+
")\n",
540+
"da = ds_trend.to_dataarray()\n",
541+
"seconds_per_year = 365 * 24 * 360\n",
542+
"with xr.set_options(keep_attrs=True):\n",
543+
" meters_to_millimeters = 1000\n",
544+
" da = da * meters_to_millimeters * seconds_per_year\n",
545+
" da.attrs[\"units\"] = \"mm/yr\"\n",
546+
" bias = da.diff(\"product\")\n",
547+
"plot.projected_map(da, col=\"variable\", row=\"product\", robust=True)\n",
548+
"\n",
549+
"\n",
550+
"plot.projected_map(bias, col=\"variable\", row=\"product\", robust=True)\n",
551+
"_ = plt.suptitle(f\"Bias {'-'.join(da['product'].values.tolist())}\")"
539552
]
540553
},
541554
{

0 commit comments

Comments
 (0)