Skip to content

Commit 2ca65bd

Browse files
committed
dev
1 parent b4caa8a commit 2ca65bd

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

cf/field.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4826,10 +4826,10 @@ def healpix_decrease_refinement_level(
48264826
):
48274827
r"""Decrease the refinement level of a HEALPix grid.
48284828

4829-
Decreasing the refinement level reduces the resolution of the
4830-
HEALPix grid by combining, using the given *method*, the Field
4831-
data from the original cells that lie inside each larger cell
4832-
at the new lower refinement level.
4829+
Decreasing the HEALPix refinement level reduces the resolution
4830+
of the HEALPix grid by combining, using the given *method*,
4831+
the Field data from the original cells that lie inside each
4832+
larger cell at the new lower refinement level.
48334833

48344834
A new cell method is added, when appropriate, to describe the
48354835
reduction.
@@ -4860,7 +4860,7 @@ def healpix_decrease_refinement_level(
48604860

48614861
.. seealso:: `healpix_increase_refinement_level`,
48624862
`healpix_info`, `healpix_indexing_scheme`,
4863-
`healpix_to_ugrid`
4863+
`healpix_to_ugrid`, `collapse`
48644864

48654865
:Parameters:
48664866

@@ -4992,6 +4992,9 @@ def healpix_decrease_refinement_level(
49924992
>>> print(g[0, 0].array)
49934993
[[293.5]]
49944994

4995+
Set the refinement level to 0 using the ``'`range'`` *method*,
4996+
which requires a new *reduction* function to be defined:
4997+
49954998
>>> import numpy as np
49964999
>>> def range_func(a, axis=None):
49975000
... return np.max(a, axis=axis) - np.min(a, axis=axis)
@@ -5012,7 +5015,7 @@ def healpix_decrease_refinement_level(
50125015
"""
50135016
from .constants import cell_methods
50145017

5015-
# "point" is not a valid cell method after a reduction
5018+
# "point" is not a reduction method
50165019
cell_methods = cell_methods.copy()
50175020
cell_methods.remove("point")
50185021

@@ -5028,7 +5031,7 @@ def healpix_decrease_refinement_level(
50285031

50295032
# Parse 'reduction'
50305033
if reduction is None:
5031-
# Infer 'reduction' function from 'method'
5034+
# Use a default reduction function for selected methods
50325035
match method:
50335036
case "maximum":
50345037
reduction = np.max
@@ -5054,8 +5057,8 @@ def healpix_decrease_refinement_level(
50545057
elif not callable(reduction):
50555058
raise ValueError(
50565059
f"Can't decrease HEALPix refinement level of {f!r}: "
5057-
f"'reduction' must be callable. Got: {reduction!r} of type "
5058-
f"{type(reduction)}"
5060+
f"'reduction' must be a callable. Got: {reduction!r} of "
5061+
f"type {type(reduction)}"
50595062
)
50605063

50615064
# Get the HEALPix info

0 commit comments

Comments
 (0)