I have calculated the ∂θe/∂z with 'Height', 'Latitude', 'Longitude' dimensions.

import numpy as np
import xarray as xr
from wrf import (getvar)

eth = np.array(getvar(ncfile, "eth", timeidx=time))
z = np.array(getvar(ncfile, "z", timeidx=time, units="km")) 

deth = np.gradient(eth, axis=0)
dz = np.gradient(z, axis=0)
deth_dz = deth/dz

dthdz = xr.DataArray(data=deth_dz, dims=['Height', 'Latitude', 'Longitude'])

I would like to plot the horizontal depth or thickness (in km) of the dthdz. It is a bit similar to this question. But when I do dthdz.sum(dim='Height'), I get very low depth values. I just want to know where I'm doing it wrong. Thank you!

New contributor
Kas is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • $\begingroup$ For programming related questions unless you provide the dataset very few here can help you $\endgroup$
    – gansub
    Sep 14 at 7:44
  • $\begingroup$ Why not use MetPy's thickness API - unidata.github.io/MetPy/latest/api/generated/… ? $\endgroup$
    – gansub
    Sep 14 at 7:45
  • $\begingroup$ thanks @gansub! this uses conventional wrfout data. i tried the thickness_hydrostatic but it outputs in 1D. i was hoping to make a horizontal plot of the depth $\endgroup$
    – Kas
    Sep 14 at 8:36
  • $\begingroup$ Suggest you take this over to MetPy gitter and then ask the question over there. $\endgroup$
    – gansub
    Sep 14 at 8:49

Your Answer

Kas is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.