Repository: Unidata/MetPy

Issue:
heat_index does not return same units as temperature
### What went wrong?

The `heat_index` calculation does not return the same units as the temperature initially provided. I believe this can be fixed by adding `.to(temperature.units)` right before the return similar to the `windchill` and `apparent_temperature` calculations.

### Operating System

Linux

### Version

1.5.1

### Python Version

3.9

### Code to Reproduce

```python
from metpy.calc import heat_index
from metpy.units import units

temp = 30 * units('degC')
rh = 0.67 * units('dimensionless')
hi = heat_index(temp, rh)

assert temp.units == hi.units
```


### Errors, Traceback, and Logs

_No response_

Discussion:
CLAassistant: [![CLA assistant check](https://cla-assistant.io/pull/badge/not_signed)](https://cla-assistant.io/Unidata/MetPy?pullRequest=3307) <br/>Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our [Contributor License Agreement](https://cla-assistant.io/Unidata/MetPy?pullRequest=3307) before we can accept your contribution.<br/><hr/>**renee.walton** seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please [add the email address used for this commit to your account](https://help.github.com/articles/why-are-my-commits-linked-to-the-wrong-user/#commits-are-not-linked-to-any-user).<br/><sub>You have signed the CLA already but the status is still pending? Let us [recheck](https://cla-assistant.io/check/Unidata/MetPy?pullRequest=3307) it.</sub>

Patch:
diff --git a/ci/linting_requirements.txt b/ci/linting_requirements.txt
index b698df8f81..d6739d64c7 100644
--- a/ci/linting_requirements.txt
+++ b/ci/linting_requirements.txt
@@ -7,7 +7,7 @@ pyflakes==3.1.0
 flake8-continuation==1.0.5
 flake8-copyright==0.2.4
 flake8-isort==6.1.1
-isort==5.12.0
+isort==5.13.0
 flake8-requirements==2.0.1
 
 flake8-rst-docstrings==0.3.0
diff --git a/ci/requirements.txt b/ci/requirements.txt
index 7cf7fbc20e..ba94e222bc 100644
--- a/ci/requirements.txt
+++ b/ci/requirements.txt
@@ -2,8 +2,8 @@ matplotlib==3.8.2
 numpy==1.26.2
 pandas==2.1.3
 pooch==1.8.0
-pint==0.22
+pint==0.23
 pyproj==3.6.1
 scipy==1.11.4
 traitlets==5.14.0
-xarray==2023.11.0
+xarray==2023.12.0
diff --git a/src/metpy/calc/basic.py b/src/metpy/calc/basic.py
index 56b60315f1..ae77c82510 100644
--- a/src/metpy/calc/basic.py
+++ b/src/metpy/calc/basic.py
@@ -251,7 +251,7 @@ def heat_index(temperature, relative_humidity, mask_undefined=True):
     >>> from metpy.calc import heat_index
     >>> from metpy.units import units
     >>> heat_index(30 * units.degC, 90 * units.percent)
-    <Quantity([105.3943646], 'degree_Fahrenheit')>
+    <Quantity([40.774647], 'degree_Celsius')>
     >>> heat_index(90 * units.degF, 90 * units.percent)
     <Quantity([121.901204], 'degree_Fahrenheit')>
     >>> heat_index(60 * units.degF, 90 * units.percent)
@@ -338,7 +338,7 @@ def heat_index(temperature, relative_humidity, mask_undefined=True):
         if mask.any():
             hi = masked_array(hi, mask=mask)
 
-    return hi
+    return hi.to(temperature.units)
 
 
 @exporter.export


Test patch:
diff --git a/tests/calc/test_basic.py b/tests/calc/test_basic.py
index ea7a93ad03..abc1f6ba9e 100644
--- a/tests/calc/test_basic.py
+++ b/tests/calc/test_basic.py
@@ -246,11 +246,12 @@ def test_heat_index_undefined_flag():
 
 
 def test_heat_index_units():
-    """Test units coming out of heat index."""
+    """Test units coming out of heat index are unchanged."""
     temp = units.Quantity([35., 20.], units.degC)
     rh = 70 * units.percent
     hi = heat_index(temp, rh)
-    assert_almost_equal(hi.to('degC'), units.Quantity([50.3405, np.nan], units.degC), 4)
+    assert hi.units == temp.units
+    assert_almost_equal(hi, units.Quantity([50.3405, np.nan], units.degC), 4)
 
 
 def test_heat_index_ratio():
@@ -258,7 +259,7 @@ def test_heat_index_ratio():
     temp = units.Quantity([35., 20.], units.degC)
     rh = 0.7
     hi = heat_index(temp, rh)
-    assert_almost_equal(hi.to('degC'), units.Quantity([50.3405, np.nan], units.degC), 4)
+    assert_almost_equal(hi, units.Quantity([50.3405, np.nan], units.degC), 4)
 
 
 def test_heat_index_vs_nws():
@@ -278,7 +279,7 @@ def test_heat_index_kelvin():
     rh = 0.7
     hi = heat_index(temp, rh)
     # NB rounded up test value here vs the above two tests
-    assert_almost_equal(hi.to('degC'), 50.3406 * units.degC, 4)
+    assert_almost_equal(hi, 50.3406 * units.degC, 4)
 
 
 def test_height_to_geopotential(array_type):