Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,21 +17,21 @@ center_tol = 30
|
|
| 17 |
morph_dia = 5
|
| 18 |
min_rad = 70
|
| 19 |
|
| 20 |
-
def fetch_sdo_images(start_date, end_date, ident="
|
| 21 |
"""Fetch SDO images from NASA URL for a given date range."""
|
| 22 |
try:
|
| 23 |
start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
|
| 24 |
end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
|
| 25 |
if start > end:
|
| 26 |
return None, "Start date must be before end date."
|
| 27 |
-
|
| 28 |
-
base_url = "https://sdo.gsfc.nasa.gov/assets/img/browse/"
|
| 29 |
frames = []
|
| 30 |
current = start
|
| 31 |
while current <= end:
|
| 32 |
date_str = current.strftime("%Y%m%d_%H%M%S")
|
| 33 |
year, month, day = current.strftime("%Y"), current.strftime("%m"), current.strftime("%d")
|
| 34 |
-
url = urljoin(base_url, f"{
|
| 35 |
|
| 36 |
try:
|
| 37 |
response = requests.get(url, timeout=5)
|
|
|
|
| 17 |
morph_dia = 5
|
| 18 |
min_rad = 70
|
| 19 |
|
| 20 |
+
def fetch_sdo_images(start_date, end_date, ident="0745", size="1024", tool="ccor1"):
|
| 21 |
"""Fetch SDO images from NASA URL for a given date range."""
|
| 22 |
try:
|
| 23 |
start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
|
| 24 |
end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
|
| 25 |
if start > end:
|
| 26 |
return None, "Start date must be before end date."
|
| 27 |
+
base_url = "https://services.swpc.noaa.gov/images/animations/"
|
| 28 |
+
#base_url = "https://sdo.gsfc.nasa.gov/assets/img/browse/"
|
| 29 |
frames = []
|
| 30 |
current = start
|
| 31 |
while current <= end:
|
| 32 |
date_str = current.strftime("%Y%m%d_%H%M%S")
|
| 33 |
year, month, day = current.strftime("%Y"), current.strftime("%m"), current.strftime("%d")
|
| 34 |
+
url = urljoin(base_url, f"{tool}/{date_str}_{ident}_{tool}_{size}.jpg")
|
| 35 |
|
| 36 |
try:
|
| 37 |
response = requests.get(url, timeout=5)
|