Use functions from
metpy.calc to perform calculations for a rising and sinking parcel.
The code below explores a common problem in meteorology where a parcel can be defined and lifted initiatlly dry adibatically until saturation is reached. It then ascends moist adiabatically to a desired level before descending back to the original level from which the parcel started.
To set up the classic mountain problem, let’s define that the parcel will start at 1000-hPa and ascend to 700-hPa with an initial temperature of 25 Celsius and a dewpoint of 10 Celsius
We first need to determine the maximum level of dry ascent. For this we can use the LCL function and retain the pressure level and temperature of the parcel at the LCL
Initial dry ascent yields: LCL Pressure: 801.54 hectopascal LCL Temperature: 6.74 degree_Celsius
Knowing that the calculation of the dry ascent is accomplished by the LCL calculation, we know how to begin our moist ascent. Begin by subsetting the pressure to begin at levels less than or equal to the LCL pressure and use the moist_lapse to find the temperature at the top of our ascent (700-hPa in our case)
After moist ascent: Temperature at top of ascent: 0.82 degree_Celsius
Now to come “down the mountain” our parcel will warm dry adiabatically, so we can use the dry_laspe function to descend from the lowest pressure (using [::-1] to reverse the order) and convert our solution to Celsius
Pulling it all together
Starting Temperature: 25.00 degree_Celsius Starting Dewpoint: 10.00 degree_Celsius Final Temperature: 30.21 degree_Celsius Final Dewpoint: 0.82 degree_Celsius
So as we expect the parcel has warmed and dried out through the combined dry and moist ascent due to the release of latent heat and subsequent precipitating out of moisture from the parcel
Total running time of the script: ( 0 minutes 0.012 seconds)