Skip to content

Commit

Permalink
MNT: Replace use of "united" to mean "things with units"
Browse files Browse the repository at this point in the history
Instead use "quantity" as the general concept, and otherwise clarify
using the phrase "with units" or otherwise clarifying as needed.
  • Loading branch information
dopplershift committed Jun 1, 2022
1 parent 012e9d2 commit 8ef52c3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/metpy/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def check_and_drop_units(actual, desired):
actual = units.Quantity(actual, 'dimensionless')
actual = actual.to(desired.units)
# Otherwise, the desired result has no units. Convert the actual result to
# dimensionless units if it is a united quantity.
# dimensionless units if it is a quantity.
else:
if hasattr(actual, 'units'):
actual = actual.to('dimensionless')
Expand Down
8 changes: 4 additions & 4 deletions src/metpy/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@


def pandas_dataframe_to_unit_arrays(df, column_units=None):
"""Attach units to data in pandas dataframes and return united arrays.
"""Attach units to data in pandas dataframes and return quantities.
Parameters
----------
Expand All @@ -85,8 +85,8 @@ def pandas_dataframe_to_unit_arrays(df, column_units=None):
Returns
-------
Dictionary containing united arrays with keys corresponding to the dataframe
column names.
Dictionary containing `Quantity` instances arrays with keys corresponding to the
dataframe column names.
"""
if not column_units:
Expand All @@ -107,7 +107,7 @@ def pandas_dataframe_to_unit_arrays(df, column_units=None):


def concatenate(arrs, axis=0):
r"""Concatenate multiple values into a new unitized object.
r"""Concatenate multiple values into a new quantity.
This is essentially a scalar-/masked array-aware version of `numpy.concatenate`. All items
must be able to be converted to the same units. If an item has no units, it will be given
Expand Down
8 changes: 4 additions & 4 deletions tests/plots/test_skewt.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def test_hodograph_api():

@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.6 if MPL_VERSION == '3.3' else 0.)
def test_hodograph_units():
"""Test passing unit-ed quantities to Hodograph."""
"""Test passing quantities to Hodograph."""
fig = plt.figure(figsize=(9, 9))
ax = fig.add_subplot(1, 1, 1)
hodo = Hodograph(ax)
Expand Down Expand Up @@ -402,7 +402,7 @@ def test_skewt_barb_no_default_unit_conversion():
@pytest.mark.parametrize('u,v', [(np.array([3]) * units('m/s'), np.array([3])),
(np.array([3]), np.array([3]) * units('m/s'))])
def test_skewt_barb_unit_conversion_exception(u, v):
"""Test that errors are raise if unit conversion is requested on un-united data."""
"""Test that an error is raised if unit conversion is requested on plain arrays."""
p_wind = np.array([500]) * units.hPa

fig = plt.figure(figsize=(9, 9))
Expand Down Expand Up @@ -496,8 +496,8 @@ def test_hodograph_wind_vectors():
return fig


def test_united_hodograph_range():
"""Tests making a hodograph with a united ranged."""
def test_hodograph_range_with_units():
"""Tests making a hodograph with a range with units."""
fig = plt.figure(figsize=(6, 6))
ax = fig.add_subplot(1, 1, 1)
Hodograph(ax, component_range=60. * units.knots)
4 changes: 2 additions & 2 deletions tests/plots/test_station_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def test_barb_no_default_unit_conversion():
@pytest.mark.parametrize('u,v', [(np.array([3]) * units('m/s'), np.array([3])),
(np.array([3]), np.array([3]) * units('m/s'))])
def test_barb_unit_conversion_exception(u, v):
"""Test that errors are raise if unit conversion is requested on un-united data."""
"""Test that an error is raised if unit conversion is requested on plain arrays."""
x_pos = np.array([0])
y_pos = np.array([0])

Expand Down Expand Up @@ -451,7 +451,7 @@ def test_stationplot_unit_conversion():


def test_scalar_unit_conversion_exception():
"""Test that errors are raise if unit conversion is requested on un-united data."""
"""Test that an error is raised if unit conversion is requested on regular arrays."""
x_pos = np.array([0])
y_pos = np.array([0])

Expand Down
2 changes: 1 addition & 1 deletion tests/units/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_pandas_units_on_dataframe():


@pytest.mark.filterwarnings("ignore:Pandas doesn't allow columns to be created")
def test_pandas_units_on_dataframe_not_all_united():
def test_pandas_units_on_dataframe_not_all_with_units():
"""Unit attachment with units attribute with a column with no units."""
df = pd.DataFrame(data=[[1, 4], [2, 5], [3, 6]], columns=['cola', 'colb'])
df.units = {'cola': 'kilometers'}
Expand Down

0 comments on commit 8ef52c3

Please sign in to comment.