@@ -5003,6 +5003,9 @@ def weights(
50035003 comp[key] = self._weights_scale(w, scale)
50045004
50055005 for w in comp.values():
5006+ if not measure:
5007+ w.override_units("1", inplace=True)
5008+
50065009 mn = w.minimum()
50075010 if mn <= 0:
50085011 raise ValueError(
@@ -6721,8 +6724,8 @@ def collapse(
67216724 **unweighted calculations**.
67226725
67236726 .. note:: Unless the *method* is ``'integral'``, the
6724- units of weights not combined with the
6725- field's units in the collapsed field.
6727+ units of the weights are not combined with
6728+ the field's units in the collapsed field.
67266729
67276730 If the alternative form of providing the collapse method
67286731 and axes combined as a CF cell methods-like string via the
@@ -6767,39 +6770,41 @@ def collapse(
67676770 time you could set ``weights=('area', 'T')``.
67686771
67696772 measure: `bool`, optional
6770- Create weights which are cell measures, i.e. which
6771- describe actual cell sizes (e.g. cell area) with
6772- appropriate units (e.g. metres squared). By default the
6773- weights units are ignored.
6773+ If True, and *weights* is not `None`, create weights
6774+ which are cell measures, i.e. which describe actual
6775+ cell sizes (e.g. cell area) with appropriate units
6776+ (e.g. metres squared). By default the weights units
6777+ are ignored.
67746778
67756779 Cell measures can be created for any combination of
6776- axes. For example, cell measures for a time axis are the
6777- time span for each cell with canonical units of seconds;
6778- cell measures for the combination of four axes
6779- representing time and three dimensional space could have
6780- canonical units of metres cubed seconds.
6780+ axes. For example, cell measures for a time axis are
6781+ the time span for each cell with canonical units of
6782+ seconds; cell measures for the combination of four
6783+ axes representing time and three dimensional space
6784+ could have canonical units of metres cubed seconds.
67816785
6782- When collapsing with the ``'integral'`` method, *measure*
6783- must be True, and the units of the weights are
6784- incorporated into the units of the returned field
6786+ When collapsing with the ``'integral'`` method,
6787+ *measure* must be True, and the units of the weights
6788+ are incorporated into the units of the returned field
67856789 construct.
67866790
67876791 .. note:: Specifying cell volume weights via
67886792 ``weights=['X', 'Y', 'Z']`` or
6789- ``weights=['area', 'Z']`` (or other equivalents)
6790- will produce **an incorrect result if the
6791- vertical dimension coordinates do not define the
6792- actual height or depth thickness of every cell
6793- in the domain**. In this case,
6794- ``weights='volume'`` should be used instead,
6795- which requires the field construct to have a
6796- "volume" cell measure construct.
6793+ ``weights=['area', 'Z']`` (or other
6794+ equivalents) will produce **an incorrect
6795+ result if the vertical dimension coordinates
6796+ do not define the actual height or depth
6797+ thickness of every cell in the domain**. In
6798+ this case, ``weights='volume'`` should be
6799+ used instead, which requires the field
6800+ construct to have a "volume" cell measure
6801+ construct.
67976802
6798- If ``weights=True`` then care also needs to be
6799- taken, as a "volume" cell measure construct will
6800- be used if present, otherwise the cell volumes
6801- will be calculated using the size of the
6802- vertical coordinate cells.
6803+ If ``weights=True`` then care also needs to
6804+ be taken, as a "volume" cell measure
6805+ construct will be used if present, otherwise
6806+ the cell volumes will be calculated using
6807+ the size of the vertical coordinate cells.
68036808
68046809 .. versionadded:: 3.0.2
68056810
0 commit comments