{ "cells": [ { "cell_type": "markdown", "id": "59447ad6-ac47-494e-b696-4335b36b205b", "metadata": {}, "source": [ "# GAMIC" ] }, { "cell_type": "code", "execution_count": null, "id": "6f96b5d8-2b96-4fd7-b8ba-166c34a8dcd2", "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "import xradar as xd\n", "from open_radar_data import DATASETS" ] }, { "cell_type": "markdown", "id": "33d50be4-dfe5-4d99-a936-67a9a76bac94", "metadata": {}, "source": [ "## Download\n", "\n", "Fetching GAMIC radar data file from [open-radar-data](https://github.com/openradar/open-radar-data) repository." ] }, { "cell_type": "code", "execution_count": null, "id": "d3c6d408-5ab2-43c3-afd1-b3a703ef3b24", "metadata": {}, "outputs": [], "source": [ "filename = DATASETS.fetch(\"DWD-Vol-2_99999_20180601054047_00.h5\")" ] }, { "cell_type": "markdown", "id": "b987dcfd-5105-4483-932e-71b8002e5f09", "metadata": {}, "source": [ "## xr.open_dataset\n", "\n", "Making use of the xarray `gamic` backend. We also need to provide the group. Note, that we are using CfRadial2 group access pattern." ] }, { "cell_type": "code", "execution_count": null, "id": "7675b518-18e4-4ea6-b101-f1bccf603902", "metadata": {}, "outputs": [], "source": [ "ds = xr.open_dataset(filename, group=\"sweep_9\", engine=\"gamic\")\n", "display(ds)" ] }, { "cell_type": "markdown", "id": "01ec8c90-2da8-46ae-a0b5-0e1792a79bbe", "metadata": {}, "source": [ "### Plot Time vs. Azimuth" ] }, { "cell_type": "code", "execution_count": null, "id": "24dfb5f8-de27-46f0-9246-722e5955a345", "metadata": {}, "outputs": [], "source": [ "ds.azimuth.plot()" ] }, { "cell_type": "markdown", "id": "222ca704-d6e1-49e6-84a0-de55df9fdf61", "metadata": {}, "source": [ "### Plot Range vs. Time" ] }, { "cell_type": "code", "execution_count": null, "id": "34429720-e689-4786-99e3-5af9742d19ad", "metadata": {}, "outputs": [], "source": [ "ds.DBZH.plot()" ] }, { "cell_type": "markdown", "id": "d904cd09-8590-42e2-8dce-41d3949d313c", "metadata": {}, "source": [ "### Plot Range vs. Azimuth\n", "\n", "We need to sort by azimuth and specify the y-coordinate." ] }, { "cell_type": "code", "execution_count": null, "id": "6479a374-25ab-42be-b53e-82849b6faffc", "metadata": {}, "outputs": [], "source": [ "ds.DBZH.sortby(\"azimuth\").plot(y=\"azimuth\")" ] }, { "cell_type": "markdown", "id": "5deafdf1-9224-459c-8b10-7c501ae13234", "metadata": {}, "source": [ "## backend_kwargs\n", "\n", "Beside `first_dim` there are several additional backend_kwargs for the odim backend, which handle different aspects of angle alignment. This comes into play, when azimuth and/or elevation arrays are not evenly spacend and other issues." ] }, { "cell_type": "code", "execution_count": null, "id": "08f12b48-a3b5-43b7-b9a1-87afa9002fb9", "metadata": {}, "outputs": [], "source": [ "help(xd.io.GamicBackendEntrypoint)" ] }, { "cell_type": "code", "execution_count": null, "id": "dd052e96-9666-40ff-8b9b-3723daf68c32", "metadata": {}, "outputs": [], "source": [ "ds = xr.open_dataset(filename, group=\"sweep_9\", engine=\"gamic\", first_dim=\"time\")\n", "display(ds)" ] }, { "cell_type": "markdown", "id": "9a09378a-11d9-414f-bc23-0b6f01017d12", "metadata": {}, "source": [ "## open_odim_datatree\n", "\n", "The same works analoguous with the datatree loader. But additionally we can provide a sweep string, number or list." ] }, { "cell_type": "code", "execution_count": null, "id": "e8485006-ca89-4409-82ab-29ae8f93004a", "metadata": {}, "outputs": [], "source": [ "help(xd.io.open_gamic_datatree)" ] }, { "cell_type": "code", "execution_count": null, "id": "a65f0b48-7197-4f79-bc26-2045cfc59a4a", "metadata": {}, "outputs": [], "source": [ "dtree = xd.io.open_gamic_datatree(filename, sweep=8)\n", "display(dtree)" ] }, { "cell_type": "markdown", "id": "638bc6c0-3293-4661-a5d5-e9aaad14ffe9", "metadata": {}, "source": [ "### Plot Sweep Range vs. Time" ] }, { "cell_type": "code", "execution_count": null, "id": "f9db8500-7072-451b-84a1-f36767110e16", "metadata": {}, "outputs": [], "source": [ "dtree[\"sweep_0\"].ds.DBZH.sortby(\"time\").plot(y=\"time\")" ] }, { "cell_type": "markdown", "id": "1e44c0fd-02bc-4d2d-ac91-772bdcebe04b", "metadata": {}, "source": [ "### Plot Sweep Range vs. Azimuth" ] }, { "cell_type": "code", "execution_count": null, "id": "c7aab6b3-aeb0-4ed1-8397-8b505e63464a", "metadata": {}, "outputs": [], "source": [ "dtree[\"sweep_0\"].ds.DBZH.plot()" ] }, { "cell_type": "code", "execution_count": null, "id": "9dc09b53-7e2a-4fb6-9b28-a3ae3fd95bd0", "metadata": {}, "outputs": [], "source": [ "dtree = xd.io.open_gamic_datatree(filename, sweep=\"sweep_8\")\n", "display(dtree)" ] }, { "cell_type": "code", "execution_count": null, "id": "41976524-fca8-4569-8b37-867d2214709c", "metadata": {}, "outputs": [], "source": [ "dtree = xd.io.open_gamic_datatree(filename, sweep=[0, 1, 8])\n", "display(dtree)" ] }, { "cell_type": "code", "execution_count": null, "id": "c4239ebf-f16d-42ee-8f03-a38ecbc04cee", "metadata": {}, "outputs": [], "source": [ "dtree = xd.io.open_gamic_datatree(filename, sweep=[\"sweep_1\", \"sweep_2\", \"sweep_8\"])\n", "display(dtree)" ] } ], "metadata": { "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }