Repository navigation
Conversation
|
Would you like to add this update to rioxarray as well? If not, mind if I port it over? |
| dtype=vrt.working_dtype, | ||
| warp_extras=vrt.warp_extras, | ||
| ) | ||
| elif isinstance(filename_or_obj, io.IOBase): |
There was a problem hiding this comment.
I'm not sure how good a test for a file-like this is - maybe this could be just else
There was a problem hiding this comment.
Yes, I wanted to ask you about this. Suggestions welcome here.
| def _file_object_opener(fobj, *args, **kwargs): | ||
| from rasterio.io import MemoryFile | ||
|
|
||
| return MemoryFile(fobj).open(*args, **kwargs) |
There was a problem hiding this comment.
This loads the whole thing? Odd to have to do this...
There was a problem hiding this comment.
As far as I can tell, this does not load the whole thing.
There was a problem hiding this comment.
Anything with a read() method? What things does rasterio actually call?
There was a problem hiding this comment.
Looked into this a bit more.
Here you'll see:
if hasattr(file_or_bytes, 'read'):
initial_bytes = file_or_bytes.read()
...
self._vsif = VSIFileFromMemBuffer(
self._path, buffer, len(self._initial_bytes), 0)
self.mode = "r"I had missed this initial read() call previously. This makes me think what I'm trying may not be possible.
There was a problem hiding this comment.
se here, can we just add MemoryFile to the superclasses of fobj, so rasterio is tricked into thinking it's dealing with a memoryfile, but the implementation is actually the original code for the object? Or maybe subclass MemoryFile here with methods that defer to the fobj.
|
@snowman2 - let's get this sorted out first. I'm not 100% sure this is the best path forward yet. But you are welcome to port to rioxarray. |
|
closed via rasterio/rasterio#2141 |
|
I'd like to use this cool new rasterio/fspec functionality in xarray! I must be doing something wrong here in cell [5]: |
|
Sounds like that may need changes in rioxarray. Mind opening up an issue: https://github.com/corteva/rioxarray/issues ? |
|
Thanks @snowman2 ! Done in vylor/rioxarray#440 |
isort -rc . && black . && mypy . && flake8whats-new.rstfor all changes andapi.rstfor new APIcc @scottyhq and @martindurant
xref: pangeo-data/pangeo-datastore#109