Repository: corteva/rioxarray

Issue:
overview not read when specifying chunks or lock
#### Code Sample, a copy-pastable example if possible

```python
import rasterio
import rioxarray

# from https://openaerialmap.org/
cog_url = (
    "https://oin-hotosm.s3.amazonaws.com/"
    "5d7dad0becaf880008a9bc88/0/5d7dad0becaf880008a9bc89.tif"
)
```


```python
ds = rioxarray.open_rasterio(cog_url, lock=False, chunks=(4, "auto", -1))
ds.shape
```




    (3, 9984, 22016)




```python
dsLockChunksOverview = rioxarray.open_rasterio(cog_url, lock=False, chunks=(4, "auto", -1), overview_level=1)
dsLockChunksOverview.shape
```




    (3, 9984, 22016)




```python
dsChunksOverview = rioxarray.open_rasterio(cog_url, chunks=(4, "auto", -1), overview_level=1)
dsChunksOverview.shape
```




    (3, 9984, 22016)




```python
dsLockOverview = rioxarray.open_rasterio(cog_url, lock=False, overview_level=1)
dsLockOverview.shape
```




    (3, 9984, 22016)




```python
dsOverview = rioxarray.open_rasterio(cog_url, overview_level=1)
dsOverview.shape
```




    (3, 2496, 5504)




#### Problem description

Large COGs consequently have large overviews. It may be beneficial to read the overview in parallel without locks, as documented in [Reading COGs in Parallel](https://corteva.github.io/rioxarray/stable/examples/read-locks.html). Perhaps this behavior is documented, but I could not find it.

#### Expected Output

The correct shape of the overview `(3, 2496, 5504)` when specifying `overview_level` AND `chunks` or `lock`.

#### Environment Information

rioxarray (0.4.0) deps:
  rasterio: 1.2.3
    xarray: 0.18.2
      GDAL: 3.2.2

Other python deps:
     scipy: 1.6.3
    pyproj: 3.0.1

System:
    python: 3.7.3 (default, Jan 22 2021, 20:04:44)  [GCC 8.3.0]
executable: /usr/bin/python3
   machine: Linux-5.4.104+-x86_64-with-debian-10.9

#### Installation method
pypi

Comments:

Patch:
diff --git a/docs/history.rst b/docs/history.rst
index 85e3950..217dc86 100644
--- a/docs/history.rst
+++ b/docs/history.rst
@@ -3,7 +3,7 @@ History
 
 Latest
 ------
-
+- BUG: pass kwargs with lock=False (issue #344)
 
 0.4.0
 ------
diff --git a/rioxarray/_io.py b/rioxarray/_io.py
index 0924175..aeda3b7 100644
--- a/rioxarray/_io.py
+++ b/rioxarray/_io.py
@@ -53,7 +53,7 @@ class URIManager(FileManager):
         self._kwargs = {} if kwargs is None else dict(kwargs)
 
     def acquire(self, needs_lock=True):
-        return self._opener(*self._args, mode=self._mode, kwargs=self._kwargs)
+        return self._opener(*self._args, mode=self._mode, **self._kwargs)
 
     def acquire_context(self, needs_lock=True):
         yield self.acquire(needs_lock=needs_lock)


Test patch:
diff --git a/test/integration/test_integration__io.py b/test/integration/test_integration__io.py
index 7d8191a..d471375 100644
--- a/test/integration/test_integration__io.py
+++ b/test/integration/test_integration__io.py
@@ -872,11 +872,12 @@ def test_rasterio_vrt_with_src_crs():
                     assert rds.rio.crs == src_crs
 
 
-def test_open_cog():
+@pytest.mark.parametrize("lock", [True, False])
+def test_open_cog(lock):
     cog_file = os.path.join(TEST_INPUT_DATA_DIR, "cog.tif")
     rdsm = rioxarray.open_rasterio(cog_file)
     assert rdsm.shape == (1, 500, 500)
-    rdso = rioxarray.open_rasterio(cog_file, overview_level=0)
+    rdso = rioxarray.open_rasterio(cog_file, lock=lock, overview_level=0)
     assert rdso.shape == (1, 250, 250)