[2.4.0] test_crop_by_extra_coords_values_all_axes_with_coord fails during build time
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by running test_crop_by_extra_coords_values_all_axes_with_coord in tests/test_ndcube_slice_and_crop.py with the listed dependency versions. Trace the call through ndcube.py, utils/cube.py, and wcs/wrappers/compound_wcs.py, focusing on the Quantity versus Time type mismatch. Done means the test passes during the package build without regressing related crop-by-values behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
When running pytest during package build, I see the following failure:
_____________ test_crop_by_extra_coords_values_all_axes_with_coord _____________
ndcube_3d_ln_lt_l_ec_all_axes = <ndcube.ndcube.NDCube object at 0x7fdac83fdb30>
NDCube
------
Shape: (2, 3, 4)
Physical Types of Axes: [('custom:pos.h...ive.lat', 'custom:pos.helioprojective.lon', 'custom:PIXEL'), ('em.wl', 'custom:SPATIAL')]
Unit: None
Data Type: float64
def test_crop_by_extra_coords_values_all_axes_with_coord(ndcube_3d_ln_lt_l_ec_all_axes):
cube = ndcube_3d_ln_lt_l_ec_all_axes
interval0 = [3 * 60 * 60, 8 * 60 * 60] * u.s
interval1 = [0, 1] * u.pix
interval2 = [1, 3] * u.m
lower_corner = (interval0[0], interval1[0], interval2[0])
upper_corner = (interval0[1], interval1[1], interval2[1])
> output = cube.crop_by_values(lower_corner, upper_corner, wcs=cube.extra_coords)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../ndcube/tests/test_ndcube_slice_and_crop.py:483:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../ndcube/ndcube.py:658: in crop_by_values
item = self._get_crop_by_values_item(*points, units=units, wcs=wcs, keepdims=keepdims)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../ndcube/utils/cube.py:58: in wcs_wrapper
return func(*params.args, **params.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../ndcube/ndcube.py:695: in _get_crop_by_values_item
return utils.cube.get_crop_item_from_points(points, wcs, True, keepdims=keepdims,
../../../ndcube/utils/cube.py:184: in get_crop_item_from_points
point_pixel_indices = (sliced_wcs.world_to_pixel_values(*sliced_point) if crop_by_values
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../ndcube/wcs/wrappers/compound_wcs.py:127: in world_to_pixel_values
pixel_arrays_sub = w.world_to_pixel_values(*world_arrays_sub)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/gwcs/api.py:121: in world_to_pixel_values
result = self.invert(*world_arrays)
^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/gwcs/wcs/_wcs.py:351: in invert
if is_high_level(*args, low_level_wcs=self):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
low_level_wcs = <WCS(output_frame=CompositeFrame, input_frame=Frame-8546, forward_transform=Model: CompoundModel
Inputs: ('x0', 'x1', ... 2.] pix)>
[2]: <Tabular1D(points=(<Quantity [0., 1., 2., 3.] pix>,), lookup_table=[0. 1. 2. 3.] m)>
Parameters:)>
args = (<Quantity 10800. s>, <Quantity 0. pix>, <Quantity 1. m>)
def is_high_level(*args, low_level_wcs):
"""
Determine if args matches the high level classes as defined by
``low_level_wcs``.
"""
if len(args) != len(low_level_wcs.world_axis_object_classes):
return False
type_match = [
(type(arg), waoc[0])
for arg, waoc in zip(
args, low_level_wcs.world_axis_object_classes.values(), strict=False
)
]
types_are_high_level = [argt is t for argt, t in type_match]
if all(types_are_high_level):
return True
if any(types_are_high_level):
msg = (
"Invalid types were passed, got "
f"({', '.join(tm[0].__name__ for tm in type_match)}) expected "
f"({', '.join(tm[1].__name__ for tm in type_match)})."
)
> raise TypeError(msg)
E TypeError: Invalid types were passed, got (Quantity, Quantity, Quantity) expected (Time, Quantity, Quantity).
/usr/lib/python3/dist-packages/gwcs/utils.py:508: TypeError
System Details
- Python 3.13 and 3.14
- asdf 5.1.0
- asdf-standard 1.4.0
- asdf-transform-schemas 0.6.0
- asdf-coordinates-schemas 0.4.0
- asdf-wcs-schemas 0.5.0
- asdf-astropy 0.9.0
All dependencies are from Debian testing.
Installation method
From github, while building a .deb package.
- 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 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
-
Discussion Upstream Fix Required
Difficulty 5/5 Over a week Newbie friendliness 25/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