Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -313,7 +313,7 @@ def make_nasa_soho_image_trigger():
|
|
| 313 |
html_in+="</div>"
|
| 314 |
return html_in
|
| 315 |
def count_days(date1,date2):
|
| 316 |
-
|
| 317 |
in_year=f"{date1[0:4]}"
|
| 318 |
in_month=f"{date1[4:6]}"
|
| 319 |
in_day=f"{date1[6:8]}"
|
|
@@ -323,25 +323,44 @@ def count_days(date1,date2):
|
|
| 323 |
end_day=f"{date2[6:8]}"
|
| 324 |
|
| 325 |
years_rem,months_rem,days_rem=(0,0,0)
|
|
|
|
| 326 |
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)
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
if i_end_year > i_in_year:
|
| 331 |
years_rem = i_end_year-i_in_year
|
| 332 |
if i_end_month > i_in_month:
|
| 333 |
months_rem = 12 - i_in_month
|
| 334 |
if i_end_day > i_in_day:
|
| 335 |
-
|
| 336 |
|
| 337 |
if years_rem > 0:
|
| 338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
if months_rem > 0:
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
|
| 346 |
|
| 347 |
def nasa_sdo_images(obj,size,date1,date2):
|
|
|
|
| 313 |
html_in+="</div>"
|
| 314 |
return html_in
|
| 315 |
def count_days(date1,date2):
|
| 316 |
+
url_box=[]
|
| 317 |
in_year=f"{date1[0:4]}"
|
| 318 |
in_month=f"{date1[4:6]}"
|
| 319 |
in_day=f"{date1[6:8]}"
|
|
|
|
| 323 |
end_day=f"{date2[6:8]}"
|
| 324 |
|
| 325 |
years_rem,months_rem,days_rem=(0,0,0)
|
| 326 |
+
og_days_rem=days_rem
|
| 327 |
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)
|
| 328 |
+
days_json={"year": 0, "month": 0, "day": 0}
|
|
|
|
|
|
|
| 329 |
if i_end_year > i_in_year:
|
| 330 |
years_rem = i_end_year-i_in_year
|
| 331 |
if i_end_month > i_in_month:
|
| 332 |
months_rem = 12 - i_in_month
|
| 333 |
if i_end_day > i_in_day:
|
| 334 |
+
og_days_rem = month_dict[in_month] - i_in_day
|
| 335 |
|
| 336 |
if years_rem > 0:
|
| 337 |
+
for ii in list(range(0,years_raw)):
|
| 338 |
+
months_rem+=years_rem*12
|
| 339 |
+
out_year = in_year+ii
|
| 340 |
+
for i in list(range(0,months_rem)):
|
| 341 |
+
month_day_cnt = month_dict[str(int(in_month)+i)]
|
| 342 |
+
for io in list(range(0,month_day_cnt)):
|
| 343 |
+
days_rem += month_day_cnt
|
| 344 |
+
out_url=f"https://sdo.gsfc.nasa.gov/assets/img/browse/{out_year}/{i}/{io}/"
|
| 345 |
+
print(out_url)
|
| 346 |
+
url_box.append(out_url)
|
| 347 |
+
months_raw = 0
|
| 348 |
if months_rem > 0:
|
| 349 |
+
out_year = in_year
|
| 350 |
+
for i in list(range(0,months_rem)):
|
| 351 |
+
month_day_cnt = month_dict[str(int(in_month)+i)]
|
| 352 |
+
for io in list(range(0,month_day_cnt)):
|
| 353 |
+
days_rem += month_day_cnt
|
| 354 |
+
out_url=f"https://sdo.gsfc.nasa.gov/assets/img/browse/{out_year}/{i}/{io}/"
|
| 355 |
+
print(out_url)
|
| 356 |
+
url_box.append(out_url)
|
| 357 |
+
|
| 358 |
+
if og_days_rem > 0:
|
| 359 |
+
for io in list(range(0,og_days_rem)):
|
| 360 |
+
days_rem += month_day_cnt
|
| 361 |
+
out_url=f"https://sdo.gsfc.nasa.gov/assets/img/browse/{out_year}/{}/{io}/"
|
| 362 |
+
print(out_url)
|
| 363 |
+
url_box.append(out_url)
|
| 364 |
|
| 365 |
|
| 366 |
def nasa_sdo_images(obj,size,date1,date2):
|