Skip to content

Commit c9bcf73

Browse files
committed
Fix error message when can't create area weights
1 parent 6f65687 commit c9bcf73

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

Changelog.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
version NEXT
2+
------------
3+
4+
**2024-??-??**
5+
6+
* Fix misleading error message when it is not possible to create area
7+
weights requested from `cf.Field.collapse`
8+
(https://github.com/NCAS-CMS/cf-python/issues/731)
9+
10+
----
11+
112
version 3.16.1
213
--------------
314

@@ -29,6 +40,8 @@ version 3.16.1
2940
(https://github.com/NCAS-CMS/cf-python/issues/713)
3041
* Changed dependency: ``1.11.1.0<=cfdm<1.11.2.0``
3142

43+
----
44+
3245
version 3.16.0
3346
--------------
3447

cf/field.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,18 +3836,17 @@ def weights(
38363836
# Found area weights from X and Y dimension
38373837
# coordinates
38383838
area_weights = True
3839-
else:
3840-
Weights.polygon_area(
3841-
self,
3842-
None,
3843-
comp,
3844-
weights_axes,
3845-
measure=measure,
3846-
radius=radius,
3847-
great_circle=great_circle,
3848-
methods=methods,
3849-
auto=False,
3850-
)
3839+
elif Weights.polygon_area(
3840+
self,
3841+
None,
3842+
comp,
3843+
weights_axes,
3844+
measure=measure,
3845+
radius=radius,
3846+
great_circle=great_circle,
3847+
methods=methods,
3848+
auto=True,
3849+
):
38513850
# Found area weights from UGRID/geometry cells
38523851
area_weights = True
38533852

0 commit comments

Comments
 (0)