Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: fix recipe4.ipynb, try always have 24 fitting volumes #96

Merged
merged 1 commit into from
Nov 6, 2024
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
28 changes: 21 additions & 7 deletions notebooks/workflow/recipe4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"source": [
"# Load ODIM_H5 Volume data from German Weather Service\n",
"\n",
"In this example, we obtain and read the latest 30 minutes of available volumetric radar data from German Weather Service available at [opendata.dwd.de](https://opendata.dwd.de). Finally we do some plotting.\n",
"In this example, we obtain and read the last 2 hours of available volumetric radar data from German Weather Service available at [opendata.dwd.de](https://opendata.dwd.de). Finally we do some plotting.\n",
"\n",
"This retrieves 6 timesteps of the 10 sweeps (moments DBZH and VRADH) of the DWD volume scan of a distinct radar. This amounts to 120 data files which are combined into one volumetric Cf/Radial2 like xarray powered structure.\n",
"This retrieves 24 timesteps of the 10 sweeps (moments DBZH and VRADH) of the DWD volume scan of a distinct radar. This amounts to 480 data files which are combined into one volumetric Cf/Radial2 like xarray powered structure.\n",
"\n",
"Exports to single file Odim_H5 and Cf/Radial2 format are shown at the end of this tutorial.\n",
"\n",
Expand Down Expand Up @@ -162,13 +162,13 @@
"metadata": {},
"outputs": [],
"source": [
"for f in filelist1[: 10 * 24]:\n",
"for f in filelist1[: 10 * 25]:\n",
" with http.request(\n",
" \"GET\", os.path.join(opendata_url1, f), preload_content=False\n",
" ) as r, open(f, \"wb\") as out:\n",
" shutil.copyfileobj(r, out)\n",
"\n",
"for f in filelist2[: 10 * 24]:\n",
"for f in filelist2[: 10 * 25]:\n",
" with http.request(\n",
" \"GET\", os.path.join(opendata_url2, f), preload_content=False\n",
" ) as r, open(f, \"wb\") as out:\n",
Expand All @@ -194,8 +194,7 @@
"volume_reflectivity = np.array(\n",
" sorted(volume_reflectivity, key=lambda x: x.split(\"-\")[2])\n",
")\n",
"volume_velocity = np.array(sorted(volume_velocity, key=lambda x: x.split(\"-\")[2]))\n",
"volume_reflectivity[:15]"
"volume_velocity = np.array(sorted(volume_velocity, key=lambda x: x.split(\"-\")[2]))"
]
},
{
Expand All @@ -208,6 +207,15 @@
"volume_velocity = volume_velocity.reshape(-1, 10).T"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"volume_reflectivity"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -282,7 +290,13 @@
"metadata": {},
"outputs": [],
"source": [
"dsl[0]"
"vt_min = np.array([dsl[i].volume_time.min().values for i in range(10)])\n",
"vt_max = np.array([dsl[i].volume_time.max().values for i in range(10)])\n",
"if not all((vt_min == vt_min[0])):\n",
" dsl = [ds.sel(volume_time=slice(vt_min.max(), vt_max.min())) for ds in dsl]\n",
"else:\n",
" dsl = [ds.isel(volume_time=slice(1, -1)) for ds in dsl]\n",
"dsl = sorted(dsl, key=lambda ds: ds.time.min().values)"
]
},
{
Expand Down
Loading