From 900410c7bece4f0206571e7ed27ab62ce64991c5 Mon Sep 17 00:00:00 2001 From: EddyCMWF Date: Fri, 1 Dec 2023 14:48:53 +0000 Subject: [PATCH] refactoring module import --- earthkit/aggregate/__init__.py | 35 ++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/earthkit/aggregate/__init__.py b/earthkit/aggregate/__init__.py index ecd2945..b82b95c 100644 --- a/earthkit/aggregate/__init__.py +++ b/earthkit/aggregate/__init__.py @@ -20,6 +20,37 @@ # Local copy or not installed with setuptools __version__ = "999" -from earthkit import aggregate +from earthkit.aggregate import climatology, general, spatial, temporal -__all__ = [aggregate, __version__] +try: + from earthkit.data.utils.module_inputs_wrapper import ( + transform_function_inputs, + transform_module_inputs, + ) +except ImportError: + pass +else: + general = transform_module_inputs(general) + + temporal = transform_module_inputs(temporal) + + climatology = transform_module_inputs(climatology) + + spatial = transform_module_inputs(spatial) + +from earthkit.aggregate.general import reduce, resample, rolling_reduce + +reduce = transform_function_inputs(reduce) +rolling_reduce = transform_function_inputs(rolling_reduce) +resample = transform_function_inputs(resample) + +__all__ = [ + "__version__", + "general", + "temporal", + "climatology", + "spatial", + "reduce", + "resample", + "rolling_reduce", +]