-
Notifications
You must be signed in to change notification settings - Fork 6
Move test extras dependencies under dependency-groups #66
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
base: main
Are you sure you want to change the base?
Conversation
Following [PEP735](https://peps.python.org/pep-0735), xref https://hatch.pypa.io/1.16/config/environment/advanced/#dependency-groups. Have also replaced fix-coord-transform-indexing branch with commit hash since pydata/xarray#10980 was merged.
|
Five test failures at https://github.com/xarray-contrib/rasterix/actions/runs/21012973291/job/60412040415?pr=66#step:7:35: Details=================================== FAILURES ===================================
_____________________ test_isel_basic_indexing_equivalence _____________________
[gw1] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:68: in test_isel_basic_indexing_equivalence
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
^^^^^^^^^^^^^^^^^^^^^^^
tests/test_indexing.py:75: in test_isel_basic_indexing_equivalence
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Indexes only on the right object: ['x']
E Falsifying example: test_isel_basic_indexing_equivalence(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {'y': 0}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAFBAABBAEEA') as a decorator on your test case
__________________________ test_outer_array_indexing ___________________________
[gw2] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:120: in test_outer_array_indexing
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
^^^^^^^^^^^^^^^^^^^^^^^
tests/test_indexing.py:129: in test_outer_array_indexing
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Differing indexes:
E L x RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R x PandasIndex(Index([0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5], dtype='float64', name='x'))
E L y RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R y PandasIndex(Index([-0.5, -1.5, -2.5, -3.5, -4.5, -5.5, -6.5, -7.5], dtype='float64', name='y'))
E Falsifying example: test_outer_array_indexing(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAA=') as a decorator on your test case
_____________________ test_sel_basic_indexing_equivalence ______________________
[gw1] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:79: in test_sel_basic_indexing_equivalence
@settings(
tests/test_indexing.py:96: in test_sel_basic_indexing_equivalence
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Indexes only on the right object: ['y']
E Falsifying example: test_sel_basic_indexing_equivalence(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {'x': np.float64(0.5)}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAFBAABBAEEAAA==') as a decorator on your test case
_______________________ test_outer_array_label_indexing ________________________
[gw2] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:133: in test_outer_array_label_indexing
@settings(
tests/test_indexing.py:142: in test_outer_array_label_indexing
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Differing indexes:
E L x RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R x PandasIndex(Index([0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5], dtype='float64', name='x'))
E L y RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R y PandasIndex(Index([-0.5, -1.5, -2.5, -3.5, -4.5, -5.5, -6.5, -7.5], dtype='float64', name='y'))
E Falsifying example: test_outer_array_label_indexing(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAA=') as a decorator on your test case
_______________________________ test_simple_isel _______________________________
[gw1] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:102: in test_simple_isel
xr.testing.assert_identical(raster_da.isel(x=0), pandas_da.isel(x=0))
E AssertionError: Left and right DataArray objects are not identical
E Indexes only on the right object: ['y']Seems to be because |
Since pydata/xarray#11035, `xarray.testing.assert_identical` compares xindexes too, which fails the test because RasterIndex and PandasIndex has different types. Using `assert_equal` which only checks the DataArray. Ideally should check that the index values are equal too somehow.
| result_raster = raster_da.isel(indexers) | ||
| result_pandas = pandas_da.isel(indexers) | ||
| xr.testing.assert_identical(result_raster, result_pandas) | ||
| xr.testing.assert_equal(result_raster, result_pandas) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to also do some sort of comparison on the RasterIndex and PandasIndex values like:
xr.core.indexes.indexes_identical(result_raster.xindexes, result_pandas.xindexes)But that would require a bit more work, and unsure whether to have that comparison check code live upstream in pydata/xarray or here in rasterix.
Following PEP735, move test (development) dependencies away from test extras into a separate dependency-group.
Have also replaced fix-coord-transform-indexing branch with commit hash since pydata/xarray#10980 was merged.
References:
Addresses #65