summaryrefslogtreecommitdiff
path: root/szilagyi/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'szilagyi/__init__.py')
-rw-r--r--szilagyi/__init__.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/szilagyi/__init__.py b/szilagyi/__init__.py
index 426abe4..6281a95 100644
--- a/szilagyi/__init__.py
+++ b/szilagyi/__init__.py
@@ -13,6 +13,7 @@ There is only one function provided, so the use should be straight-forward. For
"""
from ._nomogram import calculate_swi as _calculate_swi
+from ._nomogram import MAX_TEMPERATURE_DIFFERENCE, MAX_CONVECTIVE_CLOUD_DEPTH
def calculate_swi(temperature_difference, convective_cloud_depth):
@@ -22,8 +23,8 @@ def calculate_swi(temperature_difference, convective_cloud_depth):
May raise :exc:`ValueError` if the values are not in range of the original nomogram.
"""
- if temperature_difference < 0 or temperature_difference > 40:
- raise ValueError("temperature_difference must be within <0, 40> range")
- if convective_cloud_depth < 0 or convective_cloud_depth > 50000:
- raise ValueError("convective_cloud_depth must be within <0, 50000> range")
+ if temperature_difference < 0 or temperature_difference > MAX_TEMPERATURE_DIFFERENCE:
+ raise ValueError(f"temperature_difference must be within <0, {MAX_TEMPERATURE_DIFFERENCE}> range")
+ if convective_cloud_depth < 0 or convective_cloud_depth > MAX_CONVECTIVE_CLOUD_DEPTH:
+ raise ValueError(f"convective_cloud_depth must be within <0, {MAX_CONVECTIVE_CLOUD_DEPTH}> range")
return _calculate_swi(temperature_difference, convective_cloud_depth)