Skip to content

Commit

Permalink
[FB] [PI-3478] Lenient metadata (SciTools#3739)
Browse files Browse the repository at this point in the history
* add lenient infra-structure

* add metadata lenient __eq__ support

* complete __eq__, combine and difference support

* explicit inherited lenient_service + support equal convenience

* fix attributes difference + lenient kwargs

* make lenient public + minor tidy

* rename MetadataManagerFactory to metadata_manager_factory

* extend lenient_client decorator to support services registration

* add lenient test coverage

* purge qualname usage in metadata.py

* support global enable for lenient services

* support partial mapping metadata assignment

* purge Lenient.__setattr__ from api

* add BaseMetadata compare test coverage

* metadata rationalisation

* add BaseMetadata difference test coverage

* added context manager ephemeral comment clarification

* add BaseMetadata __ne__ test coverage

* standardise lenient decorator closure names

* add BaseMetadata equal test coverage

* half dunder context

* add AncillaryVariableMetadata test coverage

* add additional AncillaryVariableMetadata test coverage

* add CellMeasureMetadata test coverage

* Clarify lenient_service operation + simplify code.

* add CoordMetadata test coverage

* add CubeMetadata test coverage

* metadata tests use self.cls

* fix typo

* fix context manager ephemeral services

* add logging

* Pin pillow to make graphics tests work again. (SciTools#3630)

* Fixed tests since Numpy 1.18 deprecation of non-int num arguments for linspace. (SciTools#3655)

* Switched use of datetime.weekday() to datetime.dayofwk. (SciTools#3687)

* New image hashes for mpl 3x2 (SciTools#3682)

* New image hash for iris.test.test_plot.TestSymbols.test_cloud_cover with matplotlib 3.2.0.

* Further images changes for mpl3x2.

* Yet more updated image results.

* fix sentinel uniqueness test failure

* remove redundant cdm mapping test

* difference returns None for no difference

* protect Lenient and LENIENT private

* privitise lenient framework and add API veneer

* add explicit maths feature default

* review actions

* review actions

* trexfeathers review actions

* stephenworsley review actions

Co-authored-by: Patrick Peglar <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
  • Loading branch information
3 people committed Aug 13, 2020
1 parent 6e581b4 commit 8392152
Show file tree
Hide file tree
Showing 23 changed files with 6,534 additions and 185 deletions.
22 changes: 13 additions & 9 deletions lib/iris/aux_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
import dask.array as da
import numpy as np

from iris.common import CFVariableMixin, CoordMetadata, MetadataManagerFactory
from iris.common import (
CFVariableMixin,
CoordMetadata,
metadata_manager_factory,
)
import iris.coords


Expand All @@ -35,7 +39,7 @@ class AuxCoordFactory(CFVariableMixin, metaclass=ABCMeta):
def __init__(self):
# Configure the metadata manager.
if not hasattr(self, "_metadata_manager"):
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)

#: Descriptive name of the coordinate made by the factory
self.long_name = None
Expand Down Expand Up @@ -385,7 +389,7 @@ def __init__(self, delta=None, sigma=None, orography=None):
"""
# Configure the metadata manager.
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)
super().__init__()

if delta and delta.nbounds not in (0, 2):
Expand Down Expand Up @@ -574,7 +578,7 @@ def __init__(self, delta=None, sigma=None, surface_air_pressure=None):
"""
# Configure the metadata manager.
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)
super().__init__()

# Check that provided coords meet necessary conditions.
Expand Down Expand Up @@ -779,7 +783,7 @@ def __init__(
"""
# Configure the metadata manager.
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)
super().__init__()

# Check that provided coordinates meet necessary conditions.
Expand Down Expand Up @@ -1080,7 +1084,7 @@ def __init__(self, sigma=None, eta=None, depth=None):
"""
# Configure the metadata manager.
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)
super().__init__()

# Check that provided coordinates meet necessary conditions.
Expand Down Expand Up @@ -1263,7 +1267,7 @@ def __init__(self, s=None, c=None, eta=None, depth=None, depth_c=None):
"""
# Configure the metadata manager.
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)
super().__init__()

# Check that provided coordinates meet necessary conditions.
Expand Down Expand Up @@ -1486,7 +1490,7 @@ def __init__(
"""
# Configure the metadata manager.
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)
super().__init__()

# Check that provided coordinates meet necessary conditions.
Expand Down Expand Up @@ -1704,7 +1708,7 @@ def __init__(self, s=None, c=None, eta=None, depth=None, depth_c=None):
"""
# Configure the metadata manager.
self._metadata_manager = MetadataManagerFactory(CoordMetadata)
self._metadata_manager = metadata_manager_factory(CoordMetadata)
super().__init__()

# Check that provided coordinates meet necessary conditions.
Expand Down
1 change: 1 addition & 0 deletions lib/iris/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
# licensing details.


from .lenient import *
from .metadata import *
from .mixin import *
Loading

0 comments on commit 8392152

Please sign in to comment.