{ "cells": [ { "cell_type": "markdown", "id": "59447ad6-ac47-494e-b696-4335b36b205b", "metadata": {}, "source": [ "# Iris/Sigmet - Reader" ] }, { "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 Iris 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_single = DATASETS.fetch(\"SUR210819000227.RAWKPJV\")\n", "filename_volume = DATASETS.fetch(\"cor-main131125105503.RAW2049\")" ] }, { "cell_type": "markdown", "id": "b987dcfd-5105-4483-932e-71b8002e5f09", "metadata": {}, "source": [ "## xr.open_dataset\n", "\n", "Making use of the xarray `iris` backend. We also need to provide the group. We use the group notation from `CfRadial2`." ] }, { "cell_type": "code", "execution_count": null, "id": "7675b518-18e4-4ea6-b101-f1bccf603902", "metadata": {}, "outputs": [], "source": [ "ds = xr.open_dataset(filename_single, group=\"sweep_0\", engine=\"iris\")\n", "display(ds)" ] }, { "cell_type": "markdown", "id": "56766539-8904-4801-a0cc-bc1f876703b0", "metadata": {}, "source": [ "### Plot Time vs. Azimuth" ] }, { "cell_type": "code", "execution_count": null, "id": "91104a31-daaa-4714-8c3d-dcaa158b4c26", "metadata": {}, "outputs": [], "source": [ "ds.azimuth.plot(y=\"time\")" ] }, { "cell_type": "markdown", "id": "72369cc4-759c-4156-bd4e-cd392f2bb451", "metadata": {}, "source": [ "### Plot Range vs. Time\n", "\n", "We need to sort by time and specify the y-coordinate." ] }, { "cell_type": "code", "execution_count": null, "id": "a8dfced9-519d-400d-967f-015cb6fb1113", "metadata": {}, "outputs": [], "source": [ "ds.DBZH.sortby(\"time\").plot(y=\"time\")" ] }, { "cell_type": "markdown", "id": "100ffee4-345a-4560-9aa1-15a5ba00aca4", "metadata": {}, "source": [ "### Plot Range vs. Azimuth\n" ] }, { "cell_type": "code", "execution_count": null, "id": "58886782-f23c-4fd0-8130-50ca12bd8ab4", "metadata": {}, "outputs": [], "source": [ "ds.DBZH.plot(y=\"azimuth\")" ] }, { "cell_type": "markdown", "id": "27465481-21c0-49c4-8e3f-75577bbf965e", "metadata": {}, "source": [ "## backend_kwargs\n", "\n", "Beside `first_dim` there are several additional backend_kwargs for the iris 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.IrisBackendEntrypoint)" ] }, { "cell_type": "code", "execution_count": null, "id": "dd052e96-9666-40ff-8b9b-3723daf68c32", "metadata": {}, "outputs": [], "source": [ "ds = xr.open_dataset(filename_single, group=\"sweep_0\", engine=\"iris\", first_dim=\"time\")\n", "display(ds)" ] }, { "cell_type": "markdown", "id": "9a09378a-11d9-414f-bc23-0b6f01017d12", "metadata": {}, "source": [ "## open_iris_datatree\n", "\n", "The same works analoguous with the datatree loader. But additionally we can provide a sweep string, number or list. The underlying xarray.Dataset can be accessed with property `.ds`." ] }, { "cell_type": "code", "execution_count": null, "id": "e8485006-ca89-4409-82ab-29ae8f93004a", "metadata": {}, "outputs": [], "source": [ "help(xd.io.open_iris_datatree)" ] }, { "cell_type": "code", "execution_count": null, "id": "de430cfa-18cd-4e37-ab36-f4e211dbc7c5", "metadata": {}, "outputs": [], "source": [ "dtree = xd.io.open_iris_datatree(filename_volume)\n", "display(dtree)" ] }, { "cell_type": "code", "execution_count": null, "id": "9dc09b53-7e2a-4fb6-9b28-a3ae3fd95bd0", "metadata": {}, "outputs": [], "source": [ "dtree = xd.io.open_iris_datatree(filename_volume, 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_iris_datatree(filename_volume, sweep=[1, 2, 8])\n", "display(dtree)" ] }, { "cell_type": "code", "execution_count": null, "id": "c4239ebf-f16d-42ee-8f03-a38ecbc04cee", "metadata": {}, "outputs": [], "source": [ "dtree = xd.io.open_iris_datatree(\n", " filename_volume,\n", " sweep=[\"sweep_0\", \"sweep_1\", \"sweep_8\"],\n", ")\n", "display(dtree)" ] }, { "cell_type": "markdown", "id": "213f248b-3e18-40c6-a22b-00be6bc5e2b6", "metadata": {}, "source": [ "### Plot Time vs. Azimuth" ] }, { "cell_type": "code", "execution_count": null, "id": "6d0ca3e9-22cb-4295-884c-31b68bc7cd8f", "metadata": {}, "outputs": [], "source": [ "dtree[\"sweep_0\"].ds.azimuth.plot(y=\"time\")" ] }, { "cell_type": "markdown", "id": "5602d467-2c10-4a86-81b4-f45d3c89e163", "metadata": {}, "source": [ "### Plot Sweep Range vs. Time\n", "\n", "We need to sort by time and specify the y-coordinate. Please also observe the different resolutions of this plot, compared to the `Azimuth vs. Range` plot below. This is due to second-resolution of the time coordinate." ] }, { "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": "a4924ec8-b9f4-4b34-a7fb-4dcd7fcabfc3", "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()" ] } ], "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.11.0" } }, "nbformat": 4, "nbformat_minor": 5 }