Example for Pairing University of Wyoming data with UFS-Chem

This example will demonstrate how to use MELODIES MONET to pair aircraft observations from the University of Wyoming (https://weather.uwyo.edu/upperair/sounding.shtml) to model output from the UFS-Chem (dyn*.nc and phy*.nc output files) and save the paired data for each flight as a netcdf. Users can then read these files back into MELODIES MONET to create plots or calculate statistics or use this paired data output file to do their own analysis.

Pairing aircraft data takes awhile so it is recommended that users first pair the data and then produce the plots and statistics, so that you are not repairing everytime you want to change something small during your analysis.

This example resamples the data to ‘2s’. To reduce memory constraints, use a smaller window. For examples, on how to submit a job to process more flight days with a shorter resampling, see the end of this jupyter notebook.

First, we import the loop_pairing function from melodies_monet.util.tools.

from melodies_monet.util.tools import loop_pairing

Second, we read in a control file that explains all the pairing parameters.

control_fn='control_looping_UWY_UFS_CHEM.yaml'

Third, provide the info in a dictionary like that below and then pair the data

file_pairs = {
    '0801_12Z_72632': {
        #'model': {'ufschem': '/wrk/rschwantes/aeromma_1x1/short2/2023_08_01_ufschemv1.nc'},
        #'obs': {'uwy': '/wrk/rschwantes/aeromma_1x1/obs/2023080112-72632.csv'}
        'model': {'ufschem': 'example:ufschem:2023-08-01'},
        'obs': {'uwy': 'example:uwy-sonde:2023-08-01'}
    }
}
loop_pairing(control=control_fn,file_pairs=file_pairs)
ufschem
example:ufschem:2023-08-01
**** Reading UFS-AQM or UFS-Chem model output...
Performing extra model calculations...
Calculating modeled Dewpoint...
Calculating modeled relative humidity...
/home/rschwantes/MONET/met_Liam/update_to_develop/MELODIES-MONET/melodies_monet/util/metcalc.py:91: UserWarning: Saturation mixing ratio is undefined for some requested pressure/temperature combinations. Total pressure must be greater than the water vapor saturation pressure for liquid water to be in equilibrium.
  rlh = (metpy.calc.relative_humidity_from_specific_humidity(
Calculating modeled windpseed...
Calculating modeled wind direction...
Calculating modeled potential temperature...
Performing extra calculations for obs...
Calculating observed potential temperature...
1, in pair data
After pairing:        longitude  latitude  pressure_obs                time  \
0     -83.47140   42.6991       98360.0 2023-08-01 11:05:36   
1     -83.47140   42.6992       98235.0 2023-08-01 11:05:38   
2     -83.47145   42.6992       98120.0 2023-08-01 11:05:40   
3     -83.47155   42.6992       98000.0 2023-08-01 11:05:42   
4     -83.47160   42.6993       97870.0 2023-08-01 11:05:44   
...         ...       ...           ...                 ...   
2707  -83.10400   41.9284         560.0 2023-08-01 13:04:50   
2708  -83.10980   41.9291         550.0 2023-08-01 13:05:10   
2709  -83.11510   41.9302         540.0 2023-08-01 13:05:32   
2710  -83.12040   41.9314         530.0 2023-08-01 13:05:50   
2711  -83.12730   41.9334         520.0 2023-08-01 13:06:12   

      geopotential height_m  temperature_C  dpt_obs  ice point temperature_C  \
0                     332.0         286.90   286.05                    12.90   
1                     343.0         288.80   286.70                    13.55   
2                     352.5         290.05   286.15                    13.00   
3                     363.5         290.55   285.85                    12.70   
4                     374.5         290.85   285.75                    12.60   
...                     ...            ...      ...                      ...   
2707                35452.0         238.35   195.25                   -73.60   
2708                35576.0         238.95   195.65                   -73.30   
2709                35705.0         238.95   195.65                   -73.20   
2710                35838.0         239.45   195.95                   -73.00   
2711                35969.0         239.65   196.05                   -72.80   

      relh_obs  humidity wrt ice_%  ...    ptemp_obs  temperature_k  \
0         95.0                95.0  ...   288.258684     289.715425   
1         87.5                87.5  ...   290.273127     289.951402   
2         77.5                77.5  ...   291.627086     290.168457   
3         74.0                74.0  ...   292.231963     290.394908   
4         72.0                72.0  ...   292.644667     290.625450   
...        ...                 ...  ...          ...            ...   
2707       0.0                 1.0  ...  1048.552079     240.237411   
2708       0.0                 1.0  ...  1056.617246     240.674899   
2709       0.0                 1.0  ...  1062.171225     241.112322   
2710       0.0                 1.0  ...  1070.093524     241.548839   
2711       0.0                 1.0  ...  1076.831885     241.985535   

        dewpoint    rel_hum  windspeed     winddir    ptemp_mod      spfh  \
0     284.557419  71.658070   0.495779  312.910470   291.088316  0.008567   
1     284.513523  70.405997   0.503581  312.826437   291.431529  0.008552   
2     284.473136  69.254261   0.510756  312.749742   291.747241  0.008540   
3     284.430994  68.052627   0.518245  312.668439   292.076638  0.008526   
4     284.384338  66.820616   0.528139  312.503869   292.418841  0.008511   
...          ...        ...        ...         ...          ...       ...   
2707  170.831865   0.006223  25.470374   92.928157  1060.169729  0.000002   
2708  170.871197   0.005994  25.638503   92.916639  1067.586148  0.000002   
2709  170.910563   0.005765  25.805907   92.907023  1075.002408  0.000002   
2710  170.949922   0.005537  25.974081   92.896310  1082.414819  0.000002   
2711  170.989330   0.005308  26.141009   92.888589  1089.828162  0.000002   

           ugrd      vgrd  
0      0.363372 -0.331242  
1      0.369568 -0.336126  
2      0.375258 -0.340622  
3      0.381203 -0.345315  
4      0.389525 -0.350925  
...         ...       ...  
2707 -25.436431  1.296275  
2708 -25.604476  1.299525  
2709 -25.771739  1.303623  
2710 -25.939798  1.307319  
2711 -26.106523  1.312325  

[2712 rows x 23 columns]
Writing: ./output/uwy_ufschem/0801_12Z_72632_uwy_ufschem.nc4
WARNING: The following variables have been renamed due to illegal characters in the variable name for netcdf4 format. 
The original variable names can be found in the `long_name` variable attribute. 
['geopotential height_m', 'ice point temperature_C', 'humidity wrt ice_%', 'mixing ratio_g/kg']