Skip to content

Commit 2ebe7b8

Browse files
committed
dev
1 parent 075dba9 commit 2ebe7b8

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

cf/field.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3507,7 +3507,7 @@ def weights(
35073507
domain_axes = self.domain_axes(todict=True)
35083508

35093509
for da_key in domain_axes:
3510-
if Weights.geometry_area(
3510+
if Weights.polygon_area(
35113511
self,
35123512
da_key,
35133513
comp,
@@ -3520,7 +3520,7 @@ def weights(
35203520
):
35213521
# Found area weights from polygon geometries
35223522
pass
3523-
elif Weights.geometry_line(
3523+
elif Weights.line_length(
35243524
self,
35253525
da_key,
35263526
comp,
@@ -3690,7 +3690,7 @@ def weights(
36903690
pass
36913691
else:
36923692
# Found area weights from UGRID/geometry cells
3693-
Weights.geometry_area(
3693+
Weights.polygon_area(
36943694
self,
36953695
None,
36963696
comp,
@@ -3710,7 +3710,7 @@ def weights(
37103710
f"{axis!r}"
37113711
)
37123712

3713-
if Weights.geometry_area(
3713+
if Weights.polygon_area(
37143714
self,
37153715
da_key,
37163716
comp,
@@ -3723,7 +3723,7 @@ def weights(
37233723
):
37243724
# Found area weights from polygon geometries
37253725
pass
3726-
elif Weights.geometry_line(
3726+
elif Weights.line_length(
37273727
self,
37283728
da_key,
37293729
comp,

cf/weights.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def field_scalar(cls, f, methods=False):
422422
return f
423423

424424
@classmethod
425-
def geometry_area(
425+
def polygon_area(
426426
cls,
427427
f,
428428
domain_axis,
@@ -478,7 +478,7 @@ def geometry_area(
478478

479479
from .units import Units
480480

481-
axis, aux_X, aux_Y, aux_Z = cls.yyy(
481+
axis, aux_X, aux_Y, aux_Z = cls._geometry_cells(
482482
f, domain_axis, "polygon", methods=methods, auto=auto
483483
)
484484

@@ -585,7 +585,7 @@ def geometry_area(
585585

586586
col0 = cols.item(0)
587587
equal_nodes = (cols == col0).all()
588-
if equal_nodes:
588+
if equal_nodes:
589589
# All polygons have the same number of nodes, so we can
590590
# use an integer and a slice in place of two integer
591591
# arrays, which is much faster.
@@ -756,7 +756,7 @@ def geometry_area(
756756
return True
757757

758758
@classmethod
759-
def geometry_line(
759+
def line_length(
760760
cls,
761761
f,
762762
domain_axis,
@@ -807,7 +807,7 @@ def geometry_line(
807807
"""
808808
from .units import Units
809809

810-
axis, aux_X, aux_Y, aux_Z = cls.yyy(
810+
axis, aux_X, aux_Y, aux_Z = cls._geometry_cells(
811811
f, domain_axis, "line", methods=methods, auto=auto
812812
)
813813

@@ -945,7 +945,7 @@ def geometry_volume(
945945
"""
946946
from .units import Units
947947

948-
axis, aux_X, aux_Y, aux_Z = cls.yyy(
948+
axis, aux_X, aux_Y, aux_Z = cls._geometry_cells(
949949
f, "polygon", methods=methods, auto=auto
950950
)
951951

@@ -979,7 +979,7 @@ def geometry_volume(
979979

980980
if not methods:
981981
# Initialise cell volumes as the cell areas
982-
areas = cls.geometry_area(
982+
areas = cls.polygon_area(
983983
f,
984984
weights,
985985
weights_axes,
@@ -1431,7 +1431,9 @@ def scale(cls, w, scale):
14311431
return w
14321432

14331433
@classmethod
1434-
def yyy(cls, f, domain_axis, geometry_type, methods=False, auto=False):
1434+
def _geometry_cells(
1435+
cls, f, domain_axis, geometry_type, methods=False, auto=False
1436+
):
14351437
"""Checks whether weights can be created for given coordinates.
14361438
14371439
.. versionadded:: UGRIDVER
@@ -1463,8 +1465,10 @@ def yyy(cls, f, domain_axis, geometry_type, methods=False, auto=False):
14631465

14641466
for key, aux in auxiliary_coordinates_1d.items():
14651467
aux_axis = f.get_data_axes(key)[0]
1466-
dt = f.domain_topology(default=None, filter_by_axis=(aux_axis,))
1467-
if dt is None and aux.get_geometry(None) != geometry_type:
1468+
topology = f.domain_topology(
1469+
default=None, filter_by_axis=(aux_axis,)
1470+
)
1471+
if topology is None and aux.get_geometry(None) != geometry_type:
14681472
continue
14691473

14701474
# Still here? Then this auxiliary coordinate has either UGRID

0 commit comments

Comments
 (0)