Skip to content

open_rasterio fails when lock=True #273

@jessjaco

Description

@jessjaco

https://corteva.github.io/rioxarray/stable/rioxarray.html#rioxarray-open-rasterio says using open_rasterio with lock=True is valid, but doing so gives an error. This option is also described in https://corteva.github.io/rioxarray/stable/examples/read-locks.html.

import rioxarray

url = (
    "https://naipeuwest.blob.core.windows.net/naip/v002/md/2013/md_100cm_2013/"
    "39076/m_3907617_ne_18_1_20130924.tif"
)
ds = rioxarray.open_rasterio(url, lock=True, chunks=(4, "auto", -1))

Output:

   File "<stdin>", line 1, in <module>
  File "/venv/lib/python3.8/site-packages/rioxarray/_io.py", line 751, in open_rasterio
    riods = manager.acquire()
  File "/venv/lib/python3.8/site-packages/xarray/backends/file_manager.py", line 181, in acquire
    file, _ = self._acquire_with_cache_info(needs_lock)
  File "/venv/lib/python3.8/site-packages/xarray/backends/file_manager.py", line 197, in _acquire_with_cache_info
    with self._optional_lock(needs_lock):
  File "/opt/conda/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/venv/lib/python3.8/site-packages/xarray/backends/file_manager.py", line 161, in _optional_lock
    with self._lock:
AttributeError: __enter__

Using
ubuntu 20.04
rioxarray==0.3.1
xarray==0.17.0

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