Skip to content

Commit

Permalink
TST: Update test for windows builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
zssherman committed Oct 8, 2024
1 parent d21f61f commit 6f925b8
Showing 1 changed file with 35 additions and 42 deletions.
77 changes: 35 additions & 42 deletions tests/io/test_output_to_geotiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,53 +155,46 @@ def test_write_grid_geotiff_missing_field():
@pytest.mark.skipif(
not pyart.io.output_to_geotiff.IMPORT_FLAG, reason="GDAL is not installed."
)
def test_write_grid_geotiff_transparent_background():
def test_write_grid_geotiff_transparent_background(outfile=None):
grid = make_tiny_grid_with_mask()

try:
with pyart.testing.InTemporaryDirectory() as tmpdir:
tmp = Path(tmpdir)
outname = tmp / "transparent_bg.tif"
pyart.io.write_grid_geotiff(
grid,
str(outname),
"reflectivity",
rgb=True,
cmap="pyart_HomeyerRainbow",
vmin=0,
vmax=40,
transparent_bg=True,
opacity=1,
)
imgname = outname.rename(tmp / "transparent_bg.tiff")
img = Image.open(imgname)
img.show()
except PermissionError:
pass
with pyart.testing.InTemporaryDirectory() as tmpdir:
tmp = Path(tmpdir)
outname = tmp / "transparent_bg.tif"
pyart.io.write_grid_geotiff(
grid,
str(outname),
"reflectivity",
rgb=True,
cmap="pyart_HomeyerRainbow",
vmin=0,
vmax=40,
transparent_bg=True,
opacity=1,
)
imgname = outname.rename(tmp / "transparent_bg.tiff")
img = Image.open(imgname)
img.show()


@pytest.mark.skipif(
not pyart.io.output_to_geotiff.IMPORT_FLAG, reason="GDAL is not installed."
)
def test_write_grid_geotiff_opacity():
grid = make_tiny_grid_with_mask()
try:
with pyart.testing.InTemporaryDirectory() as tmpdir:
tmp = Path(tmpdir)
outname = tmp / "opacity.tif"
pyart.io.write_grid_geotiff(
grid,
str(outname),
"reflectivity",
rgb=True,
cmap="pyart_HomeyerRainbow",
vmin=0,
vmax=40,
transparent_bg=False,
opacity=0.25,
)
imgname = outname.rename(tmp / "opacity.tiff")
img = Image.open(imgname)
img.show()
except PermissionError:
pass
with pyart.testing.InTemporaryDirectory() as tmpdir:
tmp = Path(tmpdir)
outname = tmp / "opacity.tif"
pyart.io.write_grid_geotiff(
grid,
str(outname),
"reflectivity",
rgb=True,
cmap="pyart_HomeyerRainbow",
vmin=0,
vmax=40,
transparent_bg=False,
opacity=0.25,
)
imgname = outname.rename(tmp / "opacity.tiff")
img = Image.open(imgname)
img.show()

0 comments on commit 6f925b8

Please sign in to comment.