Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/metpy/calc/cross_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,14 @@ def absolute_momentum(u, v, index='index'):
_, x, y = xr.broadcast(norm_wind, x, y)
distance = np.hypot(x.metpy.quantify(), y.metpy.quantify())

return (norm_wind + f * distance).metpy.convert_units('m/s')
momentum = (norm_wind + f * distance).metpy.convert_units('m/s')

# The arithmetic above can carry through attributes that do not describe
# absolute momentum (e.g. the cross-section's x-coordinate metadata picked
# up via ``distance``, or the input wind's attributes), and whether they
# propagate at all depends on xarray's ``keep_attrs`` default. Absolute
# momentum is a newly derived quantity, so return it without these
# inherited attributes.
momentum.attrs = {}

return momentum
Loading