Skip to content

Commit 054b272

Browse files
committed
dev
1 parent 7ce67d2 commit 054b272

13 files changed

+45
-340
lines changed

cf/aggregate.py

Lines changed: 25 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,44 +1423,21 @@ def canonical_cell_methods(self, rtol=None, atol=None):
14231423

14241424
return cms
14251425

1426-
# def cell_measure_has_data_and_units(self, msr):
1427-
# """True only if a cell measure has both data and units.
1428-
#
1429-
# :Parameters:
1430-
#
1431-
# msr: `CellMeasure`
1432-
#
1433-
# :Returns:
1434-
#
1435-
# `bool`
1436-
#
1437-
# """
1438-
# if not msr.Units:
1439-
# if self.info:
1440-
# self.message = f"{msr.identity()!r} cell measure has no units"
1441-
#
1442-
# return False
1443-
#
1444-
# if not msr.has_data():
1445-
# if self.info:
1446-
# self.message = f"{msr.identity()!r} cell measure has no data"
1447-
#
1448-
# return False
1449-
#
1450-
# return True
1451-
14521426
def has_cell(self, topology):
1453-
"""True only if a domain topology has a cell type.
1427+
"""Whether a domain topology construct has a connectivity type.
14541428
14551429
.. versionadded:: UGRIDVER
14561430
14571431
:Parameters:
14581432
14591433
topology: `DomainTopology`
1434+
The construct to test.
14601435
14611436
:Returns:
14621437
14631438
`bool`
1439+
`True` if the construct has a cell type, otherwise
1440+
`False`.
14641441
14651442
"""
14661443
if topology.get_cell(None) is None:
@@ -1475,17 +1452,20 @@ def has_cell(self, topology):
14751452
return True
14761453

14771454
def has_connectivity(self, connectivity):
1478-
"""True only if a cell connectivity has a connectivit0y type.
1455+
"""Whether a cell connectivity construct has a connectivity type.
14791456
14801457
.. versionadded:: UGRIDVER
14811458
14821459
:Parameters:
14831460
14841461
connectivity: `CellConnectivity`
1462+
The construct to test.
14851463
14861464
:Returns:
14871465
14881466
`bool`
1467+
`True` if the construct has a connectivity type,
1468+
otherwise `False`.
14891469
14901470
"""
14911471
if connectivity.get_connectivity(None) is None:
@@ -1500,17 +1480,20 @@ def has_connectivity(self, connectivity):
15001480
return True
15011481

15021482
def has_measure(self, msr):
1503-
"""True only if a cell measure has a measure.
1483+
"""Whether a cell measure construct has a measure.
15041484
15051485
.. versionadded:: UGRIDVER
15061486
15071487
:Parameters:
15081488
15091489
msr: `CellMeasure`
1490+
The construct to test.
15101491
15111492
:Returns:
15121493
15131494
`bool`
1495+
`True` if the construct has a measure, otherwise
1496+
`False`.
15141497
15151498
"""
15161499
if msr.get_measure(None) is None:
@@ -1525,7 +1508,7 @@ def has_measure(self, msr):
15251508
return True
15261509

15271510
def has_units(self, construct):
1528-
"""True only if a construct has units.
1511+
"""Whether a construct has units.
15291512
15301513
.. versionadded:: UGRIDVER
15311514
@@ -1537,15 +1520,16 @@ def has_units(self, construct):
15371520
:Returns:
15381521
15391522
`bool`
1523+
`True` if the construct has units, otherwise `False`.
15401524
15411525
"""
15421526
if not construct.Units:
15431527
if self.info:
15441528
construct_type = construct.construct_type
1545-
construct_type.replace("_", " ")
15461529
self.message = (
15471530
f"{construct.identity()!r} "
1548-
f"{construct_type} construct has no units"
1531+
f"{construct_type.replace('_', ' ')} construct "
1532+
"has no units"
15491533
)
15501534

15511535
return False
@@ -1567,8 +1551,8 @@ def coord_has_identity_and_data(self, coord, axes=None):
15671551
:Returns:
15681552
15691553
`str` or `None`
1570-
The coordinate construct's identity, or `None` if there is
1571-
no identity and/or no data.
1554+
The coordinate construct's identity, or `None` if
1555+
there is no identity and/or no data.
15721556
15731557
"""
15741558
identity = coord.identity(
@@ -1598,7 +1582,7 @@ def coord_has_identity_and_data(self, coord, axes=None):
15981582
self.message = f"{coord!r} has no identity or no data"
15991583

16001584
def has_data(self, construct):
1601-
"""True only if a construct has data.
1585+
"""Whether a construct has data.
16021586
16031587
.. versionadded:: UGRIDVER
16041588
@@ -1610,62 +1594,21 @@ def has_data(self, construct):
16101594
:Returns:
16111595
16121596
`bool`
1597+
`True` if the construct has data, otherwise `False`.
16131598
16141599
"""
16151600
if not construct.has_data():
16161601
if self.info:
16171602
construct_type = construct.construct_type
1618-
construct_type.replace("_", " ")
16191603
self.message = (
1620-
f"{construct.identity()!r} {construct_type} has no data"
1604+
f"{construct.identity()!r} "
1605+
f"{construct_type.replace('_', ' ')} has no data"
16211606
)
16221607

16231608
return False
16241609

16251610
return True
16261611

1627-
# def field_ancillary_has_identity_and_data(self, anc):
1628-
# """Return a field ancillary's identity if it has one and has
1629-
# data.
1630-
#
1631-
# :Parameters:
1632-
#
1633-
# coord: `FieldAncillary`
1634-
#
1635-
# :Returns:
1636-
#
1637-
# `str` or `None`
1638-
# The coordinate construct's identity, or `None` if
1639-
# there is no identity and/or no data.
1640-
#
1641-
# """
1642-
# identity = anc.identity(
1643-
# strict=self.strict_identities,
1644-
# relaxed=self.relaxed_identities and not self.ncvar_identities,
1645-
# nc_only=self.ncvar_identities,
1646-
# default=None,
1647-
# )
1648-
#
1649-
# if identity is not None:
1650-
# all_field_anc_identities = self.all_field_anc_identities
1651-
#
1652-
# if identity in all_field_anc_identities:
1653-
# if self.info:
1654-
# self.message = f"multiple {identity!r} field ancillaries"
1655-
#
1656-
# return
1657-
#
1658-
# if anc.has_data():
1659-
# all_field_anc_identities.add(identity)
1660-
# return identity
1661-
#
1662-
# # Still here?
1663-
# if self.info:
1664-
# self.message = (
1665-
# f"{anc.identity()!r} field ancillary has no identity or "
1666-
# "no data"
1667-
# )
1668-
16691612
def coordinate_reference_signatures(self, refs):
16701613
"""List the structural signatures of given coordinate
16711614
references.
@@ -1720,7 +1663,7 @@ def get_identity(self, construct, identity=None):
17201663
:Returns:
17211664
17221665
`str` or `None`
1723-
The construct identity, or None if there isn't one.
1666+
The construct identity, or `None` if there isn't one.
17241667
17251668
"""
17261669
if identity is not None:
@@ -1736,10 +1679,9 @@ def get_identity(self, construct, identity=None):
17361679
construct_type = construct.construct_type
17371680
if construct_identity is None:
17381681
if self.info:
1739-
construct_type.replace("_", " ")
17401682
self.message = (
17411683
f"{construct.identity()!r} "
1742-
f"{construct_type} has no identity"
1684+
f"{construct_type.replace('_', ' ')} has no identity"
17431685
)
17441686

17451687
return
@@ -1748,10 +1690,9 @@ def get_identity(self, construct, identity=None):
17481690
if all_identities is not None:
17491691
if construct_identity in all_identities:
17501692
if self.info:
1751-
construct_type.replace("_", " ")
17521693
self.message = (
17531694
f"multiple {construct.identity()!r} "
1754-
f"{construct_type} constructs"
1695+
f"{construct_type.replace('_', ' ')} constructs"
17551696
)
17561697

17571698
return
@@ -1760,62 +1701,6 @@ def get_identity(self, construct, identity=None):
17601701

17611702
return construct_identity
17621703

1763-
# def domain_ancillary_has_identity_and_data(self, anc, identity=None):
1764-
# """Return a domain ancillary's identity if it has one and has
1765-
# data.
1766-
#
1767-
# :Parameters:
1768-
#
1769-
# anc: cf.DomainAncillary
1770-
#
1771-
# identity: optional
1772-
#
1773-
# :Returns:
1774-
#
1775-
# `str` or `None`
1776-
# The domain ancillary identity, or None if there is no
1777-
# identity and/or no data.
1778-
#
1779-
# """
1780-
# if identity is not None:
1781-
# anc_identity = identity
1782-
# else:
1783-
# anc_identity = anc.identity(
1784-
# strict=self.strict_identities,
1785-
# relaxed=self.relaxed_identities and not self.ncvar_identities,
1786-
# nc_only=self.ncvar_identities,
1787-
# default=None,
1788-
# )
1789-
#
1790-
# if anc_identity is None:
1791-
# if self.info:
1792-
# self.message = (
1793-
# f"{anc.identity()!r} domain ancillary has no identity"
1794-
# )
1795-
#
1796-
# return
1797-
#
1798-
# all_domain_anc_identities = self.all_domain_anc_identities
1799-
#
1800-
# if anc_identity in all_domain_anc_identities:
1801-
# if self.info:
1802-
# self.message = (
1803-
# f"multiple {anc.identity()!r} domain ancillaries"
1804-
# )
1805-
# return
1806-
#
1807-
# if not anc.has_data():
1808-
# if self.info:
1809-
# self.message = (
1810-
# f"{anc.identity()!r} domain ancillary has no data"
1811-
# )
1812-
#
1813-
# return
1814-
#
1815-
# all_domain_anc_identities.add(anc_identity)
1816-
#
1817-
# return anc_identity
1818-
18191704
@_manage_log_level_via_verbose_attr
18201705
def print_info(self, signature=True):
18211706
"""Log information on the structural signature and coordinate
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import cfdm
22

33
from ...mixin_container import Container
4-
from .mixin import ArrayMixin, CompressedArrayMixin # , MeshArrayMixin
4+
from .mixin import ArrayMixin, CompressedArrayMixin
55

66

77
class BoundsFromNodesArray(
8-
# MeshArrayMixin,
98
CompressedArrayMixin,
109
ArrayMixin,
1110
Container,
@@ -22,13 +21,3 @@ class BoundsFromNodesArray(
2221
.. versionadded:: UGRIDVER
2322
2423
"""
25-
26-
def __repr__(self):
27-
"""Called by the `repr` built-in function.
28-
29-
x.__repr__() <==> repr(x)
30-
31-
.. versionadded:: UGRIDVER
32-
33-
"""
34-
return super().__repr__().replace("<", "<CF ", 1)
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import cfdm
22

33
from ...mixin_container import Container
4-
from .mixin import ArrayMixin, CompressedArrayMixin # , MeshArrayMixin
4+
from .mixin import ArrayMixin, CompressedArrayMixin
55

66

77
class CellConnectivityArray(
8-
# MeshArrayMixin,
98
CompressedArrayMixin,
109
ArrayMixin,
1110
Container,
@@ -24,13 +23,3 @@ class CellConnectivityArray(
2423
.. versionadded:: UGRIDVER
2524
2625
"""
27-
28-
def __repr__(self):
29-
"""Called by the `repr` built-in function.
30-
31-
x.__repr__() <==> repr(x)
32-
33-
.. versionadded:: UGRIDVER
34-
35-
"""
36-
return super().__repr__().replace("<", "<CF ", 1)

0 commit comments

Comments
 (0)