-
Notifications
You must be signed in to change notification settings - Fork 443
Closed
Labels
Area: DocsAffects documentationAffects documentationType: EnhancementEnhancement to existing functionalityEnhancement to existing functionality
Milestone
Description
What went wrong?
I'm making a sounding program and I have error messages only part of the time pop up with respect to getting the 0-6km data. I looked at the raw data for both a dataset that works and one that doesn't work and they have the same bottom bound. The one that works is PANC at 5/30/2020 12z and an example of one that doesn't work is PANC at 2/12/2022 00z. I'm not sure what is going on here. I specifically have this issue when trying to calculate bunkers storm motion.
Operating System
Linux
Version
metpy 1.3.0
Python Version
Python 3.9.12
Code to Reproduce
# 0-6km
(pres_trimmed, u_trimmed1, v_trimmed1,
speed_trimmed1, height_trimmed1) = mpcalc.get_layer(d['pressure'],
d['u_wind'],
d['v_wind'],
d['speed'],
d['height'],
depth=6 * units.km)
# Wind mean is the U and v component of sfc-6km mean flow
right, left, wind_mean = mpcalc.bunkers_storm_motion(pres_trimmed, u_trimmed1, v_trimmed1, height_trimmed1)Errors, Traceback, and Logs
ValueError Traceback (most recent call last)
Input In [14], in <cell line: 398>()
393 strShear = str(rounded_bulk_shear)
395 #***Bunkers Storm Motion***
396 # Gets u and v components for each type of bunkers storm motion
397 # Wind mean is the U and v component of sfc-6km mean flow
--> 398 right, left, wind_mean = mpcalc.bunkers_storm_motion(pres_trimmed, u_trimmed1, v_trimmed1, height_trimmed1)
400 # Extracts u and v components for each category
401 uright = right[0]
File ~/miniconda3/lib/python3.9/site-packages/metpy/xarray.py:1235, in preprocess_and_wrap.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
1232 _mutate_arguments(bound_args, units.Quantity, lambda arg, _: arg.m)
1234 # Evaluate inner calculation
-> 1235 result = func(*bound_args.args, **bound_args.kwargs)
1237 # Wrap output based on match and match_unit
1238 if match is None:
File ~/miniconda3/lib/python3.9/site-packages/metpy/units.py:298, in check_units.<locals>.dec.<locals>.wrapper(*args, **kwargs)
295 @functools.wraps(func)
296 def wrapper(*args, **kwargs):
297 _check_units_inner_helper(func, sig, defaults, dims, *args, **kwargs)
--> 298 return func(*args, **kwargs)
File ~/miniconda3/lib/python3.9/site-packages/metpy/calc/indices.py:195, in bunkers_storm_motion(pressure, u, v, height)
155 r"""Calculate the Bunkers right-mover and left-mover storm motions and sfc-6km mean flow.
156
157 Uses the storm motion calculation from [Bunkers2000]_.
(...)
192
193 """
194 # mean wind from sfc-6km
--> 195 _, u_mean, v_mean = get_layer(pressure, u, v, height=height,
196 depth=units.Quantity(6000, 'meter'))
197 wind_mean = units.Quantity([np.mean(u_mean).m, np.mean(v_mean).m], u_mean.units)
199 # mean wind from sfc-500m
File ~/miniconda3/lib/python3.9/site-packages/metpy/xarray.py:1235, in preprocess_and_wrap.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
1232 _mutate_arguments(bound_args, units.Quantity, lambda arg, _: arg.m)
1234 # Evaluate inner calculation
-> 1235 result = func(*bound_args.args, **bound_args.kwargs)
1237 # Wrap output based on match and match_unit
1238 if match is None:
File ~/miniconda3/lib/python3.9/site-packages/metpy/units.py:298, in check_units.<locals>.dec.<locals>.wrapper(*args, **kwargs)
295 @functools.wraps(func)
296 def wrapper(*args, **kwargs):
297 _check_units_inner_helper(func, sig, defaults, dims, *args, **kwargs)
--> 298 return func(*args, **kwargs)
File ~/miniconda3/lib/python3.9/site-packages/metpy/calc/tools.py:600, in get_layer(pressure, height, bottom, depth, interpolate, *args)
597 else:
598 raise ValueError('Depth must be specified in units of length or pressure')
--> 600 top_pressure, _ = _get_bound_pressure_height(pressure, top, height=height,
601 interpolate=interpolate)
603 ret = [] # returned data variables in layer
605 # Ensure pressures are sorted in ascending order
File ~/miniconda3/lib/python3.9/site-packages/metpy/calc/tools.py:427, in _get_bound_pressure_height(pressure, bound, height, interpolate)
424 raise ValueError('Specified bound is outside pressure range.')
425 if height is not None and not (_less_or_close(bound_height, np.nanmax(height))
426 and _greater_or_close(bound_height, np.nanmin(height))):
--> 427 raise ValueError('Specified bound is outside height range.')
429 return bound_pressure, bound_height
ValueError: Specified bound is outside height range.Metadata
Metadata
Assignees
Labels
Area: DocsAffects documentationAffects documentationType: EnhancementEnhancement to existing functionalityEnhancement to existing functionality