I want to calculate the layer thickness from ECMWF data.
What I have are the variables T (within one layer) and relhum (within one layer) and pressure (both at layer interfaces, and at layer midpoints).
I have trouble understanding the pressure
argument to the metpy.calc.thickness_hydrostatic_from_relative_humidity
function:
When I look at the formula given in the docstring,
$$ Z_2 - Z_1 = -\frac{R_d}{g} \int_{p_1}^{p_2} T_v d\ln p $$
it seems to me as if the function would return the LHS, i.e., $Z_2 - Z_1$.
However, it also seems to me as if the pressure
, temperature
, relative_humidity
arguments all have to have the same dimensions.
I find this confusing: In order to get the thickness of the layer between $Z_1$ and $Z_2$, I would expect to have to input both pressures $p_1$ and $p_2$ as well. However, the temperatures are usually defined at full levels, i.e., I have one less temperature than I have pressures.
For example, in order to calculate the thickness of the bottom layer I would expect to give pressure at surface, pressure at top of layer, and temperature (and humidity) within the layer. But when I try to use the function like this, I get a
ValueError: operands could not be broadcast together with shapes (361,1440,79) (361,1440,78)
Please help me understand how to use this function properly.