Skip to content
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

Support multiple dimensions in DataArray.argmin() and DataArray.argmax() methods #3936

Merged
merged 46 commits into from
Jun 29, 2020

Commits on Apr 5, 2020

  1. DataArray.indices_min() and DataArray.indices_max() methods

    These return dicts of the indices of the minimum or maximum of a
    DataArray over several dimensions.
    johnomotani committed Apr 5, 2020
    Configuration menu
    Copy the full SHA
    8e7fb53 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2b06811 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f6a966c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4395e7a View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2020

  1. Configuration menu
    Copy the full SHA
    deee3f8 View commit details
    Browse the repository at this point in the history
  2. Merge behaviour of indices_min/indices_max into argmin/argmax

    When argmin or argmax are called with a sequence for 'dim', they now
    return a dict with the indices for each dimension in dim.
    johnomotani committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    be8b26c View commit details
    Browse the repository at this point in the history
  3. Basic overload of argmin() and argmax() for Dataset

    If single dim is passed to Dataset.argmin() or Dataset.argmax(), then
    pass through to _argmin_base or _argmax_base. If a sequence is passed
    for dim, raise an exception, because the result for each DataArray would
    be a dict, which cannot be stored in a Dataset.
    johnomotani committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    6d9d509 View commit details
    Browse the repository at this point in the history
  4. Update Variable and dask tests with _argmin_base, _argmax_base

    The basic numpy-style argmin() and argmax() methods were renamed when
    adding support for handling multiple dimensions in DataArray.argmin()
    and DataArray.argmax(). Variable.argmin() and Variable.argmax() are
    therefore renamed as Variable._argmin_base() and
    Variable._argmax_base().
    johnomotani committed Apr 6, 2020
    Configuration menu
    Copy the full SHA
    70aaa9d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f8952a8 View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2020

  1. Explicitly defined class methods override injected methods

    If a method (such as 'argmin') has been explicitly defined on a class
    (so that hasattr(cls, "argmin")==True), then do not inject that method,
    as it would override the explicitly defined one. Instead inject a
    private method, prefixed by "_injected_" (such as '_injected_argmin'), so
    that the injected method is available to the explicitly defined one.
    
    Do not perform the hasattr check on binary ops, because this breaks
    some operations (e.g. addition between DataArray and int in
    test_dask.py).
    johnomotani committed Apr 10, 2020
    Configuration menu
    Copy the full SHA
    8caf2b8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4778cfd View commit details
    Browse the repository at this point in the history
  3. Revert use of _argmin_base and _argmax_base

    Now not needed because of change to injection in ops.py.
    johnomotani committed Apr 10, 2020
    Configuration menu
    Copy the full SHA
    66cf085 View commit details
    Browse the repository at this point in the history
  4. Move implementation of argmin, argmax from DataArray to Variable

    Makes use of argmin and argmax more general (they are available for
    Variable) and is straightforward for DataArray to wrap the Variable
    version.
    johnomotani committed Apr 10, 2020
    Configuration menu
    Copy the full SHA
    c78c1fe View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cb6742d View commit details
    Browse the repository at this point in the history
  6. Add 'out' keyword to argmin/argmax methods - allow numpy call signature

    When np.argmin(da) is called, numpy passes an 'out' keyword argument to
    argmin/argmax. Need to allow this argument to avoid errors (but an
    exception is thrown if out is not None).
    johnomotani committed Apr 10, 2020
    Configuration menu
    Copy the full SHA
    ab480b5 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    dca8e45 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    52554b6 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2020

  1. Configuration menu
    Copy the full SHA
    ef826f6 View commit details
    Browse the repository at this point in the history
  2. Fix typo in name of argminmax_func

    Co-Authored-By: keewis <keewis@users.noreply.github.com>
    johnomotani and keewis authored Apr 21, 2020
    Configuration menu
    Copy the full SHA
    8a7c7ad View commit details
    Browse the repository at this point in the history
  3. Mark argminmax argument to _unravel_argminmax as a string

    Co-Authored-By: keewis <keewis@users.noreply.github.com>
    johnomotani and keewis authored Apr 21, 2020
    Configuration menu
    Copy the full SHA
    e56e2e7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a99697a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a785c34 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ac897d4 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    752518e View commit details
    Browse the repository at this point in the history
  8. Revert "Add 'out' keyword to argmin/argmax methods - allow numpy call…

    … signature"
    
    This reverts commit ab480b5.
    johnomotani committed Apr 21, 2020
    Configuration menu
    Copy the full SHA
    8b7365b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    46b04a6 View commit details
    Browse the repository at this point in the history
  10. Use self.reduce() in Dataset.argmin() and Dataset.argmax()

    Replaces need for "_injected_argmin" and "_injected_argmax".
    johnomotani committed Apr 21, 2020
    Configuration menu
    Copy the full SHA
    1ef3c97 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    65ca2ad View commit details
    Browse the repository at this point in the history
  12. Remove tests of np.argmax() and np.argmin() functions from test_units.py

    Applying numpy functions to xarray objects is not necessarily expected
    to work, and the wrapping of argmin() and argmax() is broken by
    xarray-specific interface of argmin() and argmax() methods of Variable,
    DataArray and Dataset.
    johnomotani committed Apr 21, 2020
    Configuration menu
    Copy the full SHA
    1736abf View commit details
    Browse the repository at this point in the history
  13. Clearer deprecation warnings in Dataset.argmin() and Dataset.argmax()

    Also, previously suggested workaround was not correct. Remove suggestion
    as there is no workaround (but the removed behaviour is unlikely to be
    useful).
    johnomotani committed Apr 21, 2020
    Configuration menu
    Copy the full SHA
    d9b55ee View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    432dfbb View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    20b448a View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    95845f9 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    0ee5146 View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2020

  1. Configuration menu
    Copy the full SHA
    daa2ea5 View commit details
    Browse the repository at this point in the history
  2. flake8 fixes

    johnomotani committed Jun 24, 2020
    Configuration menu
    Copy the full SHA
    d029183 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2020

  1. Tidy up argmin/argmax following code review

    Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
    johnomotani and dcherian authored Jun 26, 2020
    Configuration menu
    Copy the full SHA
    a758b0f View commit details
    Browse the repository at this point in the history
  2. Remove filters for warnings from argmin/argmax from tests

    Pass an explicit axis or dim argument instead to avoid the warning.
    johnomotani committed Jun 26, 2020
    Configuration menu
    Copy the full SHA
    9a54e0c View commit details
    Browse the repository at this point in the history
  3. Swap order of reduce_dims checks in Dataset.reduce()

    Prefer to pass reduce_dims=None when possible, including for variables
    with only one dimension. Avoids an error if an 'axis' keyword was
    passed.
    johnomotani committed Jun 26, 2020
    Configuration menu
    Copy the full SHA
    a07ce29 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f73e10e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d77fe11 View commit details
    Browse the repository at this point in the history
  6. use dim instead of axis

    keewis committed Jun 26, 2020
    Configuration menu
    Copy the full SHA
    308bb23 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1b53f49 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5f80205 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    540c281 View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2020

  1. Update doc/whats-new.rst

    Co-authored-by: keewis <keewis@users.noreply.github.com>
    johnomotani and keewis authored Jun 27, 2020
    Configuration menu
    Copy the full SHA
    4aca9d9 View commit details
    Browse the repository at this point in the history