This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Greetings! 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, Ryan > Hi, > 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 > output. > > [image: image.png] > > http://glossary.ametsoc.org/wiki/Bulk_richardson_number > > Any advice you could provide would be much appreciated! Ticket Details =================== Ticket ID: BLO-430107 Department: Support Python Priority: Low Status: Closed =================== 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.