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
14 changes: 8 additions & 6 deletions pygmt/tests/test_geopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,15 @@ def test_geopandas_plot_int_dtypes(gdf_ridge, dtype):
This is a regression test for
https://github.com/GenericMappingTools/pygmt/issues/2497
"""
gdf = gdf_ridge.copy()
# Convert NPOINTS column to integer type
gdf_ridge["NPOINTS"] = gdf_ridge.NPOINTS.astype(dtype=dtype)
gdf["NPOINTS"] = gdf.NPOINTS.astype(dtype=dtype)

# Plot figure with three polygons colored based on NPOINTS value
fig = Figure()
makecpt(cmap="lisbon", series=[10, 60, 10], continuous=True)
fig.plot(
data=gdf_ridge,
data=gdf,
frame=True,
pen="1p,black",
fill="+z",
Expand All @@ -215,21 +216,22 @@ def test_geopandas_plot_int64_as_float(gdf_ridge):
Check that big 64-bit integers are correctly mapped to float type in
geopandas.GeoDataFrame object.
"""
gdf = gdf_ridge.copy()
factor = 2**32
# Convert NPOINTS column to int64 type and make big integers
gdf_ridge["NPOINTS"] = gdf_ridge.NPOINTS.astype(dtype="int64")
gdf_ridge["NPOINTS"] *= factor
gdf["NPOINTS"] = gdf.NPOINTS.astype(dtype="int64")
gdf["NPOINTS"] *= factor

# Make sure the column is bigger than the largest 32-bit integer
assert gdf_ridge["NPOINTS"].abs().max() > 2**31 - 1
assert gdf["NPOINTS"].abs().max() > 2**31 - 1

# Plot figure with three polygons colored based on NPOINTS value
fig = Figure()
makecpt(
cmap="lisbon", series=[10 * factor, 60 * factor, 10 * factor], continuous=True
)
fig.plot(
data=gdf_ridge,
data=gdf,
frame=True,
pen="1p,black",
fill="+z",
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_grdimage_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_grdimage_image_dataarray_unsupported_dtype(dtype, xr_image):
Plot a 3-band RGB image using xarray.DataArray input, with an unsupported data type.
"""
fig = Figure()
image = xr_image.astype(dtype=dtype)
image = xr_image.copy().astype(dtype=dtype)
with pytest.warns(expected_warning=RuntimeWarning) as record:
fig.grdimage(grid=image)
assert len(record) == 1