Skip to content

Commit

Permalink
Generate cumulative aggregations (#7152)
Browse files Browse the repository at this point in the history
* Added file to generate docs for cumulatives. generate_cumulatives.py creates _cumulatives.py

* Fixed mypy issues

* Updated cumulatives to fix mypy issues

* Added keep_attrs to groupby funcs

* Combined cumulatives and reductions and aggregations and modified dataset cumulative functions.

* Merged cumulatives and reductions into aggregations

* Removed test print from dataset.py

* Removed generate_cumulatives and generate_reductions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated _aggregations with docstring changes

* Updated generate_aggregations.py with suggestions from @dcherian. Removed potential solution to #6528.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removed unecessary function from dataset.py

* Removed unecessary function from dataset.py

* Updated api.rst, whats-new.rst and added a cumprod test to test_groupby.py

* Fixed accidental edit to test_dataset.py

* Apply suggestions from code review

* Merge and rename reductions and cumulatives to aggregations

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* minor tweaks

* Update computation.py

* Update generate_aggregations.py

* Update .pre-commit-config.yaml

* fix mypy

* use _group_dim in resample?

* Update resample.py

* Manually fix docstring

* Apply suggestions from code review

Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>

* Use TEMPLATE_SEE_ALSO

* use default example

* add resample test

* remove cumulative function in ops

* Revert "remove cumulative function in ops"

This reverts commit 66e7390.

* Add numeric_only=True

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Illviljan <14371165+Illviljan@users.noreply.github.com>
Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 26, 2022
1 parent 0a75d13 commit 076bd8e
Show file tree
Hide file tree
Showing 11 changed files with 1,386 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
rev: v0.3.7
hooks:
- id: blackdoc
exclude: "generate_reductions.py"
exclude: "generate_aggregations.py"
additional_dependencies: ["black==22.10.0"]
- id: blackdoc-autoupdate-black
- repo: https://github.com/PyCQA/flake8
Expand Down
2 changes: 2 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ Dataset
DatasetGroupBy.any
DatasetGroupBy.count
DatasetGroupBy.cumsum
DatasetGroupBy.cumprod
DatasetGroupBy.max
DatasetGroupBy.mean
DatasetGroupBy.median
Expand Down Expand Up @@ -784,6 +785,7 @@ DataArray
DataArrayGroupBy.any
DataArrayGroupBy.count
DataArrayGroupBy.cumsum
DataArrayGroupBy.cumprod
DataArrayGroupBy.max
DataArrayGroupBy.mean
DataArrayGroupBy.median
Expand Down
5 changes: 5 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ New Features
- Display the indexes in a new section of the text and HTML reprs
(:pull:`6795`, :pull:`7183`, :pull:`7185`)
By `Justus Magin <https://github.com/keewis>`_ and `Benoît Bovy <https://github.com/benbovy>`_.
- Added methods :py:meth:`DataArrayGroupBy.cumprod` and :py:meth:`DatasetGroupBy.cumprod`.
(:pull:`5816`)
By `Patrick Naylor <https://github.com/patrick-naylor>`_

Breaking changes
~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -62,6 +65,8 @@ Documentation
Add :py:meth:`__str__` to surface the new :py:class:`BackendEntrypoint` ``description``
and ``url`` attributes. (:issue:`6577`, :pull:`7000`)
By `Jessica Scheick <https://github.com/jessicas11>`_.
- Created docstring examples for :py:meth:`DataArray.cumsum`, :py:meth:`DataArray.cumprod`, :py:meth:`Dataset.cumsum`, :py:meth:`Dataset.cumprod`, :py:meth:`DatasetGroupBy.cumsum`, :py:meth:`DataArrayGroupBy.cumsum`. (:issue:`5816`, :pull:`7152`)
By `Patrick Naylor <https://github.com/patrick-naylor>`_
- Add example of using :py:meth:`DataArray.coarsen.construct` to User Guide. (:pull:`7192`)
By `Tom Nicholas <https://github.com/TomNicholas>`_.
- Rename ``axes`` to ``axs`` in plotting to align with ``matplotlib.pyplot.subplots``. (:pull:`7194`)
Expand Down
Loading

0 comments on commit 076bd8e

Please sign in to comment.