Skip to content

What is the right way to calculate gradient in Metpy ? #2975

Answered by dopplershift
Dearsomeone asked this question in Q&A
Discussion options

You must be logged in to vote

metpy.calc.gradient is just doing normal finite-difference-based approximation to the derivative, assuming the data are on a Cartesian grid. Effects of calculating on a spherical Earth are only handled by computing grid spacing using "great circle" distance between lat/lon points.

metpy.calc.geospatial_gradient explicit "corrects" plain Cartesian gradient for working in a spherical coordinate system with explicit factors like GEMPAK did. Note, you shouldn't need to pass dx/dy manually and should be able to do directly grad2 = mpcalc.geospatial_gradient(psl).

geospatial_gradient is the most correct calculation, but requires the input data to have good information/metadata regarding the coo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Dearsomeone
Comment options

Answer selected by Dearsomeone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants