Skip to content

Commit 8843029

Browse files
committed
Merge branch 'main' into create-bounds
2 parents 605d818 + 601c14e commit 8843029

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+244
-154
lines changed

Changelog.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version 3.??.?
99
version 3.17.0
1010
--------------
1111

12-
**2025-03-??**
12+
**2025-03-24**
1313

1414
* Set new minimum version of `dask`: ``2025.2.0``
1515
(https://github.com/NCAS-CMS/cf-python/issues/849)
@@ -21,6 +21,9 @@ version 3.17.0
2121
``key`` (https://github.com/NCAS-CMS/cf-python/issues/802)
2222
* New keyword parameter to `cf.histogram`: ``density``
2323
(https://github.com/NCAS-CMS/cf-python/issues/794)
24+
* Fix bug that caused `Data._axes` to be incorrect after a call to
25+
`cf.Field.collapse`
26+
(https://github.com/NCAS-CMS/cf-python/issues/857)
2427
* Changed dependency: ``Python>=3.9.0``
2528
* Changed dependency: ``numpy>=2.0.0``
2629
* Changed dependency: ``cfdm>=1.12.0.0, <1.12.1.0``

DOCUMENTATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
```
3838

3939
* If the filter doesn't exist, it has to be added in `<div class="filter-menu">`
40-
alphabetically for `/docs/source/recipes/README.rst`, e.g.,
40+
alphabetically for `docs/source/recipes/README.rst`, e.g.,
4141

4242
```html
4343
<div class="filter-menu">

cf/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@
7272
7373
Powerful, flexible, and very simple to produce visualisations of field
7474
constructs uses the `cfplot` package
75-
(http://ajheaps.github.io/cf-plot), that is automatically installed
75+
(https://ncas-cms.github.io/cf-plot/build/), that is automatically installed
7676
along with with `cf`.
7777
7878
See the :ref:`cf-python home page <cf-python-home>` for documentation,
7979
installation and source code.
8080
8181
"""
8282

83-
__date__ = "2025-03-??"
83+
__date__ = "2025-03-24"
8484
__version__ = "3.17.0"
8585

8686
_requires = (

cf/aggregate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5005,7 +5005,7 @@ def dsg_feature_type_axis(meta, axis):
50055005
def _fix_promoted_field_ancillaries(output_meta, axes_aggregated):
50065006
"""Remove non-aggregated axes from promoted field ancillaries.
50075007
5008-
.. versionadded:: NEXTVERSION
5008+
.. versionadded:: 3.17.0
50095009
50105010
:Parameters:
50115011

cf/data/array/aggregatedarray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
class AggregatedArray(Container, cfdm.AggregatedArray):
88
"""An array stored in a CF aggregation variable.
99
10-
.. versionadded:: NEXTVERSION
10+
.. versionadded:: 3.17.0
1111
1212
"""
1313

1414
def __new__(cls, *args, **kwargs):
1515
"""Store fragment array classes.
1616
17-
.. versionadded:: NEXTVERSION
17+
.. versionadded:: 3.17.0
1818
1919
"""
2020
# Override the inherited FragmentFileArray class

cf/data/array/umarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ def get_byte_ordering(self):
635635
636636
`str` or `None`
637637
``'little_endian'`` or ``'big_endian'``. If the byte
638-
ordereing has not been set then `None` is returned, in
638+
ordering has not been set then `None` is returned, in
639639
which case byte ordering will be detected
640640
automatically (if possible) when the file is opened
641641
with `open`.

cf/data/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,7 +2807,7 @@ def _concatenate_conform_units(cls, data1, units0, relaxed_units, copy):
28072807
overridden in subclasses, to allow for customisation of the
28082808
concatenation process.
28092809
2810-
.. versionadded:: NEXTVERSION
2810+
.. versionadded:: 3.17.0
28112811
28122812
.. seealso:: `concatenate`
28132813
@@ -2868,7 +2868,7 @@ def _concatenate_post_process(
28682868
overridden in subclasses, to allow for customisation of the
28692869
concatenation process.
28702870
2871-
.. versionadded:: NEXTVERSION
2871+
.. versionadded:: 3.17.0
28722872
28732873
.. seealso:: `concatenate`
28742874

cf/data/fragment/fragmentfilearray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ class FragmentFileArray(
99
):
1010
"""Fragment of aggregated data in a file.
1111
12-
.. versionadded:: NEXTVERSION
12+
.. versionadded:: 3.17.0
1313
1414
"""
1515

1616
def __new__(cls, *args, **kwargs):
1717
"""Store fragment classes.
1818
19-
.. versionadded:: NEXTVERSION
19+
.. versionadded:: 3.17.0
2020
2121
"""
2222
# Import fragment classes. Do this here (as opposed to outside

cf/data/utils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,14 @@ def collapse(
402402
weights, axis)``.
403403
404404
"""
405+
original_size = d.size
406+
if axis is None:
407+
axis = range(d.ndim)
408+
else:
409+
axis = d._parse_axes(axis)
410+
405411
kwargs = {
406-
"axis": axis,
412+
"axis": tuple(axis),
407413
"keepdims": keepdims,
408414
"split_every": split_every,
409415
"mtol": mtol,
@@ -424,6 +430,14 @@ def collapse(
424430
dx = func(dx, **kwargs)
425431
d._set_dask(dx)
426432

433+
if not keepdims:
434+
# Remove collapsed axis names
435+
d._axes = [a for i, a in enumerate(d._axes) if i not in axis]
436+
437+
if d.size != original_size:
438+
# Remove the out-dated HDF5 chunking strategy
439+
d.nc_clear_hdf5_chunksizes()
440+
427441
return d, weights
428442

429443

cf/dimensioncoordinate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def anchor(self, value, cell=False, parameters=None, inplace=False):
279279
units as the coordinates.
280280
281281
The coordinate values are transformed so the first
282-
corodinate is the closest to *value* from above (for
282+
coordinate is the closest to *value* from above (for
283283
increasing coordinates), or the closest to *value* from
284284
above (for decreasing coordinates)
285285
@@ -328,7 +328,7 @@ def anchor(self, value, cell=False, parameters=None, inplace=False):
328328
329329
parameters: `dict`, optional
330330
If a `dict` is provided then it will be updated
331-
in-place with parameters which describe thethe
331+
in-place with parameters which describe the
332332
anchoring process.
333333
334334
{{inplace: `bool`, optional}}

0 commit comments

Comments
 (0)