Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,6 +76,7 @@ sdo_obj = ["HMIB","HMIBC","HMIIC","HMIIF","HMID","HMII","HMI171",
|
|
| 76 |
"211193171","211193171n","211193171rg",
|
| 77 |
"094335193","304211171"]
|
| 78 |
sdo_size= [256,512,1024,2048,4096]
|
|
|
|
| 79 |
html = """
|
| 80 |
<div>
|
| 81 |
PAGE_LINK
|
|
@@ -311,15 +312,81 @@ def make_nasa_soho_image_trigger():
|
|
| 311 |
#html_in+= make_nasa_soho_videos()
|
| 312 |
html_in+="</div>"
|
| 313 |
return html_in
|
|
|
|
| 314 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
def nasa_sdo_images(obj,size,date1,date2):
|
| 316 |
html_in=f"<style>{css}</style><div class='img_box_soho'>"
|
|
|
|
| 317 |
#if int(date2[6:8])-int(date1[6:8]) >0:
|
| 318 |
# return ("<div style='font-size:xxx-large'>Reduce Timespan to 24 hours</div>")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
file_name="DATE_TIME_SIZE_TOOL.jpg"
|
| 324 |
sdo_source_format = f"https://sdo.gsfc.nasa.gov/assets/img/browse/{in_year}/{in_month}/{in_day}/"
|
| 325 |
get_url=sdo_source_format
|
|
|
|
| 76 |
"211193171","211193171n","211193171rg",
|
| 77 |
"094335193","304211171"]
|
| 78 |
sdo_size= [256,512,1024,2048,4096]
|
| 79 |
+
month_dict={"1":31,"2":28,"3":31,"4":30,"5":31,"6":30,"7":31,"8":31,"9":30,"10":31,"11":30,"12":31}
|
| 80 |
html = """
|
| 81 |
<div>
|
| 82 |
PAGE_LINK
|
|
|
|
| 312 |
#html_in+= make_nasa_soho_videos()
|
| 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]}"
|
| 320 |
+
|
| 321 |
+
end_year=f"{date2[0:4]}"
|
| 322 |
+
end_month=f"{date2[4:6]}"
|
| 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 |
+
days_rem = month_dict[in_month] - i_in_day
|
| 336 |
+
|
| 337 |
+
if years_rem > 0:
|
| 338 |
+
months_rem+=years_rem*12
|
| 339 |
+
if months_rem > 0:
|
| 340 |
+
for i in list(range(0,months_rem):
|
| 341 |
+
days_rem += month_dict[str(int(in_month)+i)] - i_in_day
|
| 342 |
+
|
| 343 |
+
if days_rem > 0:
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
|
| 347 |
def nasa_sdo_images(obj,size,date1,date2):
|
| 348 |
html_in=f"<style>{css}</style><div class='img_box_soho'>"
|
| 349 |
+
print(date1 + " - " + date2)
|
| 350 |
#if int(date2[6:8])-int(date1[6:8]) >0:
|
| 351 |
# return ("<div style='font-size:xxx-large'>Reduce Timespan to 24 hours</div>")
|
| 352 |
+
in_year=f"{date1[0:4]}"
|
| 353 |
+
in_month=f"{date1[4:6]}"
|
| 354 |
+
in_day=f"{date1[6:8]}"
|
| 355 |
+
|
| 356 |
+
end_year=f"{date2[0:4]}"
|
| 357 |
+
end_month=f"{date2[4:6]}"
|
| 358 |
+
end_day=f"{date2[6:8]}"
|
| 359 |
+
url_box=[]
|
| 360 |
+
year_dif,month_dif,day_dif=(0,0,0)
|
| 361 |
+
month_sum = 0
|
| 362 |
+
if end_year > in_year:
|
| 363 |
+
year_dif = end_year-in_year
|
| 364 |
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
mo_count = year_dif*12
|
| 369 |
+
|
| 370 |
+
if end_day > in_day:
|
| 371 |
+
day_dif = end_day-in_day
|
| 372 |
+
|
| 373 |
+
if end_month > in_month:
|
| 374 |
+
month_dif = end_month-in_month
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
print(year_dif + " " + month_dif + " " + day_dif)
|
| 385 |
+
|
| 386 |
+
for ye in range(0, year_dif):
|
| 387 |
+
for mo in range(0, month_dif)
|
| 388 |
+
url_box.append(f"https://sdo.gsfc.nasa.gov/assets/img/browse/{in_year+ye}/{in_month}/{in_day}/")
|
| 389 |
+
|
| 390 |
file_name="DATE_TIME_SIZE_TOOL.jpg"
|
| 391 |
sdo_source_format = f"https://sdo.gsfc.nasa.gov/assets/img/browse/{in_year}/{in_month}/{in_day}/"
|
| 392 |
get_url=sdo_source_format
|