Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix WarpedVRT param cache in open_rasterio #516

Merged
merged 1 commit into from
Apr 22, 2022
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
2 changes: 1 addition & 1 deletion docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ History

Latest
------

- BUG: Fix WarpedVRT param cache in :func:`rioxarray.open_rasterio` (issue #515)

0.11.0
------
Expand Down
10 changes: 5 additions & 5 deletions rioxarray/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,15 +811,15 @@ def open_rasterio(
filename = vrt.src_dataset.name
vrt_params = dict(
src_crs=vrt.src_crs.to_string() if vrt.src_crs else None,
crs=vrt.crs.to_string() if vrt.crs else None,
crs=vrt.dst_crs.to_string() if vrt.dst_crs else None,
resampling=vrt.resampling,
tolerance=vrt.tolerance,
src_nodata=vrt.src_nodata,
nodata=vrt.nodata,
width=vrt.width,
height=vrt.height,
nodata=vrt.dst_nodata,
width=vrt.dst_width,
height=vrt.dst_height,
src_transform=vrt.src_transform,
transform=vrt.transform,
transform=vrt.dst_transform,
dtype=vrt.working_dtype,
warp_extras=vrt.warp_extras,
)
Expand Down
24 changes: 18 additions & 6 deletions test/integration/test_integration__io.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
_create_gdal_gcps,
)

cint_skip = pytest.mark.skipif(
rasterio.__version__ < "1.2.4",
reason="https://github.com/mapbox/rasterio/issues/2182",
)


@pytest.mark.parametrize(
"subdataset, variable, group, match",
Expand Down Expand Up @@ -932,6 +937,19 @@ def test_rasterio_vrt_gcps(tmp_path):
)


@cint_skip
def test_rasterio_vrt_gcps__data_exists():
# https://github.com/corteva/rioxarray/issues/515
vrt_file = os.path.join(TEST_INPUT_DATA_DIR, "cint16.tif")
with rasterio.open(vrt_file) as src:
crs = src.gcps[1]
# NOTE: Eventually src_crs will not need to be provided
# https://github.com/mapbox/rasterio/pull/2193
with rasterio.vrt.WarpedVRT(src, src_crs=crs) as vrt:
rds = rioxarray.open_rasterio(vrt)
assert rds.values.any()


@pytest.mark.parametrize("lock", [True, False])
def test_open_cog(lock):
cog_file = os.path.join(TEST_INPUT_DATA_DIR, "cog.tif")
Expand Down Expand Up @@ -1150,12 +1168,6 @@ def test_rotation_affine():
assert rioda.rio.resolution() == (10, 10)


cint_skip = pytest.mark.skipif(
rasterio.__version__ < "1.2.4",
reason="https://github.com/mapbox/rasterio/issues/2182",
)


@cint_skip
@pytest.mark.parametrize("dtype", [None, "complex_int16"])
def test_cint16_dtype(dtype, tmp_path):
Expand Down