Skip to content

Commit 354ed97

Browse files
committed
fix seasonal
1 parent 5e9c481 commit 354ed97

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

notebooks/wp3/seasonal_forecast_vs_oras5.ipynb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"import matplotlib.pyplot as plt\n",
2727
"import numpy as np\n",
2828
"import pandas as pd\n",
29+
"import pooch\n",
2930
"import xarray as xr\n",
3031
"from c3s_eqc_automatic_quality_control import diagnostics, download, plot\n",
3132
"\n",
@@ -123,13 +124,13 @@
123124
"source": [
124125
"def add_bounds(ds):\n",
125126
" # From https://github.com/COSIMA/ocean-regrid/blob/master/nemo_grid.py\n",
126-
" dg = xr.open_dataset(\n",
127-
" (\n",
128-
" \"https://icdc.cen.uni-hamburg.de/thredds/dodsC/ftpthredds/\"\n",
129-
" \"EASYInit/oras5/ORCA025/mesh/mesh_mask.nc\"\n",
130-
" ),\n",
131-
" chunks={},\n",
132-
" ).isel(t=0, z=0)\n",
127+
" url = (\n",
128+
" \"https://icdc.cen.uni-hamburg.de/thredds/fileServer/ftpthredds/\"\n",
129+
" \"EASYInit/oras5/ORCA025/mesh/mesh_mask.nc\"\n",
130+
" )\n",
131+
" known_hash = \"ba88418bc8055972b675ceedbd4345b3827f0ede8cef04d53c97b66a5c7a46a7\"\n",
132+
" fname = pooch.retrieve(url, known_hash)\n",
133+
" dg = xr.open_dataset(fname, chunks={}).isel(t=0, z=0)\n",
133134
"\n",
134135
" # These are the top righ-hand corner of t cells.\n",
135136
" glamf = dg.glamf\n",
@@ -328,13 +329,17 @@
328329
"metadata": {},
329330
"outputs": [],
330331
"source": [
332+
"month_order = [10, 11, 12, 1, 2]\n",
331333
"datasets = {\"Reanalysis\": ds_reanalysis, \"Seasonal Forecast\": ds_seasonal}\n",
332334
"for product, ds in datasets.items():\n",
333335
" (da,) = ds.data_vars.values()\n",
336+
" da = da.sel(month=month_order)\n",
334337
" if \"realization\" in da.dims:\n",
335338
" da = da.mean(\"realization\", keep_attrs=True)\n",
336339
"\n",
337-
" _ = plot.projected_map(da.mean(\"year\", keep_attrs=True), col=\"month\", col_wrap=3)\n",
340+
" _ = plot.projected_map(\n",
341+
" da.mean(\"year\", keep_attrs=True), col=\"month\", col_wrap=3, robust=True\n",
342+
" )\n",
338343
" plt.suptitle(f\"{product = }\")\n",
339344
" plt.show()\n",
340345
"\n",

0 commit comments

Comments
 (0)