Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cf_xarray/groupers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

@dataclass
class FlagGrouper(UniqueGrouper):
"""
Grouper object that allows convenient categorical grouping by a CF flag variable.

Labels in the grouped output will be restricted to those listed in ``flag_meanings``.
"""

def factorize(self, group) -> EncodedGroups:
if "flag_values" not in group.attrs or "flag_meanings" not in group.attrs:
raise ValueError(
Expand Down
5 changes: 3 additions & 2 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Geometries
----------
.. autosummary::
:toctree: generated/
geometry.decode_geometries

geometry.decode_geometries
geometry.encode_geometries
geometry.shapely_to_cf
geometry.cf_to_shapely
Expand All @@ -33,7 +33,8 @@ Groupers
--------
.. autosummary::
:toctree: generated/
groupers.FlagGrouper

groupers.FlagGrouper

.. currentmodule:: xarray

Expand Down
Loading