forked from MHKiT-Software/MHKiT-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
51 lines (41 loc) · 1.5 KB
/
__init__.py
File metadata and controls
51 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import warnings as _warn
import importlib
# Register datetime converter for a matplotlib plotting methods
from pandas.plotting import register_matplotlib_converters as _rmc
_rmc()
# Ignore future warnings
_warn.simplefilter(action="ignore", category=FutureWarning)
__version__ = "v0.9.0"
__copyright__ = """
Copyright 2019, Alliance for Sustainable Energy, LLC under the terms of
Contract DE-AC36-08GO28308, Battelle Memorial Institute under the terms of
Contract DE-AC05-76RL01830, and National Technology & Engineering Solutions of
Sandia, LLC under the terms of Contract DE-NA0003525. The U.S. Government
retains certain rights in this software."""
__license__ = "Revised BSD License"
def __getattr__(name):
"""Lazy import modules to handle pip optional dependencies."""
known_modules = [
"wave",
"river",
"tidal",
"qc",
"utils",
"power",
"loads",
"dolfyn",
"mooring",
"acoustics",
]
if name in known_modules:
try:
return importlib.import_module(f"mhkit.{name}")
except ModuleNotFoundError:
error_msg = "Module dependencies not found.\n"
error_msg += f"To install the {name} module, run:\n"
error_msg += f" pip install mhkit[{name}]\n\n"
error_msg += "Or install all modules with:\n"
error_msg += " pip install mhkit[all]"
else:
error_msg = f"module 'mhkit' has no attribute '{name}'"
raise AttributeError(error_msg)