New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respelling of v_vorticity
and h_divergence
#684
Conversation
Safe to ignore codacy |
@deeplycloudy @kgoebber @ktyle If you guys have any opinion on this (especially the |
How does the API change between 2D and 3D for both functions in the future? In terms of the fluid physics both are technically 3D quantities.
It is often necessary (e.g., severe storm cold pool dynamics) to calculate horizontal vorticity, so I'm not sure the synoptic scale terminology should wholly drive the design here.
In fact, the same 2D function works for values along any plane, so it might be better to say in the docs the function calculates 2D vorticity and then give an example of calculating horizontal vorticity on the synoptic scale.
… On Dec 12, 2017, at 18:26, Ryan May ***@***.***> wrote:
@deeplycloudy @kgoebber @ktyle If you guys have any opinion on this (especially the h_convergence to convergence), I’d love to hear it now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Are these just |
I generally agree with @deeplycloudy and would prefer |
Ok, I think I see where you're coming from @kgoebber @deeplycloudy -- which is why it's great to get input on issues like this. @jrleeman I think the extensions for these two functions are going to be done differently in the future, owing to differences in the way they extend to additional dimensions. For now, let's do this:
In the future, should we actually have the need, we can add |
metpy/calc/tests/test_kinematics.py
Outdated
from metpy.calc import (advection, divergence_vorticity, frontogenesis, geostrophic_wind, | ||
get_wind_components, h_divergence, montgomery_streamfunction, | ||
from metpy.calc import (advection, divergence, divergence_vorticity, frontogenesis, | ||
geostrophic_wind, get_wind_components, montgomery_streamfunction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E241 multiple spaces after ','
metpy/calc/tests/test_kinematics.py
Outdated
a = np.arange(3) | ||
u = np.c_[a, a, a] * units('m/s') | ||
with pytest.raises(NameError): | ||
v = v_vorticity(u, u.T, 1 * units.meter, 1 * units.meter, dim_order='xy') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
F841 local variable 'v' is assigned to but never used
metpy/calc/tests/test_kinematics.py
Outdated
get_wind_components, h_divergence, montgomery_streamfunction, | ||
from metpy.calc import (advection, convergence, convergence_vorticity, divergence, | ||
divergence_vorticity, frontogenesis, | ||
geostrophic_wind, get_wind_components, montgomery_streamfunction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E241 multiple spaces after ','
true_c = np.ones_like(u) / units.sec | ||
true_v = np.ones_like(u) / units.sec | ||
assert_array_equal(c, true_c) | ||
assert_array_equal(v, true_v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W292 no newline at end of file
Safe to ignore code climate. Had to add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally 👍
I don't like the dim_order
, but I see no way around it.
metpy/calc/kinematics.py
Outdated
@deprecated('0.7', addendum=' This function has been renamed vorticity.', | ||
pending=False) | ||
def v_vorticity(u, v, dx, dy, dim_order='xy'): | ||
r"""Calculate the vertical vorticity of the horizontal wind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just do:
v_vorticity.__doc__ = vorticity.__doc__?
metpy/calc/tests/test_kinematics.py
Outdated
|
||
|
||
def test_convergence_vorticity(): | ||
"""TTest that convergence_vorticity wrapper works (deprecated in 0.7).""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You stuttered here. 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metpy/calc/kinematics.py
Outdated
pending=False) | ||
def v_vorticity(u, v, dx, dy, dim_order='xy'): | ||
return vorticity(u, v, dx, dy, dim_order=dim_order) | ||
v_vorticity.__doc__ = vorticity.__doc__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E305 expected 2 blank lines after class or function definition, found 0
metpy/calc/kinematics.py
Outdated
pending=False) | ||
def convergence(u, v, dx, dy, dim_order='xy'): | ||
return divergence(u, v, dx, dy, dim_order=dim_order) | ||
convergence.__doc__ = divergence.__doc__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E305 expected 2 blank lines after class or function definition, found 0
metpy/calc/kinematics.py
Outdated
pending=False) | ||
def convergence_vorticity(u, v, dx, dy, dim_order='xy'): | ||
return divergence_vorticity(u, v, dx, dy, dim_order=dim_order) | ||
convergence_vorticity.__doc__ = divergence_vorticity.__doc__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E305 expected 2 blank lines after class or function definition, found 0
f09501c
to
3a1d973
Compare
Should be ready to go @dopplershift |
A few respellings that are clearer instead of shorter. These could be up for debate, but it's more in line with the ethos we're working around here.
v_vorticity
->vertical_vorticity
h_divergence
->divergence
(with options for 3D post X-array integration)I still need to add some skeletons for the old names telling users that those have been renamed.