Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -375,36 +375,45 @@ def nasa_sdo_images(obj,size,date1,date2):
|
|
| 375 |
end_year=f"{date2[0:4]}"
|
| 376 |
end_month=f"{date2[4:6]}"
|
| 377 |
end_day=f"{date2[6:8]}"
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
if end_day > in_day:
|
| 390 |
-
day_dif = end_day-in_day
|
| 391 |
-
|
| 392 |
-
if end_month > in_month:
|
| 393 |
-
month_dif = end_month-in_month
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
|
| 409 |
file_name="DATE_TIME_SIZE_TOOL.jpg"
|
| 410 |
sdo_source_format = f"https://sdo.gsfc.nasa.gov/assets/img/browse/{in_year}/{in_month}/{in_day}/"
|
|
|
|
| 375 |
end_year=f"{date2[0:4]}"
|
| 376 |
end_month=f"{date2[4:6]}"
|
| 377 |
end_day=f"{date2[6:8]}"
|
| 378 |
+
years_rem,months_rem,days_rem=(0,0,0)
|
| 379 |
+
og_days_rem=days_rem
|
| 380 |
+
i_in_year,i_in_month,i_in_day,i_end_year,i_end_month,i_end_day=int(in_year),int(in_month),int(in_day),int(end_year),int(end_month),int(end_day)
|
| 381 |
+
days_json={"year": 0, "month": 0, "day": 0}
|
| 382 |
+
if i_end_year > i_in_year:
|
| 383 |
+
years_rem = i_end_year-i_in_year
|
| 384 |
+
if i_end_month > i_in_month:
|
| 385 |
+
months_rem = 12 - i_in_month
|
| 386 |
+
if i_end_day > i_in_day:
|
| 387 |
+
og_days_rem = month_dict[in_month] - i_in_day
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
|
| 389 |
+
if years_rem > 0:
|
| 390 |
+
for ii in list(range(0,years_raw)):
|
| 391 |
+
months_rem+=years_rem*12
|
| 392 |
+
out_year = in_year+ii
|
| 393 |
+
for i in list(range(0,months_rem)):
|
| 394 |
+
month_day_cnt = month_dict[str(int(in_month)+i)]
|
| 395 |
+
for io in list(range(0,month_day_cnt)):
|
| 396 |
+
days_rem += month_day_cnt
|
| 397 |
+
out_url=f"https://sdo.gsfc.nasa.gov/assets/img/browse/{out_year}/{i}/{io}/"
|
| 398 |
+
print(out_url)
|
| 399 |
+
url_box.append(out_url)
|
| 400 |
+
months_raw = 0
|
| 401 |
+
if months_rem > 0:
|
| 402 |
+
out_year = in_year
|
| 403 |
+
for i in list(range(0,months_rem)):
|
| 404 |
+
month_day_cnt = month_dict[str(int(in_month)+i)]
|
| 405 |
+
for io in list(range(0,month_day_cnt)):
|
| 406 |
+
days_rem += month_day_cnt
|
| 407 |
+
out_url=f"https://sdo.gsfc.nasa.gov/assets/img/browse/{out_year}/{i}/{io}/"
|
| 408 |
+
print(out_url)
|
| 409 |
+
url_box.append(out_url)
|
| 410 |
+
og_days_rem=0
|
| 411 |
+
if og_days_rem > 0:
|
| 412 |
+
for io in list(range(0,og_days_rem)):
|
| 413 |
+
days_rem += month_day_cnt
|
| 414 |
+
out_url=f"https://sdo.gsfc.nasa.gov/assets/img/browse/{end_year}/{end_month}/{io}/"
|
| 415 |
+
print(out_url)
|
| 416 |
+
url_box.append(out_url)
|
| 417 |
|
| 418 |
file_name="DATE_TIME_SIZE_TOOL.jpg"
|
| 419 |
sdo_source_format = f"https://sdo.gsfc.nasa.gov/assets/img/browse/{in_year}/{in_month}/{in_day}/"
|