Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pygmt/clib/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def dataarray_to_matrix(grid):
# grids, this would be North-South, East-West. GMT's region and inc are
# East-West, North-South.
for dim in grid.dims[::-1]:
coord = grid.coords[dim].values
coord = grid.coords[dim].to_numpy()
coord_incs = coord[1:] - coord[0:-1]
coord_inc = coord_incs[0]
if not np.allclose(coord_incs, coord_inc):
Expand Down Expand Up @@ -120,7 +120,7 @@ def dataarray_to_matrix(grid):
inc = [abs(i) for i in inc]
grid = grid.sortby(variables=list(grid.dims), ascending=True)

matrix = as_c_contiguous(grid[::-1].values)
matrix = as_c_contiguous(grid[::-1].to_numpy())
return matrix, region, inc


Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_blockmedian.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_blockmedian_input_table_matrix(dataframe):
Run blockmedian using table input that is not a pandas.DataFrame but still
a matrix.
"""
table = dataframe.values
table = dataframe.to_numpy()
output = blockmedian(data=table, spacing="5m", region=[245, 255, 20, 30])
assert isinstance(output, pd.DataFrame)
assert output.shape == (5849, 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_earth_vertical_gravity_gradient_01d():
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
npt.assert_allclose(data.min(), -137.125, atol=1 / 32)
npt.assert_allclose(data.max(), 104.59375, atol=1 / 32)
assert data[1, 1].isnull()
assert data[1, 1].isnull() # noqa: PD003 # ruff's bug


def test_earth_vertical_gravity_gradient_01d_with_region():
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_datasets_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_earth_relief_holes():
npt.assert_allclose(grid.max(), 1601)
npt.assert_allclose(grid.min(), -4929.5)
# Test for the NaN values in the remote file
assert grid[2, 21].isnull()
assert grid[2, 21].isnull() # noqa: PD003 # ruff's bug


def test_maunaloa_co2():
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_select_input_table_matrix(dataframe):

Also testing the reverse (I) alias.
"""
data = dataframe.values
data = dataframe.to_numpy()
output = select(data=data, region=[245.5, 254.5, 20.5, 29.5], reverse="r")
assert isinstance(output, pd.DataFrame)
assert output.shape == (9177, 3)
Expand Down
4 changes: 2 additions & 2 deletions pygmt/tests/test_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_surface_input_data_array(data, region, spacing, expected_grid):
"""
Run surface by passing in a numpy array into data.
"""
data = data.values # convert pandas.DataFrame to numpy.ndarray
data = data.to_numpy() # convert pandas.DataFrame to numpy.ndarray
output = surface(
data=data,
spacing=spacing,
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_surface_with_outgrid_param(data, region, spacing, expected_grid):
"""
Run surface with the -Goutputfile.nc parameter.
"""
data = data.values # convert pandas.DataFrame to numpy.ndarray
data = data.to_numpy() # convert pandas.DataFrame to numpy.ndarray
with GMTTempFile(suffix=".nc") as tmpfile:
output = surface(
data=data,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ select = [
"F", # pyflakes
"I", # isort
"NPY", # numpy
"PD", # pandas-vet
"PL", # pylint
"UP", # pyupgrade
"W", # pycodestyle warnings
]
ignore = [
"E501", # Avoid enforcing line-length violations
"PD901", # Allow using the generic variable name `df` for DataFrames
"PLR2004", # Allow any magic values
]

Expand Down