Skip to content

Bug when using bounds in merge_arrays #859

Description

@OnnoEbbens

I use the rioxarray.merge.merge_arrays function to merge 4 tiles into a single DataArray. When I use the bounds argument I get an incorrectly merged DataArray. Please sea code and figures below.

tiffs.zip

Code Sample

import rioxarray as rxr
from rioxarray.merge import merge_arrays
import matplotlib.pyplot as plt
bounds = [117607.88 , 498001.379, 123698.88 , 502618.78]
das = []
for i in range(4):
    das.append(rxr.open_rasterio(f'da{i}.tiff'))
out = merge_arrays(das)
plt.figure()
out.plot()
plt.title('merged array without bounds')

out_with_bounds = merge_arrays(das, bounds=bounds)
plt.figure()
out_with_bounds.plot()
plt.title('merged array using bounds')

Image

Image

Environment Information

rioxarray (0.19.0) deps:
rasterio: 1.4.3
xarray: 2025.3.1
GDAL: 3.9.3
GEOS: 3.13.0
PROJ: 9.5.0
PROJ DATA: c:\Users\oebbe\anaconda3\envs\nlmod2025\Lib\site-packages\rasterio\proj_data
GDAL DATA: C:\Anaconda3\Library\share\gdal

Other python deps:
scipy: 1.15.2
pyproj: 3.7.1

System:
python: 3.12.9 | packaged by Anaconda, Inc. | (main, Feb 6 2025, 18:49:16) [MSC v.1929 64 bit (AMD64)]
executable: c:\Users\oebbe\anaconda3\envs\nlmod2025\python.exe
machine: Windows-11-10.0.22631-SP0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions