@@ -5,8 +5,12 @@ def wind_degree_to_direction(str_wind_degree):
5
5
"""
6
6
Convert wind degree to wind direction.
7
7
8
- :param str_wind_degree: str, Wind degree from API (0 to 360)
9
- :return: Wind direction as a string (e.g., N, NE, E, etc.)
8
+ Parameters:
9
+ str_wind_degree (str): Wind degree from API (0 to 360)
10
+
11
+ Returns:
12
+ str: Wind direction (e.g., N, NE, E, etc.)
13
+ Or message "API Wind Degree data format error!"
10
14
"""
11
15
# convert wind degree from str to int.
12
16
try :
@@ -26,9 +30,14 @@ def unix_timestamp_to_localtime(str_unix_timestamp, str_timezone_offset_seconds)
26
30
"""
27
31
Convert unix timestamp to localtime (for sunrise and sunset).
28
32
29
- :param str_unix_timestamp: str, Unix timestamp (e.g., "1717715516")
30
- :param str_timezone_offset_seconds: str, timezone offset in second (e.g., "28800" represents UTC+8)
31
- :return: local_time (e.g., "2024-06-07 07:11:56")
33
+ Parameters:
34
+ str_unix_timestamp (str): Unix timestamp (e.g., "1717715516")
35
+ str_timezone_offset_seconds (str): timezone offset in second (e.g., "28800" represents UTC+8)
36
+
37
+ Returns:
38
+ str: local_time (e.g., "2024-06-07 07:11:56")
39
+ Or message "API sunset/sunrise data format error!"
40
+ Or message "API timezone data format error!"
32
41
"""
33
42
# Convert strings to integers
34
43
try :
@@ -54,9 +63,14 @@ def convert_temperature(str_temperature_kelvin, temperature_unit):
54
63
"""
55
64
Convert temperature in Kelvin degree to Celsius degree or Fahrenheit degree based on second parameter .
56
65
57
- :param str_temperature_kelvin: str, temperature in Kelvin degree (e.g., "291.19")
58
- :param temperature_unit: str, "C" for Celsius, "F" for Fahrenheit
59
- :return: temperature (e.g., "21.07 °C" or "67.12 °F")
66
+ Parameters:
67
+ str_temperature_kelvin (str): temperature in Kelvin degree (e.g., "291.19")
68
+ temperature_unit (str): "C" for Celsius, "F" for Fahrenheit
69
+
70
+ Returns:
71
+ str: temperature (e.g., "21.07 °C" or "67.12 °F")
72
+ Or message "API temperature data format error!"
73
+ Or message "Temperature unit must either be 'C' or be 'F'!"
60
74
"""
61
75
# Convert strings to integers
62
76
try :
0 commit comments