Spaces:
Runtime error
Runtime error
Update functions.py
Browse files- functions.py +10 -0
functions.py
CHANGED
|
@@ -93,6 +93,16 @@ def encoder_range(temps):
|
|
| 93 |
redf = np.logical_not(temps<=boundary_list)
|
| 94 |
hift = np.concatenate((np.roll(redf, -1)[:, :-1], np.full((temps.shape[0], 1), False)), axis = 1)
|
| 95 |
cat = np.nonzero(np.not_equal(redf,hift))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
air_pollution_level = ['Good', 'Moderate', 'Unhealthy for sensitive Groups','Unhealthy' ,'Very Unhealthy', 'Hazardous']
|
| 97 |
level = [air_pollution_level[el] for el in cat[1]]
|
| 98 |
return level
|
|
|
|
| 93 |
redf = np.logical_not(temps<=boundary_list)
|
| 94 |
hift = np.concatenate((np.roll(redf, -1)[:, :-1], np.full((temps.shape[0], 1), False)), axis = 1)
|
| 95 |
cat = np.nonzero(np.not_equal(redf,hift))
|
| 96 |
+
air_pollution_level = ['Good', 'Moderate', 'Unhealthy for sensitive Groups','Unhealthy' ,'Very Unhealthy', 'Hazardous']
|
| 97 |
+
level = [air_pollution_level[el] for el in cat[1]]
|
| 98 |
+
return level
|
| 99 |
+
|
| 100 |
+
def get_aplevel(temps:np.ndarray) -> list:
|
| 101 |
+
boundary_list = np.array([0, 50, 100, 150, 200, 300]) # assert temps.shape == [x, 1]
|
| 102 |
+
redf = np.logical_not(temps<=boundary_list) # temps.shape[0] x boundary_list.shape[0] ndarray
|
| 103 |
+
hift = np.concatenate((np.roll(redf, -1)[:, :-1], np.full((temps.shape[0], 1), False)), axis = 1)
|
| 104 |
+
cat = np.nonzero(np.not_equal(redf,hift))
|
| 105 |
+
|
| 106 |
air_pollution_level = ['Good', 'Moderate', 'Unhealthy for sensitive Groups','Unhealthy' ,'Very Unhealthy', 'Hazardous']
|
| 107 |
level = [air_pollution_level[el] for el in cat[1]]
|
| 108 |
return level
|