Omnibus commited on
Commit
5ed2d1f
·
verified ·
1 Parent(s): 0566bd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -236,7 +236,11 @@ def make_nasa_soho_image_trigger():
236
  html_in+="</div>"
237
  return html_in
238
 
239
- def nasa_sdo_images(size=1024):
 
 
 
 
240
  html_out=""
241
  in_year="2024"
242
  in_month="03"
@@ -256,10 +260,12 @@ def nasa_sdo_images(size=1024):
256
  href=element.get('href')
257
  if href.endswith('.jpg'):
258
  ls=href.split("_")
259
- if int(ls[2]) <= size:
260
- link_json={'year':ls[0][0:4],'month':ls[0][4:6],'day':ls[0][6:8],'dump':ls[1],'size':ls[2],'obj':ls[3].split('.jpg')[0]}
261
- #print(href)
262
- link_box.append(link_json)
 
 
263
  #html_out+=f'<div class="img_class"><a href="{get_url}{spl2}" target="_blank">{spl2}</a><br><img src={get_url}{spl2}></div>'
264
  return link_box
265
  def run():
@@ -286,6 +292,14 @@ with gr.Blocks() as app:
286
  links=gr.JSON()
287
  with gr.Tab("NASA"):
288
  with gr.Tab("SDO Images"):
 
 
 
 
 
 
 
 
289
  sdo_btn=gr.Button("Load")
290
  sdo_json=gr.JSON()
291
  with gr.Tab("SOHO Images"):
 
236
  html_in+="</div>"
237
  return html_in
238
 
239
+ def nasa_sdo_images(size,obj):
240
+ if size=="All":
241
+ size1=9999
242
+ else:
243
+ size1=size
244
  html_out=""
245
  in_year="2024"
246
  in_month="03"
 
260
  href=element.get('href')
261
  if href.endswith('.jpg'):
262
  ls=href.split("_")
263
+ src_obj=ls[3].split('.jpg')[0]
264
+ if src_obj == obj or obj=="All":
265
+ if int(ls[2]) == int(size1) or if size=="All":
266
+ link_json={'year':ls[0][0:4],'month':ls[0][4:6],'day':ls[0][6:8],'dump':ls[1],'size':ls[2],'obj':src_obj}
267
+ #print(href)
268
+ link_box.append(link_json)
269
  #html_out+=f'<div class="img_class"><a href="{get_url}{spl2}" target="_blank">{spl2}</a><br><img src={get_url}{spl2}></div>'
270
  return link_box
271
  def run():
 
292
  links=gr.JSON()
293
  with gr.Tab("NASA"):
294
  with gr.Tab("SDO Images"):
295
+ with gr.Row():
296
+ sdo_drop1=gr.Dropdown(label="Instrument", choices=["All","HMIB","HMIBC","HMIIC","HMIIF","HMID","HMII","HMI171",
297
+ "0094","0131","0171","0193","0211",
298
+ "0304","0335","1600","1700","4500",
299
+ "211193171","211193171n","211193171rg",
300
+ "094335193","304211171"], value="All")
301
+ sdo_drop2=gr.Dropdown(label="Size", choices=[256,512,1024,2048,4096,"All"],value=512)
302
+
303
  sdo_btn=gr.Button("Load")
304
  sdo_json=gr.JSON()
305
  with gr.Tab("SOHO Images"):