Skip to content

Conversation

@valeriupredoi
Copy link
Collaborator

@valeriupredoi valeriupredoi commented Dec 16, 2025

A bit of a lengthy one, but in a nutshell:

  • eg a stat mean is not a property anymore, but a method, so active.mean[...] becomes active.mean()[...] so we can pass args and kwargs, so now you can active.mean(axis=(0, 1))[...]
  • add plenty of testing for Reductionist's new axis - which currently doesn't work as expected, see below

Main test case for Reductionist with axis

https://github.com/NCAS-CMS/PyActiveStorage/blob/axis_api/tests/test_real_s3_with_axes.py

  • Active loads a 4dim dataset
  • Loaded dataset <HDF5 dataset "m01s30i111": shape (120, 85, 324, 432), type "float32">
  • default axis arg (when axis=None): 'axis': (0, 1, 2, 3)

Test Case 1

def test_no_axis_2():
    """
    Fails: it should pass: 'axis': (0, 1, 2, 3) default
    are fine!

    activestorage.reductionist.ReductionistError: Reductionist error: HTTP 400: {"error": {"message": "request data is not valid", "caused_by": ["__all__: Validation error: Number of reduction axes must be less than length of shape - to reduce over all axes omit the axis field completely [{}]"]}}
    """
    active = build_active()
    result = active.min(axis=())[:]
    assert result == [[[[164.8125]]]]

Test Case 2

def test_axis_0_1():
    """Fails: activestorage.reductionist.ReductionistError: Reductionist error: HTTP 502: -"""
    active = build_active()
    result = active.min(axis=(0, 1))[:]
    assert result == [[[[164.8125]]]]

Test Case 3

def test_axis_0_1_2():
    """Passes fine."""
    active = build_active()
    result = active.min(axis=(0, 1, 2))[:]
    assert result[0][0][0][0] == 171.05126953125

These fails are here https://github.com/NCAS-CMS/PyActiveStorage/actions/runs/20272446127/job/58211728980?pr=300

@valeriupredoi valeriupredoi added the enhancement New feature or request label Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants