{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "5e090a12-ceb7-49a3-8b57-d9a85eb54531", "metadata": {}, "source": [ "# ⛈ K-Index\n", "\n", "The K-Index is one indicator of [thunderstorm potential](https://github.com/Unidata/MetPy/issues/631)\n", " \n", "$$ K = (T_{850} - T_{500}) + Td_{850} - (T_{700} - Td_{700})$$\n", "\n", "Where $T$ is temperature and $Td$ is dew point temperature at the level in hPa.\n", "\n", "- K values +20 indicate some potential for air mass thunderstorms.\n", "- K values +40 indicate almost 100% chance for air mass thunderstorms,\n", "- with values over +30 to indicate potential MCC's.\n", "\n", "Cool temperatures aloft and warm temperatures below are associated with instability at the surface (resulting in rising motion). Dry air aloft will lower the K value because when dry air entrains in a cumulus cloud it restricts it's thunderstorm growth." ] }, { "cell_type": "code", "execution_count": 1, "id": "0b48c34f-c965-4463-bab6-48c2408b0fd9", "metadata": {}, "outputs": [], "source": [ "from herbie import Herbie\n", "from toolbox import EasyMap, pc\n", "\n", "import matplotlib.pyplot as plt\n", "import matplotlib.colors as mcolors" ] }, { "cell_type": "code", "execution_count": 2, "id": "6f53d6bd-4ac8-4f12-af71-63b592697a5a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "✅ Found ┊ model=hrrr ┊ \u001b[3mproduct=sfc\u001b[0m ┊ \u001b[38;2;41;130;13m2021-Apr-28 23:00 UTC\u001b[92m F00\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mGRIB2 @ aws\u001b[0m ┊ \u001b[38;2;255;153;0m\u001b[3mIDX @ aws\u001b[0m\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\blaylock\\_GITHUB\\Herbie\\herbie\\archive.py:722: UserWarning: This pattern is interpreted as a regular expression, and has match groups. To actually get the groups, use str.extract.\n", " logic = df.search_this.str.contains(searchString)\n", "C:\\Users\\blaylock\\_GITHUB\\Herbie\\herbie\\archive.py:1041: UserWarning: sorry, on windows I couldn't remove the file.\n", " warnings.warn(\"sorry, on windows I couldn't remove the file.\")\n" ] } ], "source": [ "ds = Herbie(\"2021-04-28 23:00\").xarray(\"(TMP|DPT):(500|700|850) mb\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "da014d97-88f6-4773-ade1-92f37e4f5c78", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n",
"Dimensions: (isobaricInhPa: 3, y: 1059, x: 1799)\n",
"Coordinates:\n",
" time datetime64[ns] 2021-04-28T23:00:00\n",
" step timedelta64[ns] 00:00:00\n",
" * isobaricInhPa (isobaricInhPa) float64 850.0 700.0 500.0\n",
" latitude (y, x) float64 21.14 21.15 21.15 ... 47.86 47.85 47.84\n",
" longitude (y, x) float64 237.3 237.3 237.3 ... 299.0 299.0 299.1\n",
" valid_time datetime64[ns] 2021-04-28T23:00:00\n",
"Dimensions without coordinates: y, x\n",
"Data variables:\n",
" t (isobaricInhPa, y, x) float32 281.0 281.0 ... 248.5\n",
" dpt (isobaricInhPa, y, x) float32 276.0 275.9 ... 236.7\n",
" gribfile_projection object None\n",
"Attributes:\n",
" GRIB_edition: 2\n",
" GRIB_centre: kwbc\n",
" GRIB_centreDescription: US National Weather Service - NCEP\n",
" GRIB_subCentre: 0\n",
" Conventions: CF-1.7\n",
" institution: US National Weather Service - NCEP\n",
" model: hrrr\n",
" product: sfc\n",
" description: High-Resolution Rapid Refresh - CONUS\n",
" remote_grib: https://noaa-hrrr-bdp-pds.s3.amazonaws.com/hrrr....\n",
" local_grib: C:\\Users\\blaylock\\data\\hrrr\\20210428\\subset_2eef...\n",
" searchString: (TMP|DPT):(500|700|850) mb