Skip to content

Commit

Permalink
TEST: Fixup c5de131
Browse files Browse the repository at this point in the history
  • Loading branch information
ntfrgl committed Feb 6, 2024
1 parent c5de131 commit 2368442
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,23 @@ def reanalysis_data() -> Path:
- `tests/test_climate/test_map_plot.py`
- `examples/tutorials/ClimateNetworks.ipynb`
"""
name = "air.mon.mean.nc"
path = Path("./examples/tutorials/data") / name
if not path.exists():
service = "https://psl.noaa.gov/repository/entry/get"
query = (
"entryid=synth%3Ae570c8f9-ec09-4e89-93b4-"
"babd5651e7a9%3AL25jZXAucmVhbmFseXNpcy5kZXJpdm"
"VkL3N1cmZhY2UvYWlyLm1vbi5tZWFuLm5j")
url = f"{service}/{name}?{query}"
service = "https://psl.noaa.gov/repository/entry/get"
data_name = "air.mon.mean.nc"
query = (
"entryid=synth%3Ae570c8f9-ec09-4e89-93b4-"
"babd5651e7a9%3AL25jZXAucmVhbmFseXNpcy5kZXJpdm"
"VkL3N1cmZhY2UvYWlyLm1vbi5tZWFuLm5j")
url = f"{service}/{data_name}?{query}"

data_dir = Path("./examples/tutorials/data")
data_file = data_dir / data_name

if not data_dir.is_dir():
data_dir.mkdir(parents=True)
if not data_file.exists():
res = requests.get(url, timeout=(20, 20))
res.raise_for_status()
with open(path, 'wb') as f:
with open(data_file, 'wb') as f:
f.write(res.content)
return path

return data_file

0 comments on commit 2368442

Please sign in to comment.