diff options
author | Aki <please@ignore.pl> | 2022-09-08 18:40:56 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-09-08 18:40:56 +0200 |
commit | b5600cca811eabb5a731380d07f30ffabffe6ce1 (patch) | |
tree | cf983432f42379e9050b76500a0c679ff7aa4e11 /szilagyi/__init__.py | |
parent | 53ea2c8356f1d849f907343344c20b7a6c855ca7 (diff) | |
download | szilagyi-b5600cca811eabb5a731380d07f30ffabffe6ce1.zip szilagyi-b5600cca811eabb5a731380d07f30ffabffe6ce1.tar.gz szilagyi-b5600cca811eabb5a731380d07f30ffabffe6ce1.tar.bz2 |
Defined maximums for the nomogram in the nomogram module
Diffstat (limited to 'szilagyi/__init__.py')
-rw-r--r-- | szilagyi/__init__.py | 9 |
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) |