Plotting Soundings with Model Reanalysis Data

[1]:
# first, import sounderpy! Its fun to import as 'spy'!
import sounderpy as spy

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/reference/gettingdata.html#model-reanalysis-data-rap-ruc-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/reference/gettingdata.html#model-reanalysis-data-rap-ruc-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/how-to-api
#################################################################################


############################# 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/RUC REANALYSIS DATA ACCESS FUNCTION
  ------------------------------------------
    > request: 2011-04-27 22Z | 33.19, -87.46
    > requested data is < 05-2012: going directly to NCEI RUC
    > checking NCEI server availability first...
    > NCEI server test was successful
    > searching NCEI RUC archives (4 likely collections)
      trying RUC_13km
    > NCEI DATASET FOUND: RUC_13km
    > downloading: https://www.ncei.noaa.gov/thredds/fileServer/model-ruc130anl/201104/20110427/ruc2anl_130_20110427_2200_000.grb2
    > DATA FOUND AT: NCEI RUC_13km
    > parsing complete
    > temporary GRIB files will now be deleted
    > COMPLETE --------
    > RUNTIME: 00:00:07
    > SUMMARY: 22Z RUC F00 for[33.19, -87.46] at 04-27-2011-22Z

    > THERMODYNAMICS ---------------------------------------------
    --- SBCAPE: 2943.8 | MUCAPE: 3245.7 | MLCAPE: 2874.2 | MUECAPE: 2990.0
    --- MU 0-3: 186.8 | MU 0-6: 721.3 | SB 0-3: 157.4 | SB 0-6: 643.4

    > KINEMATICS -------------------------------------------------
    --- 0-500 SRW: 42.2 knot | 0-500 SWV: 0.028 | 0-500 SHEAR: 26.9 | 0-500 SRH: 283.3
    --- 1-3km SRW: 29.4 knot | 1-3km SWV: 0.007 | 1-3km SHEAR: 31.6 | | 1-3km SRH: 134.7
    ==============================================================

