diff --git a/docs/conf.py b/docs/conf.py index 2dcb3b4..8557e0a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ import sys sys.path.insert(0, os.path.abspath("./")) -sys.path.insert(0, os.path.abspath("../")) +# sys.path.insert(0, os.path.abspath("../")) sys.path.append(os.path.abspath("./_ext")) # -- Project information ----------------------------------------------------- diff --git a/docs/skip_api_rules.py b/docs/skip_api_rules.py index ebe5d63..8ff4bb8 100644 --- a/docs/skip_api_rules.py +++ b/docs/skip_api_rules.py @@ -24,6 +24,8 @@ def _skip_api_items(app, what, name, obj, skip, options): skip = True elif what == "module" and len(name.split(".")) > 3: skip = True + elif "add_doc_from" in name: + skip = True # if not skip: # print(f"{what} {name}") diff --git a/src/earthkit/meteo/thermo/thermo.py b/src/earthkit/meteo/thermo/thermo.py index 3e0ec7b..7ba2c00 100644 --- a/src/earthkit/meteo/thermo/thermo.py +++ b/src/earthkit/meteo/thermo/thermo.py @@ -7,11 +7,14 @@ # nor does it submit to any jurisdiction. # +from earthkit.meteo.utils.docs import add_doc_from + from . import array -def celsius_to_kelvin(*args, **kwargs): - return array.celsius_to_kelvin(*args, **kwargs) +@add_doc_from(array.celsius_to_kelvin) +def celsius_to_kelvin(t): + return array.celsius_to_kelvin(t) def kelvin_to_celsius(*args, **kwargs): diff --git a/src/earthkit/meteo/utils/docs.py b/src/earthkit/meteo/utils/docs.py new file mode 100644 index 0000000..f9fcd5e --- /dev/null +++ b/src/earthkit/meteo/utils/docs.py @@ -0,0 +1,16 @@ +# (C) Copyright 2021 ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + + +def add_doc_from(func_with_doc): + def wrapped(func): + func.__doc__ = func_with_doc.__doc__ + return func + + return wrapped