Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -43,14 +43,14 @@ class EnhancedOceanClimateAgent:
|
|
43 |
'units': units,
|
44 |
'format': 'json'
|
45 |
}
|
46 |
-
|
47 |
try:
|
48 |
print(f"π‘ Requesting {product} data for station {station_id}")
|
49 |
print("π Date range:", start_date.strftime('%Y-%m-%d'), "to", end_date.strftime('%Y-%m-%d'))
|
|
|
50 |
response = requests.get(self.noaa_base_url, params=params, timeout=30)
|
51 |
-
|
52 |
print(f"π Status code: {response.status_code}")
|
53 |
-
|
54 |
if response.status_code == 200:
|
55 |
data = response.json()
|
56 |
if 'data' in data:
|
@@ -62,8 +62,12 @@ class EnhancedOceanClimateAgent:
|
|
62 |
print(f"β Unknown response structure: {data}")
|
63 |
else:
|
64 |
print(f"β API HTTP error {response.status_code}: {response.text}")
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
|
68 |
def get_comprehensive_station_data(self, station_name, days_back=30):
|
69 |
"""Get comprehensive data from a NOAA station"""
|
|
|
43 |
'units': units,
|
44 |
'format': 'json'
|
45 |
}
|
46 |
+
|
47 |
try:
|
48 |
print(f"π‘ Requesting {product} data for station {station_id}")
|
49 |
print("π Date range:", start_date.strftime('%Y-%m-%d'), "to", end_date.strftime('%Y-%m-%d'))
|
50 |
+
|
51 |
response = requests.get(self.noaa_base_url, params=params, timeout=30)
|
|
|
52 |
print(f"π Status code: {response.status_code}")
|
53 |
+
|
54 |
if response.status_code == 200:
|
55 |
data = response.json()
|
56 |
if 'data' in data:
|
|
|
62 |
print(f"β Unknown response structure: {data}")
|
63 |
else:
|
64 |
print(f"β API HTTP error {response.status_code}: {response.text}")
|
65 |
+
|
66 |
+
except Exception as e:
|
67 |
+
print(f"β Request failed for {product}: {str(e)}")
|
68 |
+
|
69 |
+
return None
|
70 |
+
|
71 |
|
72 |
def get_comprehensive_station_data(self, station_name, days_back=30):
|
73 |
"""Get comprehensive data from a NOAA station"""
|