Skip to content

Error when trying to merge & write files from url #842

@odhondt

Description

@odhondt

Code Sample, a copy-pastable example if possible

import rioxarray as riox
from rioxarray.merge import merge_arrays
from pystac_client import Client
import planetary_computer
import shapely

shp = shapely.from_wkt("POLYGON ((3.0578210197234057 42.4455659286713, 3.0578210197234057 42.413109506256774, 3.1010384708737035 42.413109506256774, 3.1010384708737035 42.4455659286713, 3.0578210197234057 42.4455659286713))")

catalog = Client.open(
    "https://planetarycomputer.microsoft.com/api/stac/v1",
    modifier=planetary_computer.sign_inplace,
)

search = catalog.search(collections=["cop-dem-glo-30" ], intersects=shp)
items = search.item_collection()

to_merge = []
for item in items:
    url = item.assets["data"].href
    da = riox.open_rasterio(url)
    to_merge.append(da)

dem = merge_arrays(to_merge)
dem.rio.to_raster("/tmp/out.tif")

Problem description

This code was working fine with 0.17.0 and leads to an error in 0.18.2 (RasterioIOError: No such file or directory)

Expected Output

No error and the files are merged and written to disk.

Environment Information

  • python -c "import rioxarray; rioxarray.show_versions()"
rioxarray (0.18.2) deps:
  rasterio: 1.4.3
    xarray: 2025.1.1
      GDAL: 3.10.1
      GEOS: 3.13.0
      PROJ: 9.5.1
 PROJ DATA: /root/micromamba/envs/eo_tools/share/proj
 GDAL DATA: /root/micromamba/envs/eo_tools/share/gdal

Other python deps:
     scipy: 1.15.1
    pyproj: 3.7.0

System:
    python: 3.12.8 | packaged by conda-forge | (main, Dec  5 2024, 14:24:40) [GCC 13.3.0]
executable: /root/micromamba/envs/eo_tools/bin/python
   machine: Linux-5.4.0-196-generic-x86_64-with-glibc2.36

Installation method

conda (micromamba)

Conda environment information (if you installed with conda):


Environment (conda list):
Details
$ conda list | grep -E "rasterio|xarray|gdal"

  gdal                              3.10.1          py312hc55c449_2          conda-forge
  libgdal-core                      3.10.1          h3359108_2               conda-forge
  libgdal-jp2openjpeg               3.10.1          ha1d2769_2               conda-forge
  rasterio                          1.4.3           py312h8cae83d_0          conda-forge
  rioxarray                         0.18.2          pyhd8ed1ab_0             conda-forge
  xarray                            2025.1.1        pyhd8ed1ab_0             conda-forge

Details about conda and system ( conda info ):
Details
$ conda info

       libmamba version : 2.0.5  
     micromamba version : 2.0.5  
           curl version : libcurl/8.11.1 OpenSSL/3.4.0 zlib/1.3.1  zstd/1.5.6 libssh2/1.11.1 nghttp2/1.64.0  
     libarchive version : libarchive 3.7.7 zlib/1.3.1 bz2lib/1.0.8  libzstd/1.5.6. 
       envs directories : /root/micromamba/envs  
          package cache : /root/micromamba/pkgs  
                          /root/.mamba/pkgs. 
            environment : eo_tools (active)  
           env location : /root/micromamba/envs/eo_tools  
      user config files : /root/.mambarc  
 populated config files :  
       virtual packages : __unix=0=0  
                          __linux=5.4.0=0  
                          __glibc=2.36=0  
                          __archspec=1=x86_64_v3  
               channels : https://conda.anaconda.org/conda-forge/linux-64  
                          https://conda.anaconda.org/conda-forge/noarch  
       base environment : /root/micromamba  
               platform : linux-64  

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