Skip to content

Commit

Permalink
Plot updates: Add stations, ESS fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoskela committed Jun 5, 2020
1 parent c3a452c commit 7ce2dfb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions extra/Plot_tdac_output.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,21 @@
"ny = fh[\"params\"].attrs[\"ny\"]\n",
"N = nx * ny\n",
"dims = (nx,ny)\n",
"x = fh[\"grid\"][\"x\"][:] * ureg(x_unit)\n",
"y = fh[\"grid\"][\"y\"][:] * ureg(y_unit)\n",
"x = x.to(ureg.km)\n",
"y = y.to(ureg.km)\n",
"x = (fh[\"grid\"][\"x\"][:] * ureg(x_unit)).to(ureg.km)\n",
"y = (fh[\"grid\"][\"y\"][:] * ureg(y_unit)).to(ureg.km)\n",
"\n",
"true_data = fh[\"data_syn\"][timestamp][field][:]\n",
"avg_data = fh[\"data_avg\"][timestamp][field][:]\n",
"var_data = fh[\"data_var\"][timestamp][field][:]\n",
"z_t = np.reshape(true_data,dims) * ureg(field_unit)\n",
"z_avg = np.reshape(avg_data,dims) * ureg(field_unit)\n",
"z_var = np.reshape(var_data,dims) * ureg(field_unit)\n",
"z_std = np.sqrt(z_var)"
"z_std = np.sqrt(z_var)\n",
"\n",
"x_unit = fh[\"stations\"][\"x\"].attrs[\"Unit\"].decode('UTF-8')\n",
"y_unit = fh[\"stations\"][\"y\"].attrs[\"Unit\"].decode('UTF-8')\n",
"x_st = (fh[\"stations\"][\"x\"][:] * ureg(x_unit)).to(ureg.km)\n",
"y_st = (fh[\"stations\"][\"x\"][:] * ureg(y_unit)).to(ureg.km)"
]
},
{
Expand Down Expand Up @@ -114,6 +117,7 @@
"ax[2].set_title(f\"Assimilated height standard deviation [{z_std.units:~}]\")\n",
"\n",
"for a,im in zip(ax,images):\n",
" a.scatter(x_st, y_st, color = 'r', marker = '*')\n",
" a.set_xlabel(f\"x [{y.units:~}]\")\n",
" a.set_ylabel(f\"y [{x.units:~}]\")\n",
" plt.colorbar(im,ax=a)"
Expand Down Expand Up @@ -161,8 +165,8 @@
"for ts in list(fh[\"weights\"])[1:]:\n",
" ess.append(1/sum(fh[\"weights\"][ts][:]**2))\n",
"fig = plt.figure()\n",
"t = np.arange(1,np.size(ess))\n",
"plt.plot(t,ess[1:])\n",
"t = np.arange(1,np.size(ess)+1)\n",
"plt.plot(t,ess)\n",
"plt.xlabel('Time step')\n",
"plt.ylabel('Estimated Sample Size (1 / sum(weight^2))');"
]
Expand Down

0 comments on commit 7ce2dfb

Please sign in to comment.