Bug#1079677: metpy: tests fail with scipy 1.14

Drew Parsons dparsons at debian.org
Mon Aug 26 08:51:18 BST 2024


Source: metpy
Version: 1.6.2+ds-1
Severity: normal

metpy is failing tests with scipy 1.14 (from experimental)

 94s _______________________________ test_sweat_index _______________________________
 94s 
 94s     def test_sweat_index():
 94s         """Test the SWEAT Index calculation."""
 94s         pressure = np.array([1008., 1000., 947., 925., 921., 896., 891., 889., 866.,
 94s                              858., 850., 835., 820., 803., 733., 730., 700., 645.,
 94s                              579., 500., 494., 466., 455., 441., 433., 410., 409.,
 94s                              402., 400., 390., 388., 384., 381., 349., 330., 320.,
 94s                              306., 300., 278., 273., 250., 243., 208., 200., 196.,
 94s                              190., 179., 159., 151., 150., 139.]) * units.hPa
 94s         temperature = np.array([27.4, 26.4, 22.9, 21.4, 21.2, 20.7, 20.6, 21.2, 19.4,
 94s                                 19.1, 18.8, 17.8, 17.4, 16.3, 11.4, 11.2, 10.2, 6.1,
 94s                                 0.6, -4.9, -5.5, -8.5, -9.9, -11.7, -12.3, -13.7, -13.8,
 94s                                 -14.9, -14.9, -16.1, -16.1, -16.9, -17.3, -21.7, -24.5, -26.1,
 94s                                 -28.3, -29.5, -33.1, -34.2, -39.3, -41., -50.2, -52.5, -53.5,
 94s                                 -55.2, -58.6, -65.2, -68.1, -68.5, -72.5]) * units.degC
 94s         dewpoint = np.array([24.9, 24.6, 22., 20.9, 20.7, 14.8, 13.6, 12.2, 16.8,
 94s                              16.6, 16.5, 15.9, 13.6, 13.2, 11.3, 11.2, 8.6, 4.5,
 94s                              -0.8, -8.1, -9.5, -12.7, -12.7, -12.8, -13.1, -24.7, -24.4,
 94s                              -21.9, -24.9, -36.1, -31.1, -26.9, -27.4, -33., -36.5, -47.1,
 94s                              -31.4, -33.5, -40.1, -40.8, -44.1, -45.6, -54., -56.1, -56.9,
 94s                              -58.6, -61.9, -68.4, -71.2, -71.6, -77.2]) * units.degC
 94s         speed = np.array([0., 3., 10., 12., 12., 14., 14., 14., 12.,
 94s                           12., 12., 12., 11., 11., 12., 12., 10., 10.,
 94s                           8., 5., 4., 1., 0., 3., 5., 10., 10.,
 94s                           11., 11., 13., 14., 14., 15., 23., 23., 24.,
 94s                           24., 24., 26., 27., 28., 30., 25., 24., 26.,
 94s                           28., 33., 29., 32., 26., 26.]) * units.knot
 94s         direction = np.array([0., 170., 200., 205., 204., 200., 197., 195., 180.,
 94s                               175., 175., 178., 181., 185., 160., 160., 165., 165.,
 94s                               203., 255., 268., 333., 0., 25., 40., 83., 85.,
 94s                               89., 90., 100., 103., 107., 110., 90., 88., 87.,
 94s                               86., 85., 85., 85., 60., 55., 60., 50., 46.,
 94s                               40., 45., 35., 50., 50., 50.]) * units.degree
 94s     
 94s >       sweat = sweat_index(pressure, temperature, dewpoint, speed, direction)
 94s 
 94s tests/calc/test_thermo.py:2793: 
 94s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 94s /usr/lib/python3/dist-packages/metpy/xarray.py:1546: in wrapper
 94s     return func(*bound_args.args, **bound_args.kwargs)
 94s /usr/lib/python3/dist-packages/metpy/xarray.py:1330: in wrapper
 94s     result = func(*bound_args.args, **bound_args.kwargs)
 94s /usr/lib/python3/dist-packages/metpy/units.py:333: in wrapper
 94s     return func(*args, **kwargs)
 94s /usr/lib/python3/dist-packages/metpy/calc/thermo.py:5113: in sweat_index
 94s     second_term = 20 * np.clip(tt.m_as('degC') - 49, 0, None)
 94s /usr/lib/python3/dist-packages/pint/facets/plain/quantity.py:315: in m_as
 94s     return self.to(units).magnitude
 94s /usr/lib/python3/dist-packages/pint/facets/plain/quantity.py:536: in to
 94s     magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
 94s /usr/lib/python3/dist-packages/pint/facets/plain/quantity.py:480: in _convert_magnitude_not_inplace
 94s     return self._REGISTRY.convert(self._magnitude, self._units, other)
 94s /usr/lib/python3/dist-packages/pint/facets/plain/registry.py:1041: in convert
 94s     return self._convert(value, src, dst, inplace)
 94s /usr/lib/python3/dist-packages/pint/facets/context/registry.py:405: in _convert
 94s     return super()._convert(value, src, dst, inplace)
 94s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 94s 
 94s self = <pint.registry.UnitRegistry object at 0x7f38283920f0>, value = 45.1
 94s src = <UnitsContainer({'delta_degree_Celsius': 1})>
 94s dst = <UnitsContainer({'degree_Celsius': 1})>, inplace = False
 94s 
 94s     def _convert(
 94s         self, value: T, src: UnitsContainer, dst: UnitsContainer, inplace: bool = False
 94s     ) -> T:
 94s         """Convert value from some source to destination units.
 94s     
 94s         In addition to what is done by the PlainRegistry,
 94s         converts between non-multiplicative units.
 94s     
 94s         Parameters
 94s         ----------
 94s         value :
 94s             value
 94s         src : UnitsContainer
 94s             source units.
 94s         dst : UnitsContainer
 94s             destination units.
 94s         inplace :
 94s              (Default value = False)
 94s     
 94s         Returns
 94s         -------
 94s         type
 94s             converted value
 94s     
 94s         """
 94s     
 94s         # Conversion needs to consider if non-multiplicative (AKA offset
 94s         # units) are involved. Conversion is only possible if src and dst
 94s         # have at most one offset unit per dimension. Other rules are applied
 94s         # by validate and extract.
 94s         try:
 94s             src_offset_unit = self._validate_and_extract(src)
 94s         except ValueError as ex:
 94s             raise DimensionalityError(src, dst, extra_msg=f" - In source units, {ex}")
 94s     
 94s         try:
 94s             dst_offset_unit = self._validate_and_extract(dst)
 94s         except ValueError as ex:
 94s             raise DimensionalityError(
 94s                 src, dst, extra_msg=f" - In destination units, {ex}"
 94s             )
 94s     
 94s         # convert if no offset units are present
 94s         if not (src_offset_unit or dst_offset_unit):
 94s             return super()._convert(value, src, dst, inplace)
 94s     
 94s         src_dim = self._get_dimensionality(src)
 94s         dst_dim = self._get_dimensionality(dst)
 94s     
 94s         # If the source and destination dimensionality are different,
 94s         # then the conversion cannot be performed.
 94s         if src_dim != dst_dim:
 94s             raise DimensionalityError(src, dst, src_dim, dst_dim)
 94s     
 94s         # clean src from offset units by converting to reference
 94s         if src_offset_unit:
 94s             if any(u.startswith("delta_") for u in dst):
 94s                 raise DimensionalityError(src, dst)
 94s             value = self._units[src_offset_unit].converter.to_reference(value, inplace)
 94s             src = src.remove([src_offset_unit])
 94s             # Add reference unit for multiplicative section
 94s             src = self._add_ref_of_log_or_offset_unit(src_offset_unit, src)
 94s     
 94s         # clean dst units from offset units
 94s         if dst_offset_unit:
 94s             if any(u.startswith("delta_") for u in src):
 94s >               raise DimensionalityError(src, dst)
 94s E               pint.errors.DimensionalityError: Cannot convert from 'delta_degree_Celsius' to 'degree_Celsius'
 94s 
 94s /usr/lib/python3/dist-packages/pint/facets/nonmultiplicative/registry.py:281: DimensionalityError


Test log at
https://ci.debian.net/packages/m/metpy/unstable/amd64/50977876/



More information about the Pkg-grass-devel mailing list