[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': Quantity(array([ 2.64500061e+01,  2.49646822e+01,  2.26382487e+01,  2.03677485e+01,
         1.89670333e+01,  1.78583467e+01,  1.62852469e+01,  1.46100984e+01,
         1.28968176e+01,  1.14794931e+01,  1.00989369e+01,  8.67155622e+00,
         8.10467027e+00,  7.77145321e+00,  6.61894970e+00,  5.27415779e+00,
         3.67002955e+00,  1.79444309e+00,  4.26227243e-02, -1.76833173e+00,
        -3.62433619e+00, -5.53118806e+00, -7.43473477e+00, -9.31564514e+00,
        -1.11473731e+01, -1.30603055e+01, -1.50017520e+01, -1.69176780e+01,
        -1.88637608e+01, -2.08642070e+01, -2.28445250e+01, -2.48088474e+01,
        -2.67365335e+01, -2.86464671e+01, -3.05546032e+01, -3.24619089e+01,
        -3.43286805e+01, -3.61669097e+01, -3.78738483e+01, -3.93436960e+01,
        -4.08135436e+01, -4.21381424e+01, -4.34590472e+01, -4.50543569e+01,
        -4.70592231e+01, -4.90640894e+01, -5.11724349e+01, -5.33474974e+01,
        -5.55225598e+01, -5.75687048e+01, -5.95190164e+01, -6.14693280e+01,
        -6.31738669e+01, -6.41035310e+01, -6.50331950e+01, -6.59628591e+01,
        -6.68097835e+01, -6.75656248e+01, -6.83214661e+01, -6.90773074e+01,
        -6.96624847e+01, -6.88668360e+01, -6.80711872e+01, -6.72755384e+01,
        -6.64798896e+01, -6.56842408e+01]), "degree_Celsius"),
 'Td': Quantity(array([ 22.23080736,  21.61444039,  20.7386844 ,  19.43736314,
         17.68847983,  17.00378635,  16.11027911,  14.59946704,
         12.87793087,   9.09445096,   4.03037375,   0.50532192,
         -1.15632878,  -3.07364777,  -4.08598495,  -3.68705262,
         -2.16129632,  -0.204232  ,  -1.60691861,  -3.05726098,
         -4.56612301,  -6.16750087,  -7.93003585,  -9.73272479,
        -11.55287021, -13.45099197, -15.3771849 , -17.2869011 ,
        -19.22819478, -21.22641268, -23.20460945, -25.16689562,
        -27.10406996, -29.02907607, -30.95197002, -32.87388816,
        -34.7547156 , -36.60660878, -38.33126883, -39.82616515,
        -41.32106146, -42.68145476, -44.03842744, -45.63326933,
        -47.5831375 , -49.53300567, -51.55804973, -53.63156245,
        -55.70507517, -57.65714514, -59.51893815, -61.38073115,
        -63.02534669, -63.9852428 , -64.94513891, -65.90503502,
        -67.3245012 , -69.24988063, -71.17526007, -73.10063951,
        -75.0199876 , -76.89053664, -78.76108568, -80.63163472,
        -82.50218376, -84.3727328 ]), "degree_Celsius"),
 'rh': Quantity(array([77.69210942, 81.87484023, 89.23518116, 94.51115057, 92.38803158,
        94.87264305, 98.97030223, 99.98538869, 99.923472  , 86.30006147,
        66.24618783, 56.54981738, 52.08753142, 46.23115314, 46.3629694 ,
        52.74349173, 66.87219001, 86.64057595, 88.73035622, 91.00750565,
        93.28320935, 95.38549842, 96.36924923, 96.91018624, 96.96261179,
        97.04002253, 97.12064649, 97.12877466, 97.12230382, 97.0895156 ,
        97.05073981, 97.00720575, 96.85113985, 96.64054536, 96.41385908,
        96.17973859, 95.93382672, 95.6796119 , 95.38323977, 95.01073796,
        94.63823614, 94.13533582, 93.62911927, 93.45340017, 93.77095756,
        94.08851494, 94.71993128, 95.55370404, 96.38747681, 97.18806848,
        97.96399429, 98.73992011, 99.18624107, 98.59338042, 98.00051976,
        97.40765911, 91.47112917, 79.65207256, 67.83301594, 56.01395932,
        44.67030403, 37.17307762, 29.67585121, 22.1786248 , 14.68139839,
         7.18417198]), "percent"),
 'u': Quantity(array([-2.13822405, -1.55507202, -1.34094134,  3.46261882, 15.10243797,
        22.26367628, 27.54550002, 29.85965759, 29.61188821, 31.38512576,
        36.32933223, 42.20808004, 46.61575602, 49.20667882, 49.81325072,
        51.22127635, 53.07769376, 54.91708618, 56.05217415, 56.96273968,
        57.81676984, 58.743416  , 59.74813203, 60.71882426, 61.57827649,
        62.67079735, 63.84733205, 64.97589787, 66.16426894, 67.46045001,
        68.78192465, 70.12349985, 71.54855134, 73.01405224, 74.36472629,
        75.66235168, 77.06792441, 78.54950888, 79.5612457 , 79.72450884,
        79.88777198, 80.18640355, 80.48847774, 81.08816315, 82.13204143,
        83.17591971, 83.9356577 , 84.51219997, 85.08874224, 85.60221899,
        86.06881469, 86.53541039, 86.81505112, 86.50525824, 86.19546537,
        85.8856725 , 84.11270563, 80.72901781, 77.34532998, 73.96164216,
        70.40021326, 65.40069749, 60.40118171, 55.40166593, 50.40215015,
        45.40263437]), "knot"),
 'v': Quantity(array([18.66086474, 36.01453964, 45.53984712, 53.10623166, 59.38215218,
        59.05092562, 55.28500288, 51.94187456, 50.1954783 , 49.66988884,
        49.85990904, 51.78244693, 56.46709313, 60.02961237, 60.84532449,
        59.66660565, 57.29666505, 54.43291075, 52.30461878, 50.22769648,
        48.23217378, 46.37887893, 44.47567142, 42.622449  , 40.90353986,
        39.14684026, 37.44460536, 36.54175357, 35.65272154, 34.7886022 ,
        34.00345553, 33.28106768, 32.65041542, 32.06421469, 31.6253827 ,
        31.25463334, 31.45942638, 32.06949096, 32.75306757, 33.56939574,
        34.38572391, 34.11138697, 33.80931278, 33.01418622, 31.48316553,
        29.95214485, 28.53406468, 27.18880142, 25.84353815, 24.6008193 ,
        23.43432894, 22.26783857, 21.46927107, 21.83069461, 22.19211815,
        22.55354169, 22.74292763, 22.74292763, 22.74292763, 22.74292763,
        22.55301797, 20.82656654, 19.1001151 , 17.37366366, 15.64721223,
        13.92076079]), "knot"),
 'z': Quantity(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.]), "meter"),
 'p': Quantity(array([994.5       , 963.26998725, 936.23017502, 909.73506942,
        883.80658185, 858.50722551, 833.82295353, 809.70734416,
        786.14221219, 763.11430608, 740.61171079, 718.62711907,
        697.16761172, 676.34122729, 656.14926345, 636.44662889,
        617.20023448, 598.37954779, 580.1313726 , 562.32364579,
        544.87197734, 527.84662552, 511.33856986, 495.12379117,
        479.33299942, 463.98202993, 448.85045154, 434.33580763,
        420.04333642, 406.15137248, 392.6045958 , 379.33213605,
        366.53599038, 353.97064815, 341.84626818, 329.92560763,
        318.4227026 , 307.21396259, 296.25820433, 285.75929277,
        275.26038121, 265.52836812, 255.8158584 , 246.40914246,
        237.45883207, 228.50852167, 219.9907699 , 211.75190459,
        203.51303929, 195.69730086, 188.19610242, 180.69490399,
        173.40097262, 166.76051501, 160.1200574 , 153.47959979,
        147.27439304, 141.54832799, 135.82226294, 130.09619789,
        124.49115521, 119.86529346, 115.23943171, 110.61356997,
        105.98770822, 101.36184647]), "hectopascal"),
 'omega': Quantity(array([ 0.00000000e+00, -2.59999990e-01, -2.21444484e-01, -1.77788056e-01,
        -2.60683144e-01, -3.69373993e-01, -4.45295731e-01, -4.57765868e-01,
        -4.05655076e-01, -3.08194392e-01, -2.02446840e-01, -1.37450847e-01,
        -1.24335219e-01, -8.26824526e-02, -4.22985259e-02, -2.89325772e-03,
         2.31199057e-02,  3.64818079e-02,  1.09474506e-01,  1.85775953e-01,
         2.58460880e-01,  3.19752159e-01,  3.30000013e-01,  3.28049526e-01,
         3.21733196e-01,  2.84742489e-01,  2.35401801e-01,  1.77343229e-01,
         1.18190681e-01,  5.70660386e-02,  4.18382626e-04, -5.26714562e-02,
        -9.36992273e-02, -1.28882186e-01, -1.62830447e-01, -1.96208293e-01,
        -2.33678269e-01, -2.74029741e-01, -3.20954066e-01, -3.79747964e-01,
        -4.38541863e-01, -4.89252482e-01, -5.39757530e-01, -4.86692099e-01,
        -2.79044901e-01, -7.13977020e-02,  1.04173524e-01,  2.59064188e-01,
         4.13954852e-01,  4.33530839e-01,  3.52517897e-01,  2.71504956e-01,
         2.03603884e-01,  1.77042055e-01,  1.50480227e-01,  1.23918398e-01,
         1.26353640e-01,  1.60710028e-01,  1.95066417e-01,  2.29422805e-01,
         2.55929232e-01,  2.18922340e-01,  1.81915447e-01,  1.44908555e-01,
         1.07901662e-01,  7.08947700e-02]), "pascal / second"),
 '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': 80.0,
  'source': 'MODEL REANALYSIS',
  'model': 'RUC',
  'fcst-hour': 'F00',
  'run-time': ['2011', '04', '27', '22'],
  'valid-time': ['2011', '04', '27', '22'],
  'box_area': '0.1Β° x 0.1Β° BOX AVG',
  'archive': 'NCEI RUC_13km',
  'data-source': 'NCEI THREDDS 13KM'},
 'titles': {'top_title': 'MODEL REANALYSIS VERTICAL PROFILE | 22Z RUC F00',
  'left_title': '22Z RUC F00 | VALID: 04/27/2011 22Z',
  'right_title': '33.19, -87.46 | 0.1Β° x 0.1Β° BOX AVG    '}}

LETS PLOT THE DATA ON A SOUNDING AND HODOGRAPH

[4]:
# lets make a sounding!
# radar='single' shows the nearest NEXRAD site's reflectivity on the map.
# The default radar mosaic only keeps about the last month, so it can't cover this date.
spy.build_sounding(clean_data, radar='single')
> SOUNDING PLOTTER FUNCTION
  ---------------------------------
    > PREPARING DATA
    > BUILDING SKEW-T LOG-P DIAGRAM
    > BUILDING HODOGRAPH
    > BUILDING MAP INSET
    > RADAR SCAN FOUND: Site: KBMX Scan: 2011-04-27 | 22:05z
Ignoring fixed x limits to fulfill fixed data aspect with adjustable data limits.
Ignoring fixed x limits to fulfill fixed data aspect with adjustable data limits.
Ignoring fixed y limits to fulfill fixed data aspect with adjustable data limits.
    > BUILDING ACCESSORY PLOTS
    > PLOTTING SOUNDING PARAMETERS
    > FIGURE LOADING...
    > COMPLETE --------
    > RUNTIME: 00:00:27
../_images/notebooks_reanalysis_data_example_7_3.png
[ ]: