Skip to content

Commit e2a21f4

Browse files
committed
Updatees
1 parent b2f3e01 commit e2a21f4

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

docs/source/index.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# flox: fast & furious GroupBy reductions for `dask.array`
2-
3-
## Overview
4-
52
[![GitHub Workflow CI Status](https://img.shields.io/github/workflow/status/xarray-contrib/flox/CI?logo=github&style=flat)](https://github.com/xarray-contrib/flox/actions)
6-
[![GitHub Workflow Code Style Status](https://img.shields.io/github/workflow/status/xarray-contrib/flox/code-style?label=Code%20Style&style=flat)](https://github.com/xarray-contrib/flox/actions)
3+
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/xarray-contrib/flox/main.svg)](https://results.pre-commit.ci/latest/github/xarray-contrib/flox/main)
74
[![image](https://img.shields.io/codecov/c/github/xarray-contrib/flox.svg?style=flat)](https://codecov.io/gh/xarray-contrib/flox)
5+
[![Documentation Status](https://readthedocs.org/projects/flox/badge/?version=latest)](https://flox.readthedocs.io/en/latest/?badge=latest)
6+
87
[![PyPI](https://img.shields.io/pypi/v/flox.svg?style=flat)](https://pypi.org/project/flox/)
98
[![Conda-forge](https://img.shields.io/conda/vn/conda-forge/flox.svg?style=flat)](https://anaconda.org/conda-forge/flox)
109

10+
[![NASA-80NSSC18M0156](https://img.shields.io/badge/NASA-80NSSC18M0156-blue)](https://earthdata.nasa.gov/esds/competitive-programs/access/pangeo-ml)
11+
[![NASA-80NSSC22K0345](https://img.shields.io/badge/NASA-80NSSC22K0345-blue)](https://science.nasa.gov/open-science-overview)
12+
13+
## Overview
14+
1115
`flox` mainly provides strategies for fast GroupBy reductions with dask.array. `flox` uses the MapReduce paradigm (or a "tree reduction")
1216
to run the GroupBy operation in a parallel-native way totally avoiding a sort or shuffle operation. It was motivated by
1317

docs/source/xarray.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
11
# Xarray
2+
3+
Xarray will use flox by default for numpy and dask array backed Xarray objects if it is installed. By default, it will use `method="cohorts"` which generalizes
4+
the best. Pass flox-specific kwargs to the specific reduction method:
5+
```python
6+
ds.groupby("time.month").mean(method="map-reduce", engine="flox")
7+
ds.groupby_bins("lon", bins=[0, 10, 20]).mean(method="map-reduce")
8+
ds.resample(time="M").mean(method="blockwise")
9+
```
10+
11+
Xarray's GroupBy operations are currently limited:
12+
1. One can only group by a single variable.
13+
1. When grouping by a dask array, that array will be computed to discover the unique group labels, and their locations
14+
15+
These limitations can be avoided by using {py:func}`flox.xarray.xarray_reduce` which allows grouping by multiple variables, lazy grouping by dask variables,
16+
as well as an arbitrary combination of categorical grouping and binning. For example,
17+
```python
18+
flox.xarray.xarray_reduce(
19+
ds,
20+
ds.time.dt.month,
21+
ds.lon,
22+
func="mean",
23+
expected_groups=[None, [0, 10, 20]],
24+
isbin=[False, True],
25+
method="map-reduce",
26+
)
27+
```

0 commit comments

Comments
 (0)