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/5377#issuecomment-848900625,https://api.github.com/repos/pydata/xarray/issues/5377,848900625,MDEyOklzc3VlQ29tbWVudDg0ODkwMDYyNQ==,14808389,2021-05-26T16:04:04Z,2021-05-26T16:04:04Z,MEMBER,note that `xarray.tutorial.open_rasterio` will probably need something similar.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,902031342 https://github.com/pydata/xarray/issues/5377#issuecomment-848882892,https://api.github.com/repos/pydata/xarray/issues/5377,848882892,MDEyOklzc3VlQ29tbWVudDg0ODg4Mjg5Mg==,1217238,2021-05-26T15:41:15Z,2021-05-26T15:41:15Z,MEMBER,"thanks for the report! for those who don't want to click ""download"", here's the short patch: ```patch --- xarray/tutorial.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/xarray/tutorial.py +++ b/xarray/tutorial.py @@ -139,7 +139,10 @@ def open_dataset( url = f""{base_url}/raw/{version}/{path.name}"" # retrieve the file - filepath = pooch.retrieve(url=url, known_hash=None, path=cache_dir) + fname = pathlib.Path(cache_dir, path).expanduser() + if not fname.exists(): + fname = None + filepath = pooch.retrieve(url=url, fname=fname, known_hash=None, path=cache_dir) ds = _open_dataset(filepath, engine=engine, **kws) if not cache: ds = ds.load() ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,902031342 https://github.com/pydata/xarray/issues/5377#issuecomment-848777509,https://api.github.com/repos/pydata/xarray/issues/5377,848777509,MDEyOklzc3VlQ29tbWVudDg0ODc3NzUwOQ==,14808389,2021-05-26T13:38:20Z,2021-05-26T13:38:20Z,MEMBER,"note that the ""unique"" part of the file is the md5sum of the url, so this is not something random: ```python url = ""https://github.com/mapbox/rasterio/raw/1.2.1/tests/data/RGB.byte.tif"" filepath = pooch.os_cache(""xarray_tutorial_data"") / ""-"".join([ hashlib.md5(url.encode()).hexdigest(), path.name, ]) ``` That said, this is because we use `pooch.retrieve` instead of `pooch.create(...).fetch` (which *would* save as the normal name, possibly in a separate directory if versioning was enabled), and we should probably add (date-based) versions to `xarray-data` so we can use the registry. Not sure, though. --- In the meantime you could use `fname` even if the file does not already exist (which is actually supposed to be a file name, not a path) to make the patch a bit simpler, or recreate the ""unique"" filename using the hashed url.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,902031342