summaryrefslogtreecommitdiff
path: root/szilagyi/__init__.py
blob: 426abe4f601ced1ee7e3fc0b6642c836b55687a6 (plain)
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
"""
This package provides a software implementation of an approximation of the Szilagyi Waterspout Index. The calculated
values for SWI are continuous. The wind-speed at 850 hPa is ignored as the nomogram dictates it as a simple on/off
criterion.

There is only one function provided, so the use should be straight-forward. For example::

	>>> import szilagyi
	>>> round(szilagyi.calculate_swi(10.5, 24100), 3)
	0.811
	>>> round(szilagyi.calculate_swi(7, 12500), 3)
	-4.88
"""

from ._nomogram import calculate_swi as _calculate_swi


def calculate_swi(temperature_difference, convective_cloud_depth):
	"""
	Calculates the Szilagyi Waterspout Index for *temperature_difference* and *convective_cloud_depth*. These are
	expected to be respectively: Celsius degrees, and feet.

	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")
	return _calculate_swi(temperature_difference, convective_cloud_depth)