I have a netCDF file of stream function (psi) having dimension (latitude, level), level is pressure level. There are 5 pressure levels (700,600,500,400,300 hPa). I need to compute the mass weighted vertical average, i.e. before averaging I need to know the atmospheric mass at each pressure level which will be their weights and after that, average of psi will be computed. The final output will be one dimensional i.e. (latitude,). How to compute this weight and how to do it in Python?
-
1$\begingroup$ Have you looked at MetPy's implementation - unidata.github.io/MetPy/latest/api/generated/… ? $\endgroup$– gansubSep 15 at 6:27
-
$\begingroup$ I think it is used only when psi will be having only one value at each level. In the above problem psi is having values at each latitude for all levels. Also, in the MetPY documentation ,in the Note section it has been written that "Only functions on 1D profiles not higher-dimension vertical cross sections or grids." $\endgroup$– AmanSep 15 at 10:03
-
1$\begingroup$ I gave you a hint on how to do it . I did not say anywhere that has to be the final solution. If you are dealing with a big problem and are a python newbie then the first thing to know is to split the problem in smaller steps and ask questions on smaller problem. Also you can write an enhancement request on MetPy and maybe they can tell you how to use their software as you want it. $\endgroup$– gansubSep 15 at 10:13