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-809493007,https://api.github.com/repos/pydata/xarray/issues/5070,809493007,MDEyOklzc3VlQ29tbWVudDgwOTQ5MzAwNw==,6042212,2021-03-29T15:52:28Z,2021-03-29T15:52:28Z,CONTRIBUTOR,"> Unsure whether checking hasattr is better than just trying to read the object and catching an error Agree, that's fine. An `AttributeError` in this calling function might look weird, though, so you could have both. > you could read it into BytesIO and pass the BytesIO instance This is in general a bad idea, since we are wanting to deal with large files, and we have random access capabilities. > Ideally xarray would work with fsspec It does, but this is an edge case of using fsspec for local files; these are normally passed as the filename.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,839823306 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 https://github.com/pydata/xarray/issues/5070#issuecomment-805900745,https://api.github.com/repos/pydata/xarray/issues/5070,805900745,MDEyOklzc3VlQ29tbWVudDgwNTkwMDc0NQ==,6042212,2021-03-24T15:07:16Z,2021-03-24T15:07:16Z,CONTRIBUTOR,xref https://github.com/pangeo-forge/pangeo-forge/pull/87,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,839823306