Skip to content

Commit 82265e6

Browse files
authored
Merge branch 'main' into regrid-3d
2 parents 5f51310 + 87a3997 commit 82265e6

File tree

3,885 files changed

+14386
-11790
lines changed

Some content is hidden

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

3,885 files changed

+14386
-11790
lines changed

Changelog.rst

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
version 3.17.0
2-
--------------
1+
version NEXT
2+
------------
33

44
**2024-??-??**
55

@@ -10,6 +10,18 @@ version 3.17.0
1010
`cf.Field.regrids` and `cf.Field.regridc`
1111
(https://github.com/NCAS-CMS/cf-python/issues/715)
1212
* Allow DSG tractories with identical `trajectory_id` values to be
13+
* Fix misleading error message when it is not possible to create area
14+
weights requested from `cf.Field.collapse`
15+
(https://github.com/NCAS-CMS/cf-python/issues/731)
16+
17+
----
18+
19+
version 3.16.1
20+
--------------
21+
22+
**2024-03-01**
23+
24+
* Allow DSG trajectories with identical `trajectory_id` values to be
1325
aggregated (https://github.com/NCAS-CMS/cf-python/issues/723)
1426
* New methods: `cf.Field.pad_missing` and `cf.Data.pad_missing`
1527
(https://github.com/NCAS-CMS/cf-python/issues/717)
@@ -28,11 +40,14 @@ version 3.17.0
2840
* Allow `cf.Data` to be initialised with `xarray.DataAarray`
2941
(https://github.com/NCAS-CMS/cf-python/issues/706)
3042
* Fix bug that caused `cf.Field.del_file_location` to fail when
31-
updating its metdata constructs
43+
updating its metadata constructs
3244
(https://github.com/NCAS-CMS/cf-python/issues/707)
3345
* Fix bug that caused incorrect data arrays in some cyclic subspaces
3446
created by `cf.Field.subspace` and `cf.Field.__getitem__`
3547
(https://github.com/NCAS-CMS/cf-python/issues/713)
48+
* Changed dependency: ``1.11.1.0<=cfdm<1.11.2.0``
49+
50+
----
3651

3752
version 3.16.0
3853
--------------
@@ -196,8 +211,8 @@ version 3.14.1
196211

197212
----
198213

199-
version 3.14.0
200-
--------------
214+
version 3.14.0 (*first Dask release*)
215+
-------------------------------------
201216

202217
**2023-01-31**
203218

@@ -231,8 +246,8 @@ version 3.14.0
231246

232247
----
233248

234-
version 3.13.1
235-
--------------
249+
version 3.13.1 (*last LAMA release*)
250+
------------------------------------
236251

237252
**2022-10-17**
238253

@@ -832,7 +847,7 @@ version 3.0.1
832847

833848
----
834849

835-
version 3.0.0 (*first Python 3 version*)
850+
version 3.0.0 (*first Python 3 release*)
836851
----------------------------------------
837852

838853
**2019-10-01**
@@ -849,7 +864,7 @@ version 3.0.0 (*first Python 3 version*)
849864

850865
----
851866

852-
version 2.3.8 (*last Python 2 version*)
867+
version 2.3.8 (*last Python 2 release*)
853868
---------------------------------------
854869

855870
**2019-10-07**
@@ -1712,8 +1727,8 @@ version 0.9.6
17121727

17131728
----
17141729

1715-
version 0.9.5
1716-
-------------
1730+
version 0.9.5 (*first LAMA release*)
1731+
------------------------------------
17171732

17181733
**2012-10-01**
17191734

@@ -1731,7 +1746,7 @@ version 0.9.5
17311746

17321747
----
17331748

1734-
version 0.9.5.dev
1749+
version 0.9.5.dev
17351750
-----------------
17361751

17371752
**2012-09-19**

DOCUMENTATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
sphinx-copybutton==0.5.1
66
sphinx-toggleprompt==0.2.0
77
sphinxcontrib-spelling==4.3.0
8-
serializinghtml-serializinghtml==1.1.5
8+
sphinxcontrib.serializinghtml==1.1.5
99
sphinx==2.4.5
1010
1111
* The `.py` files to generate recipes are stored in `docs/source/recipes/`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ seprately to the `cf` package.
125125

126126
See the [cf-plot
127127
gallery](http://ajheaps.github.io/cf-plot/gallery.html) for the full
128-
range range plotting possibilities with example code.
128+
range of plotting possibilities with example code.
129129

130130
![Example output of cf-plot displaying a `cf` field construct](docs/source/images/cfplot_example.png)
131131

RELEASE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Decide the version name to set for the new release, by
2+
heeding the Versioning Strategy (see
3+
https://ncas-cms.github.io/cf-python/releases.html#versioning-strategy).
4+
15
* Change the version and date in `cf/__init__.py` (`__version__` and
26
`__date__` variables)
37

archive_docs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# --------------------------------------------------------------------
3+
# Create an archive copy of the documentation
4+
# --------------------------------------------------------------------
5+
set -x
6+
7+
version=`python -c "import cf; print(cf.__version__)"`
8+
9+
cd docs
10+
mkdir -p $version
11+
12+
cp -ar \
13+
objects.inv \
14+
searchindex.js \
15+
*.html \
16+
attribute \
17+
class \
18+
method \
19+
function \
20+
recipes \
21+
_downloads \
22+
_images \
23+
_sources \
24+
_static \
25+
_templates \
26+
$version
27+
28+
set +x

cf/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
"""
7575

7676
__Conventions__ = "CF-1.11"
77-
__date__ = "2023-12-06"
78-
__version__ = "3.16.0"
77+
__date__ = "2023-03-01"
78+
__version__ = "3.16.1"
7979

8080
_requires = (
8181
"numpy",
@@ -199,8 +199,8 @@
199199
)
200200

201201
# Check the version of cfdm
202-
_minimum_vn = "1.11.0.0"
203-
_maximum_vn = "1.11.1.0"
202+
_minimum_vn = "1.11.1.0"
203+
_maximum_vn = "1.11.2.0"
204204
_cfdm_version = Version(cfdm.__version__)
205205
if not Version(_minimum_vn) <= _cfdm_version < Version(_maximum_vn):
206206
raise RuntimeError(

cf/aggregate.py

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,11 +2977,19 @@ def aggregate(
29772977
# ------------------------------------------------------------
29782978
if axes is None:
29792979
# Aggregation will be over as many axes as possible
2980-
aggregating_axes = meta[0].axis_ids
2980+
m0 = meta[0]
2981+
aggregating_axes = m0.axis_ids[:]
2982+
2983+
# For DSG feature types, only consider aggregating the
2984+
# feature dimension(s).
2985+
if m0.featureType:
2986+
for axis in aggregating_axes[:]:
2987+
if not dsg_feature_type_axis(m0, axis):
2988+
aggregating_axes.remove(axis)
2989+
29812990
_create_hash_and_first_values(
2982-
meta, None, False, hfl_cache, rtol, atol
2991+
meta, aggregating_axes, False, hfl_cache, rtol, atol
29832992
)
2984-
29852993
else:
29862994
# Specific aggregation axes have been selected
29872995
aggregating_axes = []
@@ -3484,15 +3492,16 @@ def climatology_cells(
34843492

34853493

34863494
def _create_hash_and_first_values(
3487-
meta, axes, donotchecknonaggregatingaxes, hfl_cache, rtol, atol
3495+
meta, aggregating_axes, donotchecknonaggregatingaxes, hfl_cache, rtol, atol
34883496
):
34893497
"""Updates each field's _Meta object.
34903498
34913499
:Parameters:
34923500
34933501
meta: `list` of `_Meta`
34943502
3495-
axes: `None` or `list`
3503+
axes: sequence
3504+
The identities of the possible aggregating axes.
34963505
34973506
donotchecknonaggregatingaxes: `bool`
34983507
@@ -3509,6 +3518,9 @@ def _create_hash_and_first_values(
35093518
field = m.field
35103519
constructs = field.constructs.todict()
35113520

3521+
# Store the aggregating axis identities
3522+
m.aggregating_axes = aggregating_axes
3523+
35123524
m_sort_keys = m.sort_keys
35133525
m_sort_indices = m.sort_indices
35143526

@@ -3527,9 +3539,9 @@ def _create_hash_and_first_values(
35273539
# --------------------------------------------------------
35283540
for identity in m.axis_ids:
35293541
if (
3530-
axes is not None
3542+
aggregating_axes is not None
35313543
and donotchecknonaggregatingaxes
3532-
and identity not in axes
3544+
and identity not in aggregating_axes
35333545
):
35343546
x = [None] * len(m.axis[identity]["keys"])
35353547
m_hash_values[identity] = x
@@ -3671,12 +3683,12 @@ def _create_hash_and_first_values(
36713683

36723684
coord = constructs[key]
36733685

3674-
axes = aux["axes"]
3686+
c_axes = aux["axes"]
36753687
canonical_axes = aux["canonical_axes"]
3676-
if axes != canonical_axes:
3688+
if c_axes != canonical_axes:
36773689
# Transpose the N-d auxiliary coordinate so that
36783690
# it has the canonical axis order
3679-
iaxes = [axes.index(axis) for axis in canonical_axes]
3691+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
36803692
coord = coord.transpose(iaxes)
36813693

36823694
sort_indices, needs_sorting = _sort_indices(m, canonical_axes)
@@ -3722,14 +3734,14 @@ def _create_hash_and_first_values(
37223734
else:
37233735
for canonical_units, msr in m.msr.items():
37243736
hash_values = []
3725-
for key, axes, canonical_axes in zip(
3737+
for key, c_axes, canonical_axes in zip(
37263738
msr["keys"], msr["axes"], msr["canonical_axes"]
37273739
):
37283740
cell_measure = constructs[key]
3729-
if axes != canonical_axes:
3741+
if c_axes != canonical_axes:
37303742
# Transpose the cell measure so that it has
37313743
# the canonical axis order
3732-
iaxes = [axes.index(axis) for axis in canonical_axes]
3744+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
37333745
cell_measure = cell_measure.transpose(iaxes)
37343746

37353747
sort_indices, needs_sorting = _sort_indices(
@@ -3836,12 +3848,12 @@ def _create_hash_and_first_values(
38363848

38373849
field_anc = constructs[key]
38383850

3839-
axes = anc["axes"]
3851+
c_axes = anc["axes"]
38403852
canonical_axes = anc["canonical_axes"]
3841-
if axes != canonical_axes:
3853+
if c_axes != canonical_axes:
38423854
# Transpose the field ancillary so that it has the
38433855
# canonical axis order
3844-
iaxes = [axes.index(axis) for axis in canonical_axes]
3856+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
38453857
field_anc = field_anc.transpose(iaxes)
38463858

38473859
sort_indices, needs_sorting = _sort_indices(m, canonical_axes)
@@ -3874,12 +3886,12 @@ def _create_hash_and_first_values(
38743886

38753887
domain_anc = constructs[key]
38763888

3877-
axes = anc["axes"]
3889+
c_axes = anc["axes"]
38783890
canonical_axes = anc["canonical_axes"]
3879-
if axes != canonical_axes:
3891+
if c_axes != canonical_axes:
38803892
# Transpose the domain ancillary so that it has
38813893
# the canonical axis order
3882-
iaxes = [axes.index(axis) for axis in canonical_axes]
3894+
iaxes = [c_axes.index(axis) for axis in canonical_axes]
38833895
domain_anc = domain_anc.transpose(iaxes)
38843896

38853897
sort_indices, needs_sorting = _sort_indices(m, canonical_axes)
@@ -4131,7 +4143,7 @@ def _group_fields(meta, axis, info=False):
41314143
group is represented by a `list` of `_Meta` objects.
41324144
41334145
"""
4134-
axes = meta[0].axis_ids
4146+
axes = meta[0].aggregating_axes
41354147

41364148
if axes:
41374149
if axis in axes:

0 commit comments

Comments
 (0)