pydata / pydata/xarray

xr.tutorial.open_dataset should work even with locally preloaded cache.

Open
#5,377 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

What happened:
When packaging for a Linux distribution (openSUSE in my case) there is no network access to the build machines for obvious reasons. Therefore we are very happy to preloaded cache and xr.tutorial.open_dataset() function. Unfortunately, with 0.18.2 (not sure about the previous versions) it doesn’t work, because pooch.retrieve() without fname parameter (even when known_hash is None) generates unique name for the data file, which is not available, therefore it fails.

With the data directory expanded to ~/.cache/xarray_tutorial_data call of xr.tutorial.open_dataset('air_temperature') should return the appropriate data even without the network access.

This patch fixes that. When the datafile could be found in the local cache, pooch.retrieve is called with fname parameter.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the implementation of xr.tutorial.open_dataset and inspect how it calls pooch.retrieve when the requested dataset is already under ~/.cache/xarray_tutorial_data. Compare the linked local_dataset.patch behavior and verify that open_dataset('air_temperature') returns the cached data without network access.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.