Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes related to sample data updates #523

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
with:
python-version: '3.13'
test_extras: tests
test_command: pytest --pyargs dkist -k "not test_fail"
test_command: pytest --pyargs dkist -k "not test_fail" --remote-data=none
# We have to work around a github runner bug here: https://github.com/actions/runner/issues/2788#issuecomment-2145922705
upload_to_pypi: ${{ startsWith(github.ref || format('{0}{1}', 'refs/tags/', github.event.release.tag_name), 'refs/tags/v') && !endsWith(github.ref || format('{0}{1}', 'refs/tags/', github.event.release.tag_name), '.dev') }}
secrets:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Backwards Incompatible Changes
* asdf-astropy >= 0.5
* asdf-coordinate-schemas >= 0.3
* asdf-transform-schemas >= 0.5
* asdf-wcs-schemas >= 0.4
* asdf-wcs-schemas >= 0.4


Features
Expand Down
9 changes: 7 additions & 2 deletions dkist/data/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")


def download_all_sample_data():
def download_all_sample_data(overwrite=False):
"""
Download all sample data at once that has not already been downloaded.

Parameters
----------
overwrite : `bool`
Re-download and overwrite any existing files.
"""
return _get_sample_datasets(_SAMPLE_DATASETS.keys())
return _get_sample_datasets(_SAMPLE_DATASETS.keys(), force_download=not overwrite)

Check warning on line 32 in dkist/data/sample.py

View check run for this annotation

Codecov / codecov/patch

dkist/data/sample.py#L32

Added line #L32 was not covered by tests
2 changes: 1 addition & 1 deletion docs/examples/reproject_vbi_mosaic.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you want to replace this dataset with your own dataset, see {ref}`dkist:howto
Let's load the data with {obj}`dkist.load_dataset`:

```{code-cell} ipython3
ds = dkist.load_dataset(VBI_AJQWW / "VBI_L1_20231016T184519_AJQWW.asdf")
ds = dkist.load_dataset(VBI_AJQWW)
ds
```

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
# files with them unpinned so they are now required to read generated asdf
# files.
"asdf>=3.3.0", # Required by gwcs 0.24
"asdf-astropy>=0.5.0", # Required by gwcs 0.24
"asdf-astropy>=0.5.0,!=0.7.0", # Required by gwcs 0.24
SolarDrew marked this conversation as resolved.
Show resolved Hide resolved
"asdf-coordinates-schemas>=0.3.0", # required by wcs-schemas 0.4
"asdf-standard>=1.1.0",
"asdf-transform-schemas>=0.5.0", # required by wcs-schemas 0.4
Expand Down
6 changes: 4 additions & 2 deletions tools/update_sample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main(datasets, working_directory, destination_path="/user_tools_tutorial_dat

for did, props in datasets.items():
res = Fido.search(a.dkist.Dataset(did))
asdf_file = Fido.fetch(res, path=working_directory / "{dataset_id}", progress=False, overwrite=False)
asdf_file = Fido.fetch(res, path=working_directory / "{dataset_id}", progress=False, overwrite=True)

ds = dkist.load_dataset(asdf_file)
if "slice" in props:
Expand All @@ -64,10 +64,12 @@ def main(datasets, working_directory, destination_path="/user_tools_tutorial_dat
[f.unlink() for f in dataset_path.glob("*.mp4")]
[f.unlink() for f in dataset_path.glob("*.pdf")]
assert len(list(dataset_path.glob("*.asdf"))) == 1
dataset_files = tuple(dataset_path.glob("*"))

sample_filename = working_directory / props["filename"]
with tarfile.open(sample_filename, mode="w") as tfile:
tfile.add(dataset_path, recursive=True)
for dfile in dataset_files:
tfile.add(dfile, arcname=dfile.name, recursive=False)

sample_files_for_upload.append(sample_filename)

Expand Down
Loading