home / github / commits

Menu
  • Search all tables
  • GraphQL API

commits: bdcfab524ef1c852abe6dabcfabc7292f058fddc

This data as json

sha message author_date committer_date raw_author raw_committer repo author committer
bdcfab524ef1c852abe6dabcfabc7292f058fddc Support multiple dimensions in DataArray.argmin() and DataArray.argmax() methods (#3936) * 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. * Update whats-new.rst and api.rst with indices_min(), indices_max() * Fix type checking in DataArray._unravel_argminmax() * Fix expected results for TestReduce3D.test_indices_max() * Respect global default for keep_attrs * 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. * 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. * 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(). * Update api-hidden.rst with _argmin_base and _argmax_base * 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). * Move StringAccessor back to bottom of DataArray class definition * Revert use of _argmin_base and _argmax_base Now not needed because of change to injection in ops.py. * 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. * Update tests for change to coordinates on result of argmin, argmax * 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). * Update and correct docstrings for argmin and argmax * Correct suggested replacement for da.argmin() and da.argmax() * Remove use of _injected_ methods in argmin/argmax * Fix typo in name of argminmax_func Co-Authored-By: keewis <keewis@users.noreply.github.com> * Mark argminmax argument to _unravel_argminmax as a string Co-Authored-By: keewis <keewis@users.noreply.github.com> * Hidden internal methods don't need to appear in docs * Basic docstrings for Dataset.argmin() and Dataset.argmax() * Set stacklevel for DeprecationWarning in argmin/argmax methods * Revert "Explicitly defined class methods override injected methods" This reverts commit 8caf2b8d07c14a2956a26b50ee08d83323c36058. * Revert "Add 'out' keyword to argmin/argmax methods - allow numpy call signature" This reverts commit ab480b5c88a059264086260e5090eb38b98aa7fa. * Remove argmin and argmax from ops.py * Use self.reduce() in Dataset.argmin() and Dataset.argmax() Replaces need for "_injected_argmin" and "_injected_argmax". * Whitespace after 'title' lines in docstrings * 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. * 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). * Add unravel_index to duck_array_ops, use in Variable._unravel_argminmax * Filter argmin/argmax DeprecationWarnings in tests * Correct test for exception for nan in test_argmax * Remove injected argmin and argmax methods from api-hidden.rst * flake8 fixes * Tidy up argmin/argmax following code review Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com> * Remove filters for warnings from argmin/argmax from tests Pass an explicit axis or dim argument instead to avoid the warning. * 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. * revert the changes to Dataset.reduce * use dim instead of axis * use dimension instead of Ellipsis * Make passing 'dim=...' to Dataset.argmin() or Dataset.argmax() an error * Better docstrings for Dataset.argmin() and Dataset.argmax() * Update doc/whats-new.rst Co-authored-by: keewis <keewis@users.noreply.github.com> Co-authored-by: Stephan Hoyer <shoyer@google.com> Co-authored-by: keewis <keewis@users.noreply.github.com> Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com> Co-authored-by: Keewis <keewis@posteo.de> 2020-06-29T19:36:24Z 2020-06-29T19:36:24Z 7e21ec85163297602c88c6fc49638c2c95b296a9 cd792325681cbad9f663f2879d8b69f1edbb678f 13221727 3958036 19864447
Powered by Datasette · Queries took 1.763ms · About: xarray-datasette