{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "MCSs that started in the animation domain:\n", "count:894\n", "MCSs with lifetime b/w 12 to 24 hours:\n", "count:268\n", "MCSs that initiated over land:\n", "count:325\n", "MCSs that started over land and terminated over ocean:\n", "count:66\n", "MCSs that initiated on Sep 9th:\n", "count:79\n" ] } ], "source": [ "#Mani Rajagopal \n", "#Mar 16th 2023\n", "\n", "#This program demonstrates how to to accesss data organized by MCS properties \n", "# and how to use them to do a quick search and analysis\n", "import numpy as np\n", "import netCDF4 as nc\n", "import matplotlib.pyplot as plt \n", "import glob as glob\n", "import matplotlib.ticker as ticker\n", "import scipy.ndimage as ndimage\n", "import global_land_mask as land_mask\n", "\n", "ltime_prop_dir = \"/uufs/chpc.utah.edu/common/home/u1147793/public_html/cpex_cv/lifetime_prop/2022/\"\n", "month = \"09\"\n", "idir = ltime_prop_dir + month + \"/\"\n", "\n", "def read_prop(idir,prop_name): \n", "\ttry:\n", "\t\tds = nc.Dataset(idir + prop_name + \".nc\",\"r\");\n", "\t\tprop_values = np.array(ds.variables[prop_name]);\n", "\tfinally:\n", "\t\tds.close()\n", "\t\n", "\treturn prop_values\n", "\n", "mcs_id = read_prop(idir, \"4Dobj_id\");\n", "lifetime = read_prop(idir, \"lifetime\");\n", "area_ltime_max = read_prop(idir, \"area_max\");\n", "is_near_TC = read_prop(idir, \"is_near_TC\");\n", "\n", "latw_start = read_prop(idir, \"latw_start\");\n", "lonw_start = read_prop(idir, \"lonw_start\");\n", "latw_end = read_prop(idir, \"latw_end\");\n", "lonw_end = read_prop(idir, \"lonw_end\");\n", "\n", "propvecw_mag = read_prop(idir, \"lonw_end\");\n", "month_start = read_prop(idir, \"month_start\"); \n", "day_start = read_prop(idir, \"day_start\"); \n", "hour_start = read_prop(idir, \"hour_start\"); \n", "#Tracking was run over domain: longitude -100 to 60, latitude 30 to -30\n", "\n", "#======================== Find MCSs that started in the CPEX CV animation domain \n", "# -45 to 0 and 0 t0 25 N\n", "mask_lat = (latw_start >= 0) & (latw_start <= 25)\n", "mask_lon = (lonw_start >= -45) & (lonw_start <= 0 )\n", "mask_dom = mask_lat & mask_lon\n", "print(\"MCSs that started in the animation domain:\" )\n", "print(\"count:\" + str(np.size(mcs_id[mask_dom])));\n", "# print(mcs_id[mask_dom]);\n", "\n", "#========================= Find mcs ids with lifetime 12-24 hours \n", "mask_ltime = (lifetime >= 12) & (lifetime <= 24) & mask_dom\n", "print(\"MCSs with lifetime b/w 12 to 24 hours:\" )\n", "print(\"count:\" + str(np.size(mcs_id[mask_ltime])));\n", "# print(mcs_id[mask_ltime]);\n", "\n", "# #========================= Find mcs ids that started over land\n", "mask_land_start = land_mask.is_land(latw_start,lonw_start) \n", "mask_land_start = mask_land_start & mask_dom\n", "print(\"MCSs that initiated over land:\" )\n", "print(\"count:\" + str(np.size(mcs_id[mask_land_start])));\n", "# print(mcs_id[mask_land_start]);\n", "\n", "# #========================= Find mcs ids that started over land but terminated over ocean\n", "mask_ocean_end = land_mask.is_ocean(latw_end,lonw_end) \n", "mask_ocean_end = mask_ocean_end & mask_dom\n", "mask_transition = mask_land_start & mask_ocean_end\n", "print(\"MCSs that started over land and terminated over ocean:\" )\n", "print(\"count:\" + str(np.size(mcs_id[mask_transition])));\n", "# print(mcs_id[mask_transition]);\n", "\n", "\n", "#=== find MCS that started on specific mission dates , after certain time\n", "mask_time_start = (month_start == 9) & (day_start == 9) & (hour_start > 14)\n", "print(\"MCSs that initiated on Sep 9th:\" )\n", "print(\"count:\" + str(np.size(mcs_id[mask_time_start])));" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }