Giter VIP home page Giter VIP logo

Comments (4)

adehecq avatar adehecq commented on August 22, 2024

Note that rasterio.open works perfectly with the same data.

from geoutils.

atedstone avatar atedstone commented on August 22, 2024

If Raster created with load_data=False then this error is not raised. Problem is in load() method.

from geoutils.

atedstone avatar atedstone commented on August 22, 2024

Even more strangely:

In [26]: vrt_sw = gr.Raster('master_SW_1985_count.vrt')
ERROR 4: No such file or directory
---------------------------------------------------------------------------
CPLE_OpenFailedError                      Traceback (most recent call last)
rasterio/_io.pyx in rasterio._io.DatasetReaderBase._read()

rasterio/shim_rasterioex.pxi in rasterio._shim.io_multi_band()

rasterio/_err.pyx in rasterio._err.exc_wrap_int()

CPLE_OpenFailedError: No such file or directory

During handling of the above exception, another exception occurred:

RasterioIOError                           Traceback (most recent call last)
<ipython-input-26-88f7c053cdb3> in <module>()
----> 1 vrt_sw = gr.Raster('master_SW_1985_count.vrt')

/home/tedstona/scripts/GeoUtils/geoutils/georaster.py in __init__(self, filename, attrs, load_data, bands)
     87
     88         if load_data:
---> 89             self.load(bands)
     90             self.isLoaded = True
     91             self.matches_disk = True

/home/tedstona/scripts/GeoUtils/geoutils/georaster.py in load(self, bands)
    267         """
    268         if bands is None:
--> 269             self.data = self.ds.read()
    270         else:
    271             self.data = self.ds.read(bands)

rasterio/_io.pyx in rasterio._io.DatasetReaderBase.read()

rasterio/_io.pyx in rasterio._io.DatasetReaderBase._read()

RasterioIOError: Read or write failed. No such file or directory

But then, calling read() manually on the same Raster:

In [27]: vrt_sw.ds.read()
Out[27]:
array([[[-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.],
        ...,
        [-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.]]], dtype=float32)

And vrt_sw.load() also then works:

In [29]: vrt_sw.data
Out[29]:
array([[[-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.],
        ...,
        [-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.],
        [-1., -1., -1., ..., -1., -1., -1.]]], dtype=float32)

from geoutils.

atedstone avatar atedstone commented on August 22, 2024

Error is also reproducible as follows:

from rasterio.io import MemoryFile
import pprint
with open('/scratch/merge_sw/master_SW_skel.vrt', 'rb') as f, MemoryFile(f) as memfile:
    with memfile.open() as src:
        pprint.pprint(src.profile)
        src.read()
---------------------------------------------------------------------------
CPLE_OpenFailedError                      Traceback (most recent call last)
rasterio/_io.pyx in rasterio._io.DatasetReaderBase._read()

rasterio/shim_rasterioex.pxi in rasterio._shim.io_multi_band()

rasterio/_err.pyx in rasterio._err.exc_wrap_int()

CPLE_OpenFailedError: No such file or directory

During handling of the above exception, another exception occurred:

RasterioIOError                           Traceback (most recent call last)
<ipython-input-24-0a4694dcf8ca> in <module>
      3     with memfile.open() as src:
      4         pprint.pprint(src.profile)
----> 5         src.read()

rasterio/_io.pyx in rasterio._io.DatasetReaderBase.read()

rasterio/_io.pyx in rasterio._io.DatasetReaderBase._read()

RasterioIOError: Read or write failed. No such file or directory

from geoutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.