Allow greater flexibility in crop bounds order
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start at the NDCube crop method and inspect how SkyCoord and SpectralCoord bounds are matched to WCS axes. Reproduce the two ordering examples from the issue, including a spectral axis in the middle if supported by the WCS, and verify that valid bounds no longer fail solely because their coordinate types are ordered differently.
Written by the indexing model from the issue text.
Description
Describe the feature
I recently noticed while doing some work in specutils (see https://github.com/astropy/specutils/pull/1033/files#r1134253955) that when providing both a sky coordinate and spectral coordinate as bounds to the NDCube crop method, the physical types need to be in the same order as they appear in the WCS. For example, if the spectral axis is last in the WCS, you can do this:
>>> lower = [SkyCoord(ra=205, dec=26, unit=u.deg), SpectralCoord(4.9, unit=u.um)]
>>> upper = [SkyCoord(ra=205.5, dec=27.5, unit=u.deg), SpectralCoord(4.9, unit=u.um)]
but not this:
>>> lower = [SpectralCoord(4.9, unit=u.um), SkyCoord(ra=205, dec=26, unit=u.deg)]
>>> upper = [SpectralCoord(4.9, unit=u.um), SkyCoord(ra=205.5, dec=27.5, unit=u.deg)]
It seems like it shouldn't matter in what order the SpectralCoord and SkyCoord are provided, since in the WCS it's unambiguous which axes these apply to. I'm also not sure what would happen if you had the spectral axis in the middle of the WCS, (e.g., [RA, Wavelength, Dec]), which seems silly but isn't impossible. I propose adding some logic to make this a little more flexible and avoid the error trace that occurs currently if the bounds are provided out of order (I don't have the trace on hand right now, unfortunately, I can add it here later).
Proposed solution
No response
- Dominant language
- Python
- Stars
- 49
- Forks
- 56
- Avg merge
- 5h 54m
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sunpy/ndcube
-
Bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Feature Request
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Feature Request
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100