MetPy
MetPy copied to clipboard
Velocity potential
Another potential calculation: velocity potential
For a citation on this: Krishnamurti 1971, although most people don't seem to use the curvature term that this tacks on at the end.
Looks like we would need an inverse laplacian operator to handle this. Seems like something to tackle when there's a lot of caffeine handy.
I spent some time looking for an existing pythonic solution on velocity potential and stream function. These two are the most promising hits but a caution that I haven't tested any of them, just sharing for someone interested who stumble upon this thread or possibly could be incorporated by MetPy developers:
Apparently, ECMWF's METVIEW package has a function to calculate velocity potential but it needs input in spectral fields. I'm not very familiar with grid nomenclature and windspharm documentation writes that it work on global wind fields in spherical geometry. That would imply it could work on a regular lat-lon grid(?) A quick check on NCL shows they provide 2 functions for fixed and gaussian grid respectively.
EDIT: Windspharm package is well tested and uses the same core library as NCL called SPHEREPACK. More Details
The windspharm package works well, especially the xarray portion where I was able to easy calculate streamfunction and velocity potential with data read from a THREDDS server and using the MetPy declarative syntax for plotting after adding the calculated results back into the xarray dataset. The result from windspharm gives units in the output, which would work well with couple with other equations and we just assume the spherical earth since it requires global data for the calculation.
I was also able to calculate and plot the irrotational and non-divergent winds using windspharm and Metpy.
@dopplershift The reconstructed wind field from vorticity and divergence paper has an equation to calculate the velocity potential and stream function using the inverted Laplacian. While windspharm works for spectral fields for non global data we can use the inverse Laplacian operator to calculate the velocity potential