-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Note about collapsing multi-dimensional coordinates #1819
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,22 @@ in the gallery takes a zonal mean of an ``XYT`` cube by using the | |
``collapsed`` method with ``latitude`` and ``iris.analysis.MEAN`` as arguments. | ||
|
||
|
||
.. note:: | ||
You cannot partially collapse a multi-dimensional coordinate. Thus in the | ||
above example you would not be able to collapse the cube along either of | ||
the axes described by the ``grid_latitude`` or ``grid_longitude`` | ||
coordinates individually. Doing so would result in a partial collapse of | ||
the 2D ``surface_altitude`` coordinate. | ||
|
||
Instead you must either fully collapse the coordinate (in this case | ||
requiring that both ``grid_latitude`` or ``grid_longitude`` coordinates be | ||
collapsed together in a single collapse operation) or not collapse the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Third option - remove the surface altitude. |
||
coordinate at all. | ||
|
||
Multi-dimensional derived coordinates (such as ``altitude`` in the above | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps too much detail for the userguide. |
||
example) will not prevent a successful collapse operation across a | ||
cube dimension that the multi-dimensional derived coordinate spans. | ||
|
||
.. _cube-statistics-collapsing-average: | ||
|
||
Area averaging | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -943,11 +943,21 @@ def cell(self, index): | |
|
||
def collapsed(self, dims_to_collapse=None): | ||
""" | ||
Returns a copy of this coordinate which has been collapsed along | ||
Returns a copy of this coordinate, which has been collapsed along | ||
the specified dimensions. | ||
|
||
Replaces the points & bounds with a simple bounded region. | ||
|
||
.. note:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this note is well targeted for coordinates. |
||
You cannot partially collapse a multi-dimensional coordinate. To | ||
successfully collapse a multi-dimensional coordinate (i.e. a | ||
coordinate that describes more than one of a cube's axes) you | ||
must collapse all cube axes that the multi-dimensional coordinate | ||
spans in a single collapse operation. | ||
|
||
Multi-dimensional derived coordinates will not prevent a successful | ||
collapse operation. | ||
|
||
""" | ||
if isinstance(dims_to_collapse, (int, np.integer)): | ||
dims_to_collapse = [dims_to_collapse] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2945,6 +2945,16 @@ def collapsed(self, coords, aggregator, **kwargs): | |
cube.collapsed(['latitude', 'longitude'], | ||
iris.analysis.VARIANCE) | ||
|
||
.. note:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 for more detail in here which we can cross reference. |
||
You cannot partially collapse a multi-dimensional coordinate. To | ||
successfully collapse a multi-dimensional coordinate (i.e. a | ||
coordinate that describes more than one of a cube's axes) you | ||
must collapse all cube axes that the multi-dimensional coordinate | ||
spans in a single collapse operation. | ||
|
||
Multi-dimensional derived coordinates will not prevent a successful | ||
collapse operation. | ||
|
||
""" | ||
# Convert any coordinate names to coordinates | ||
coords = self._as_list_of_coords(coords) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Action: make into a single sentence and cross reference "reference docs".