Skip to content

Commit 7ef91a7

Browse files
authored
Merge branch 'main' into prepare-v1.18
2 parents 1039123 + b61e414 commit 7ef91a7

9 files changed

Lines changed: 122 additions & 5 deletions

File tree

.github/workflows/codspeed-walltime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Install requirements
5555
run: python -m pip install .[tests] pytest-codspeed
5656
- name: Run benchmarks
57-
uses: CodspeedHQ/action@281164b0f014a4e7badd2c02cecad9b595b70537 # v4.11.1
57+
uses: CodspeedHQ/action@9d332c4d90b43981c3e55ae8e38e68709996240f # v4.17.0
5858
with:
5959
mode: "walltime"
6060
token: ${{ secrets.CODSPEED_TOKEN }} # zizmor: ignore[secrets-outside-env] We want this to run everywhere so it always needs the token

.github/workflows/codspeed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
python-version: '3.14'
3131
- run: python -m pip install .[tests] pytest-codspeed
3232
- name: Run benchmarks
33-
uses: CodspeedHQ/action@281164b0f014a4e7badd2c02cecad9b595b70537 # v4.11.1
33+
uses: CodspeedHQ/action@9d332c4d90b43981c3e55ae8e38e68709996240f # v4.17.0
3434
with:
3535
mode: "simulation"
3636
token: ${{ secrets.CODSPEED_TOKEN }} # zizmor: ignore[secrets-outside-env] We want this to run everywhere so it always needs the token

changelog/723.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add an example notebook for retrieving DKIST dataset metadata and inspecting quality and processing metadata.

changelog/730.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix some minor breakages to allow release

dkist/data/tests/test_sample.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import os
22
import platform
33
from unittest.mock import call
4+
from urllib.request import urlopen
45

56
import pytest
67

8+
from dkist.data._sample import _BASE_URL
79
from dkist.utils.exceptions import DKISTDeprecationWarning
810

911

@@ -50,5 +52,14 @@ def test_fail(tmp_sample_dir):
5052
"""
5153
No remote data means this test should fail.
5254
"""
55+
# Sometimes this test runs and it can still access the internet
56+
# even though internet_off should prevent this. We skip the test
57+
# if we can access the internet.
58+
try:
59+
urlopen(_BASE_URL)
60+
pytest.skip("Internet not disabled")
61+
except Exception: # noqa BLE001
62+
pass
63+
5364
with pytest.raises(RuntimeError, match="1 sample data files failed"):
5465
from dkist.data.sample import VISP_L1_KMUPT # noqa: F401 PLC0415

dkist/io/asdf/resources/schemas/dataset-1.3.0.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,21 @@ properties:
5252

5353
parameters:
5454
description: A copy of the parameters used to generate this dataset.
55-
type: object
55+
anyOf:
56+
- type: object
57+
- type: array
5658

5759
observation_input_frames:
5860
description: A copy of the observation input frames used to generate this dataset.
59-
type: object
61+
anyOf:
62+
- type: object
63+
- type: array
6064

6165
calibration_input_frames:
6266
description: A copy of the calibration input frames used to generate this dataset.
63-
type: object
67+
anyOf:
68+
- type: object
69+
- type: array
6470

6571
recipe_run_config:
6672
description: A copy of the recipe configurations used to generate this dataset.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
jupytext:
3+
formats: md:myst
4+
text_representation:
5+
extension: .md
6+
format_name: myst
7+
format_version: 0.13
8+
jupytext_version: 1.17.2
9+
kernelspec:
10+
display_name: Python 3 (ipykernel)
11+
language: python
12+
name: python3
13+
---
14+
15+
(dkist:examples:dataset-retrieval-and-metadata)=
16+
# Retrieving a Dataset and Inspecting Metadata
17+
18+
In this example we will search for a DKIST dataset by dataset ID, download its metadata ASDF file, and inspect some of the metadata stored in it.
19+
20+
```{code-cell} ipython3
21+
from sunpy.net import Fido, attrs as a
22+
23+
import dkist
24+
import dkist.net
25+
```
26+
27+
Here we use the VISP dataset [ALQRZ](https://dkist.data.nso.edu/datasetview/ALQRZ).
28+
To inspect a different dataset, edit only `DATASET_ID`.
29+
30+
```{code-cell} ipython3
31+
DATASET_ID = "ALQRZ"
32+
```
33+
34+
First we search for the dataset.
35+
The `Status("any")` attribute means the search will return this dataset ID irrespective of its processing status.
36+
37+
```{code-cell} ipython3
38+
search_results = Fido.search(a.dkist.Dataset(DATASET_ID), a.dkist.Status("any"))
39+
search_results
40+
```
41+
42+
The search result points to the metadata ASDF file.
43+
We can fetch that file directly with `Fido.fetch`.
44+
45+
```{code-cell} ipython3
46+
asdf_file = Fido.fetch(search_results)
47+
asdf_file
48+
```
49+
50+
Now we can load the ASDF file as a `dkist.Dataset`.
51+
This describes the dataset and its file references without downloading all of the FITS files.
52+
53+
```{code-cell} ipython3
54+
dataset = dkist.load_dataset(asdf_file)
55+
dataset
56+
```
57+
58+
The dataset inventory contains searchable metadata from the DKIST Data Center.
59+
Here we display the entries related to data quality.
60+
61+
```{code-cell} ipython3
62+
{
63+
key: value
64+
for key, value in dataset.meta["inventory"].items()
65+
if key.lower().startswith("quality")
66+
}
67+
```
68+
69+
Each calibrated dataset also has a quality report.
70+
This method downloads the report PDF and returns a `parfive.Results` object with the local filename.
71+
72+
```{code-cell} ipython3
73+
quality_report = dataset.files.quality_report()
74+
quality_report
75+
```
76+
77+
The ASDF file can also contain more detailed metadata about how the dataset was generated.
78+
The following fields describe the input parameters, the observe and calibration frames, and the recipe configuration.
79+
80+
```{code-cell} ipython3
81+
dataset.meta["parameters"]
82+
```
83+
84+
```{code-cell} ipython3
85+
dataset.meta["observation_input_frames"]
86+
```
87+
88+
```{code-cell} ipython3
89+
dataset.meta["calibration_input_frames"]
90+
```
91+
92+
```{code-cell} ipython3
93+
dataset.meta["recipe_run_config"]
94+
```

docs/examples/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Each example is a self-contained tutorial working through one task.
88
99
reproject_vbi_mosaic
1010
vbi_extents
11+
dataset_retrieval_and_metadata
1112
example_cryo_plots
1213
rebinning_and_dask
1314
```

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ filterwarnings =
6565
# See https://github.com/numpy/numpy/issues/15748#issuecomment-598584838
6666
ignore:numpy.ufunc size changed:RuntimeWarning
6767
ignore:numpy.ndarray size changed:RuntimeWarning
68+
# Warnings introduced in astropy modelling by NumPy 2.5, these can be removed when astropy fix it
69+
ignore:.*Setting the shape on a NumPy array has been deprecated in NumPy 2.5:DeprecationWarning
70+
ignore:.*Setting the dtype on a NumPy array has been deprecated in NumPy 2.5:DeprecationWarning
6871
# This isn't really an issue it's an annoyance, it's triggered by printing
6972
# an astropy table inside a test, which is generally only done when
7073
# debugging.

0 commit comments

Comments
 (0)