{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Py-ART" ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "import os\n", "import pyart\n", "import radarx as rx # noqa\n", "import cmweather # noqa\n", "import cartopy.crs as ccrs\n", "from datetime import datetime" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## Grid Setup" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "x_lims = (-300e3, 250e3)\n", "y_lims = (-250e3, 300e3)\n", "z_lims = (0, 15e3)\n", "h_res = 2000\n", "v_res = 500" ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "## Load data" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "file = \"s3://noaa-nexrad-level2/2018/06/12/KSGF/KSGF20180612_083109_V06\"\n", "radar = pyart.io.read_nexrad_archive(file)\n", "filename = os.path.basename(file) + \".nc\"\n", "if not os.path.exists(filename):\n", " pyart.io.write_cfradial(filename, radar)\n", "else:\n", " print(\"Already present\")" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "tstart = datetime.now()\n", "# Grid using 11 vertical levels, and 101 horizontal grid cells at a resolution on 1 km\n", "grid = pyart.map.grid_from_radars(\n", " (radar,),\n", " grid_shape=(31, 276, 276),\n", " grid_limits=(\n", " z_lims,\n", " y_lims,\n", " x_lims,\n", " ),\n", " fields=[\"reflectivity\"],\n", ")\n", "\n", "xg = grid.to_xarray()\n", "print(\"Py-ART gridding took:\", datetime.now() - tstart)\n", "display(xg)\n", "del radar" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "## Plot" ] }, { "cell_type": "markdown", "id": "8", "metadata": {}, "source": [ "## Py-ART" ] }, { "cell_type": "code", "execution_count": null, "id": "9", "metadata": {}, "outputs": [], "source": [ "xg.squeeze().radarx.plot_max_cappi(\n", " data_var=\"reflectivity\",\n", " vmin=-10,\n", " vmax=70,\n", " range_rings=True,\n", " add_map=True,\n", " projection=ccrs.PlateCarree(),\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [] } ], "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.12.7" } }, "nbformat": 4, "nbformat_minor": 5 }