Skip to content

Commit

Permalink
MNT: Replace uses of drop_vars with drop
Browse files Browse the repository at this point in the history
drop_vars is only available on xarray 0.14.0
  • Loading branch information
dopplershift committed Apr 16, 2020
1 parent b961271 commit 26dfa18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/calc/test_cross_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_distances_from_cross_section_given_xy(test_cross_xy):
def test_distances_from_cross_section_given_bad_coords(test_cross_xy):
"""Ensure an AttributeError is raised when the cross section lacks neeed coordinates."""
with pytest.raises(AttributeError):
distances_from_cross_section(test_cross_xy['u_wind'].drop_vars('x'))
distances_from_cross_section(test_cross_xy['u_wind'].drop('x'))


def test_latitude_from_cross_section_given_lat(test_cross_lonlat):
Expand Down
3 changes: 2 additions & 1 deletion tests/calc/test_kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,10 @@ def data_4d():
data = xr.open_dataset(get_test_data('irma_gfs_example.nc', False))
data = data.metpy.parse_cf()
data['Geopotential_height_isobaric'].attrs['units'] = 'm'
subset = data.drop_vars((
subset = data.drop((
'LatLon_361X720-0p25S-180p00E', 'Vertical_velocity_pressure_isobaric', 'isobaric1',
'Relative_humidity_isobaric', 'reftime'

)).sel(
latitude=[46., 44., 42., 40.],
longitude=[262., 267., 272., 277.],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_var_multidim_full(test_ds):
@pytest.fixture
def test_var_multidim_no_xy(test_var_multidim_full):
"""Provide a variable with multidimensional lat/lon coords but without x/y coords."""
return test_var_multidim_full.drop_vars(['y', 'x'])
return test_var_multidim_full.drop(['y', 'x'])


def test_projection(test_var):
Expand Down Expand Up @@ -474,7 +474,7 @@ def test_coordinates_identical_true(test_ds_generic):

def test_coordinates_identical_false_number_of_coords(test_ds_generic):
"""Test coordinates identical method when false due to number of coordinates."""
other_ds = test_ds_generic.drop_vars('e')
other_ds = test_ds_generic.drop('e')
assert not test_ds_generic['test'].metpy.coordinates_identical(other_ds['test'])


Expand Down

0 comments on commit 26dfa18

Please sign in to comment.