Plotting Soundings with Model Reanalysis Data
[1]:
# first, import sounderpy! Its fun to import as 'spy'!
import sounderpy as spy
## ---------------------------------- SOUNDERPY ----------------------------------- ##
## Vertical Profile Data Retrieval and Analysis Tool For Python ##
## v3.0.3 | Mar. 2024 | (C) Kyle J Gillett ##
## Docs: https://kylejgillett.github.io/sounderpy/ ##
## --------------------- THANK YOU FOR USING THIS PACKAGE! ------------------------ ##
Understanding SounderPy Functionality
To get model reanalysis data, we need to use the ``get_model_data()`` function
Reading the documentation on reanalysis data access may prove useful before using this notebook: https://kylejgillett.github.io/sounderpy/gettingdata.html#model-reanalysis-data-rap-era5-ncep
[2]:
################################ THE FUNCTION ###################################
# To get reanalysis data from the ERA5, NCEP-FNL, RAP or RUC, we use
# `get_model_data(model, latlon, year, month, day, hour, dataset=None, box_avg_size=0.10, hush=False)`
# see more details: https://kylejgillett.github.io/sounderpy/gettingdata.html#model-reanalysis-data-rap-era5-ncep
#################################################################################
########################## UNDERSTANDING THE KWARGS #############################
# `model` is a str with the name of the model we want to use, 'era5', 'ncep', or 'rap-ruc'
# `latlon` is a list of a lat & lon point, such as: `[33.19, -87.46]`
# the 'date' kwargs are all str for the date & time that you want to 'reanalize'
#################################################################################
########################### SETTING UP ERA5 DATA ################################
# NOTE: to use ERA5 data, you must set up an account with the Climate Data Store
# to receive an API key which gives you access to the data. Do so here:
# https://cds.climate.copernicus.eu/api-how-to
#################################################################################
############################# LETS GET SOME DATA ################################
# this function will get us a 22z RAP profile on 4/27/2011 at the point [33.19, -87.46]
clean_data = spy.get_model_data('rap-ruc', [33.19, -87.46], '2011', '04', '27', '22')
# you can run this for ERA5 and NCEP-FNL data too:
#clean_data = spy.get_model_data('ncep', [33.19, -87.46], '2015', '04', '27', '18')
# clean_data = spy.get_model_data('era5', [33.19, -87.46], '2011', '04', '27', '22')
> RAP REANALYSIS DATA ACCESS FUNCTION --
-----------------------------------------
> DATASET USED: RUC_13km
> COMPLETE --------
> RUNTIME: 00:00:22
> SUMMARY: 22Z RUC F00 for [33.19, -87.46] at 04-27-2011-22Z
> THERMODYNAMICS ---------------------------------------------
--- SBCAPE: 2742.6 | MUCAPE: 3172.2 | MLCAPE: 3008.8 | MUECAPE: 2916.5
--- MU 0-3: 188.1 | MU 0-6: 724.2 | SB 0-3: 145.8 | SB 0-6: 611.1
> KINEMATICS -------------------------------------------------
--- 0-500 SRW: 42.7 knot | 0-500 SWV: 0.031 | 0-500 SHEAR: 29.0 | 0-500 SRH: 308.7
--- 1-3km SRW: 29.1 knot | 1-3km SWV: 0.007 | 1-3km SHEAR: 30.6 | | 1-3km SRH: 128.4
==============================================================
[3]:
# Lets check out the BUFKIT data that we just accessed
# and stored in the `clean_data` variable:
# `clean_data` is a python dictionary of 'clean' vertical profile data
# it comes with temperature, dewpoint, pressure, height, u and v
# as well as a number of useful 'meta data'
clean_data
[3]:
{'T': array([ 26.17500305, 24.79782638, 22.49248197, 20.21064292,
18.83051661, 17.70076917, 16.10227107, 14.41181819,
12.66893126, 11.2770724 , 9.77146563, 8.39241374,
7.79048451, 7.50599994, 6.35708782, 4.97263446,
3.30881467, 1.46914286, -0.24693005, -2.04639491,
-3.89341071, -5.78373872, -7.67080534, -9.54794292,
-11.41137399, -13.30372396, -15.20790349, -17.13834717,
-19.07547352, -21.02035061, -22.98665301, -24.96382639,
-26.90817819, -28.84324019, -30.77513876, -32.70619549,
-34.57314323, -36.41162382, -38.0992144 , -39.61137457,
-41.10558586, -42.39805216, -43.69051846, -45.32274264,
-47.28258178, -49.24242092, -51.33785802, -53.48721176,
-55.63656549, -57.64971535, -59.59868153, -61.54764771,
-63.15454827, -64.11087395, -65.06719962, -66.0235253 ,
-66.82671759, -67.51911267, -68.21150776, -68.90390284,
-69.29090547, -68.53797681, -67.78504814, -67.03211947,
-66.27919081, -65.52626214]) <Unit('degree_Celsius')>,
'Td': array([ 21.87946701, 21.4113575 , 20.58924984, 19.30809429,
17.53990221, 16.98600038, 15.96902241, 14.3999156 ,
12.63351443, 8.508909 , 3.44916966, 0.16366851,
-1.16802439, -2.78842574, -3.71123632, -3.20963423,
-1.67240259, -0.20140259, -1.64917089, -3.17652464,
-4.76031837, -6.40159443, -8.15697323, -9.95558653,
-11.80464648, -13.68008167, -15.56929454, -17.49559221,
-19.43103782, -21.3770935 , -23.34435406, -25.32237378,
-27.27964565, -29.23104503, -31.18020453, -33.1287678 ,
-35.01577553, -36.87544988, -38.58628443, -40.1240725 ,
-41.6448168 , -42.97399025, -44.3031637 , -45.93795295,
-47.86743539, -49.79691784, -51.8247515 , -53.8916918 ,
-55.9586321 , -57.89624097, -59.77290508, -61.6495692 ,
-63.23242829, -64.25649918, -65.28057008, -66.30464097,
-67.8635554 , -69.80944728, -71.75533916, -73.70123105,
-75.61943063, -77.43426448, -79.24909832, -81.06393216,
-82.878766 , -84.69359984]) <Unit('degree_Celsius')>,
'rh': array([77.23999786, 81.54415982, 89.08358433, 94.58172234, 92.22371964,
95.62132682, 99.1665941 , 99.92328334, 99.7671318 , 83.97206379,
65.05346361, 56.17542192, 53.15575019, 48.04259921, 48.52816662,
55.74524652, 71.09520635, 88.6468694 , 90.26052988, 91.98190817,
93.70488673, 95.39647109, 96.31075953, 96.84141193, 96.90268903,
96.98676212, 97.05604437, 97.04007155, 97.00293807, 96.94126189,
96.87877522, 96.81587732, 96.64168467, 96.43599105, 96.21095749,
95.98077665, 95.7173945 , 95.43926953, 95.13922364, 94.81369159,
94.47834512, 94.03268448, 93.58702384, 93.46797713, 93.66387107,
93.85976501, 94.50778016, 95.33556958, 96.163359 , 97.01035662,
97.8664058 , 98.72245499, 98.96773246, 98.05138189, 97.13503131,
96.21868074, 88.78286637, 76.62999619, 64.477126 , 52.32425582,
41.26489083, 34.28722327, 27.3095557 , 20.33188813, 13.35422057,
6.376553 ]) <Unit('percent')>,
'u': array([-1.21490002, -1.36068809, -1.07262669, 4.01740455, 15.86393149,
22.13921626, 28.08060737, 30.133183 , 29.67705291, 31.66654384,
36.73423094, 42.32682106, 46.36550588, 48.77029885, 49.51473851,
51.29972332, 53.31372086, 55.13926324, 56.31033932, 57.16668123,
57.99818401, 58.89197697, 59.84490719, 60.74862114, 61.57743304,
62.64983768, 63.76757739, 64.86792814, 66.00893506, 67.19709602,
68.41839662, 69.65651164, 70.99570195, 72.36350072, 73.67583017,
74.97339663, 76.33817316, 77.73279379, 78.66187795, 79.0497123 ,
79.43209679, 79.75322452, 80.07435226, 80.80763431, 81.93834013,
83.06904594, 83.82596611, 84.43426003, 85.04255396, 85.55431606,
86.0205894 , 86.48686274, 86.65899942, 86.2717169 , 85.88443438,
85.49715187, 83.37910504, 80.00879091, 76.63847677, 73.26816263,
69.49820829, 64.23652586, 58.97484342, 53.71316098, 48.45147854,
43.1897961 ]) <Unit('knot')>,
'v': array([16.57123566, 36.37991032, 45.52681381, 53.1347352 , 59.21807465,
58.55568615, 55.13796738, 51.88084939, 50.39332715, 50.07492194,
50.30252496, 52.50271956, 56.99643155, 60.33765245, 61.12126948,
59.76603064, 57.46488468, 54.87804636, 52.67784916, 50.65134591,
48.71715739, 46.86336004, 45.01330011, 43.20500526, 41.45528752,
39.68778793, 38.08289446, 37.20825835, 36.37599834, 35.59288719,
34.85016305, 34.12793066, 33.51172124, 32.92552067, 32.50949674,
32.13876502, 32.35674956, 32.83614963, 33.45254612, 34.22821966,
34.92045866, 34.6748923 , 34.42932593, 33.4674567 , 31.81488545,
30.16231419, 28.69570504, 27.30303879, 25.91037254, 24.66208138,
23.4818242 , 22.30156702, 21.7015233 , 22.20498825, 22.7084532 ,
23.21191815, 23.41036396, 23.38811792, 23.36587188, 23.34362584,
22.96560649, 21.25960002, 19.55359354, 17.84758707, 16.1415806 ,
14.43557413]) <Unit('knot')>,
'z': array([ 0., 250., 500., 750., 1000., 1250., 1500., 1750.,
2000., 2250., 2500., 2750., 3000., 3250., 3500., 3750.,
4000., 4250., 4500., 4750., 5000., 5250., 5500., 5750.,
6000., 6250., 6500., 6750., 7000., 7250., 7500., 7750.,
8000., 8250., 8500., 8750., 9000., 9250., 9500., 9750.,
10000., 10250., 10500., 10750., 11000., 11250., 11500., 11750.,
12000., 12250., 12500., 12750., 13000., 13250., 13500., 13750.,
14000., 14250., 14500., 14750., 15000., 15250., 15500., 15750.,
16000., 16250.]) <Unit('meter')>,
'p': array([991.69995117, 960.51582876, 933.53423422, 907.10044937,
881.23199117, 855.99478113, 831.36996013, 807.31158993,
783.80155444, 760.82483608, 738.37148155, 716.43658323,
695.04042747, 674.22801316, 654.07159612, 634.42744002,
615.24053052, 596.48019711, 578.22403202, 560.47180138,
543.07731608, 526.04734333, 509.60163902, 493.4495776 ,
477.65777214, 462.37016604, 447.30898232, 432.79435446,
418.56801367, 404.67603455, 391.19692519, 377.92729959,
365.20660169, 352.64127202, 340.5855378 , 328.66543213,
317.23690077, 306.02664917, 295.14430013, 284.64318362,
274.20606419, 264.48827471, 254.77048523, 245.44406781,
236.49503389, 227.54599998, 219.10780747, 210.87273755,
202.63766762, 194.90492937, 187.40890582, 179.91288227,
172.7114434 , 166.07027618, 159.42910897, 152.78794175,
146.67992924, 140.95767333, 135.23541741, 129.5131615 ,
124.02397801, 119.40478056, 114.7855831 , 110.16638565,
105.5471882 , 100.92799074]) <Unit('hectopascal')>,
'site_info': {'site-id': 'no-site-id',
'site-name': 'no-site-name',
'site-lctn': 'no-site-location',
'site-latlon': [33.19, -87.46],
'site-elv': 105.75,
'source': 'MODEL REANALYSIS',
'model': 'RUC',
'fcst-hour': 'F00',
'run-time': ['2011', '04', '27', '22'],
'valid-time': ['2011', '04', '27', '22'],
'box_area': '0.1° BOX AVG'}}
LETS PLOT THE DATA ON A SOUNDING AND HODOGRAPH
[4]:
# lets make a sounding!
spy.build_sounding(clean_data)
> SOUNDING PLOTTER FUNCTION --
---------------------------------
> COMPLETE --------
> RUNTIME: 00:00:18
[ ]: