stilt.sampling.calc_pbl_height#
- stilt.sampling.calc_pbl_height(particles, files, *, z_top=25000.0)[source]#
Return the mixed-layer height at each particle, found from the met’s profile as HYSPLIT’s
kmixd: 3finds it.This is HYSPLIT’s default way to find the mixed layer, ported from its source (
stbanl.f, Holtslag and Boville, 1993). Going up the column, the mixed layer ends where the bulk Richardson number between the lowest level and the level reached passes 0.25:Ri = g · (θ(z) − θ₁ − θₑ) · (z − z₁) / ((θ₁ + θₑ) · |V(z) − V₁|²)
with θ the potential temperature, V the horizontal wind, and level 1 HYSPLIT’s lowest internal level. θₑ, the temperature excess of rising air, is
8.5 u* θ* / (u*³ + 0.6 w*³)^(1/3)in unstable air and 0 otherwise, with the friction velocityu*(USTR) and the friction temperatureθ*from the sensible heat flux (SHTF) at the ground. The height is interpolated to where Ri is 0.25.HYSPLIT computes the height at each met grid point and met time; a particle takes the nearest grid point’s height at the met times before and after it, linear in time. So does this function, on HYSPLIT’s internal levels for a run with the top z_top. It applies no minimum: HYSPLIT’s
kmix0ispbl_height_minin PYSTILT. A column with no height where Ri reaches 0.25 gets the second-highest internal level, as in HYSPLIT. Validation says how close it comes to themlhtHYSPLIT writes.- Parameters:
particles (
DataFrame) – A particle table withlon,lat, andtime.files (
Iterable[str|PathLike[str]]) – ARL met files that cover the particles’ times, withTEMP,PRES,UWND,VWNDandSHGT, the sensible heat fluxSHTF, and the friction velocityUSTRor the momentum fluxesUMOFandVMOF.z_top (
float) – The top of the domain in meters, which sets HYSPLIT’s internal levels (z_topofruntraj.models.hysplit.HysplitConfig).
- Returns:
The mixed-layer height at each row, in m above ground. A row off the met’s grid is NaN.
- Return type:
- Raises:
ValueError – If particles has no
timecolumn or a row is outside the files’ times.KeyError – If the files lack a variable it needs.
Examples
>>> meta = runtraj.particles.particles_metadata( ... sim.particles_path ... ) >>> mlht = stilt.sampling.calc_pbl_height( ... sim.particles, meta.met_files ... )