How to properly produce a cross section with model levels and vertical interpolation #1688
Unanswered
guidocioni
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to produce a cross section using data on model levels to properly capture the structure of a cold front. Note that I do have data on pressure levels but I want to use model hybrid levels to have a better vertical resolution.
The input dataset (obtained from the operational COSMO-D2 model, https://opendata.dwd.de/weather/nwp/cosmo-d2/) has some standard variables defined on the same vertical axis and a 2D variable containing the height of model levels in meters above sea level. What I want to obtain is a cross section on height levels, so not on model levels. I figured out that I have to do vertical interpolation as well as the usual cross section interpolation, so here is what I've come up with.
First compute the cross section interpolation for all the variables in the dataset.
This data is still on model levels so I cannot plot it on a contour plot with height as y axis. In oder to interpolate vertically from model levels to height levels the only function that (I believe) exists is
interpolate_1d
which unfortunately does not allow to pass an entire dataset but only arrays without the time dimension.To decide which levels are to be used for the interpolation I decided to take a sample of levels where the terrain is "flat". This way the data "inside" the orography will be hopefully masked.
If
HHL
is the variable that contains the 2D height of model levelsreturns
Makes sense. Let's use this to do vertical interpolation of some variables
Let's plot these values by setting a background so that we can see where the array is masked
After some polishing this is what I obtain
I think the results are correct: I can see what I would expect and the data is masked over mountains.
But the question is...isn't there a better way to do this? Especially for the vertical interpolation method I believe there should be a function that just takes the whole cross section dataset (
cross
in this case) to do a vertical interpolation over defined levels. I believe this is what most of the people would like to see if they're using model levels. Right nowinterp_1d
only accepts numpy arrays.I hope I didn't overlooked something...
Beta Was this translation helpful? Give feedback.
All reactions