[python #BLO-430107]: Bulk Richardson number calculation - gradients?
- Subject: [python #BLO-430107]: Bulk Richardson number calculation - gradients?
- Date: Mon, 23 Mar 2020 19:06:16 -0600
Apologies on the delayed response. I'm not sure if this will still be helpful,
but I can think of two ways.
The first, given that you already have an equation in terms of deltaU, deltaV,
deltaZ, deltaTheta would be to calculate those delta terms using a simple
forward difference. You can get this using `np.diff`:
delta_u = np.diff(uz)
delta_v = np.diff(vz)
delta_z = np.diff(z)
delta_theta = np.diff(vpt)
The other way would be to use metpy's `first_derivative` function (which uses
an O(N^2) accurate approximation, correct on variable spacing). Note: the first
derivative calculation is calculating e.g. Uprime = deltaU / deltaZ, so we
would need to reformulate the equation for Bulk Richardson number to:
Rb = (g/tpt) * Thetaprime / (Uprime**2 + Vprime**2)
Then calculate the derivatives
import metpy.calc as mpcalc
theta_prime = mpcalc.first_derivative(vpt, x=z)
u_prime = mpcalc.first_derivative(uz, x=z)
v_prime = mpcalc.first_derivative(vz, x=z)
Hope this helps,
> I am trying to calculate the bulk Richardson number for a given vertical
> profile. I have all of the necessary variables (pressure, temperature,
> mixing ratio), but am unsure as to how to calculate the gradients in an
> efficient way.
> I have experimented with your gradient function but cannot get the correct
> [image: image.png]
> Any advice you could provide would be much appreciated!
Ticket ID: BLO-430107
Department: Support Python
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata
inquiry tracking system and then made publicly available through the web. If
you do not want to have your interactions made available in this way, you must
let us know in each email you send to us.