File tree Expand file tree Collapse file tree 3 files changed +34
-12
lines changed Expand file tree Collapse file tree 3 files changed +34
-12
lines changed Original file line number Diff line number Diff line change
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
+
1
12
version 3.16.1
2
13
--------------
3
14
@@ -29,6 +40,8 @@ version 3.16.1
29
40
(https://github.com/NCAS-CMS/cf-python/issues/713)
30
41
* Changed dependency: ``1.11.1.0<=cfdm<1.11.2.0 ``
31
42
43
+ ----
44
+
32
45
version 3.16.0
33
46
--------------
34
47
Original file line number Diff line number Diff line change @@ -3836,18 +3836,17 @@ def weights(
3836
3836
# Found area weights from X and Y dimension
3837
3837
# coordinates
3838
3838
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
+ ):
3851
3850
# Found area weights from UGRID/geometry cells
3852
3851
area_weights = True
3853
3852
Original file line number Diff line number Diff line change @@ -326,6 +326,16 @@ def test_weights_cell_measures_coordinates(self):
326
326
with self .assertRaises (ValueError ):
327
327
w = f .weights ("area" , cell_measures = False , coordinates = False )
328
328
329
+ def test_weights_exceptions (self ):
330
+ f = cf .example_field (0 )
331
+ f .coordinate ("X" ).del_bounds ()
332
+ f .coordinate ("Y" ).del_bounds ()
333
+
334
+ with self .assertRaisesRegex (
335
+ ValueError , "Can't create weights: Unable to find cell areas"
336
+ ):
337
+ f .weights ("area" )
338
+
329
339
330
340
if __name__ == "__main__" :
331
341
print ("Run date:" , datetime .datetime .now ())
You can’t perform that action at this time.
0 commit comments