Skip to content

Commit

Permalink
Make download data a Python script instead of Bash (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored May 1, 2024
1 parent d04282d commit f6f4698
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: download data
run: |
conda activate test-environment
bash scripts/download_data.sh
python download_data.py
- name: generate rst
run: |
conda activate test-environment
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
if: needs.setup.outputs.code_change == 'true'
run: |
conda activate test-environment
bash scripts/download_data.sh
python scripts/download_data.py
- name: git describe
if: needs.setup.outputs.code_change == 'true'
run: |
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:
- name: download data
run: |
# conda activate test-environment
bash scripts/download_data.sh
python scripts/download_data.py
- name: doit test_unit
run: |
# conda activate test-environment
Expand Down
33 changes: 33 additions & 0 deletions scripts/download_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from contextlib import suppress
from pathlib import Path

import bokeh.sampledata

BASE_PATH = Path(__file__).resolve().parents[1]

bokeh.sampledata.download()

with suppress(ImportError):
import pyct.cmd

pyct.cmd.fetch_data(
name="data",
path=str(BASE_PATH / "examples"),
datasets="datasets.yml",
)


with suppress(ImportError):
import geodatasets as gds

gds.get_path("geoda airbnb")
gds.get_path("nybb")


with suppress(ImportError):
import pooch # noqa: F401
import scipy # noqa: F401
import xarray as xr

xr.tutorial.open_dataset("air_temperature")
xr.tutorial.open_dataset("rasm")
30 changes: 0 additions & 30 deletions scripts/download_data.sh

This file was deleted.

0 comments on commit f6f4698

Please sign in to comment.