-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvironmental_data_analysis.py
More file actions
27 lines (23 loc) · 954 Bytes
/
environmental_data_analysis.py
File metadata and controls
27 lines (23 loc) · 954 Bytes
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
import random
import datetime
# Simulate environmental data collection
def collect_environmental_data():
"""Simulate collecting environmental data from sensors."""
data = {
'timestamp': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
'air_quality': random.randint(0, 500),
'water_quality': round(random.uniform(6.5, 9.0), 2),
'temperature': round(random.uniform(15, 35), 1),
'humidity': random.randint(30, 90)
}
return data
def analyze_data(data):
"""Basic analysis of collected environmental data."""
print(f"Data collected at {data['timestamp']}")
print(f"Air Quality Index: {data['air_quality']} (0-500)")
print(f"Water Quality pH Level: {data['water_quality']} (6.5-9.0 is safe)")
print(f"Temperature: {data['temperature']}°C")
print(f"Humidity: {data['humidity']}%")
if __name__ == "__main__":
data = collect_environmental_data()
analyze_data(data)