html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/5070#issuecomment-808605422,https://api.github.com/repos/pydata/xarray/issues/5070,808605422,MDEyOklzc3VlQ29tbWVudDgwODYwNTQyMg==,2067093,2021-03-27T00:39:26Z,2021-03-27T00:43:35Z,NONE,"Just ran into this. Unsure whether checking `hasattr` is better than just trying to read the object and catching an error - someone could implement a non-compliant `read` method, which would create other errors.
As a workaround, you could read it into BytesIO and pass the BytesIO instance:
```python
import fsspec
import xarray as xr
from io import BytesIO
of = fsspec.open(""example.nc"")
with of as f:
xr.load_dataset(BytesIO(f.read()))
```
Also, [here's the link](https://github.com/pydata/xarray/blob/master/xarray/core/utils.py#L655) to the code referenced above.
Ideally xarray would work with `fsspec` or `pyfilesystem2` out of the box (to parse access URLs, for example).
I've had to fall back to using BytesIO buffers too many times. 😛
Edit: You don't even need BytesIO, it works even with Bytes:
```python
import fsspec
import xarray as xr
of = fsspec.open(""example.nc"")
with of as f:
xr.load_dataset(f.read())
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,839823306