Mushfi commited on
Commit
d736ecf
1 Parent(s): b0267bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -3
app.py CHANGED
@@ -8,13 +8,26 @@ df = pd.read_csv('graph.csv')
8
  start_datetime = pd.to_datetime('2011-01-01 00:00:00')
9
  df['datetime'] = start_datetime + pd.to_timedelta(df['timestep'], unit='h')
10
 
 
 
 
 
 
 
11
  with gr.Blocks(title="Forecasting Geomagnetic Storms", css="") as demo:
12
  with gr.Row():
13
  textmd = gr.Markdown('''
14
  # Forecasting Geomagnetic Storms
15
- DST (Disturbance Storm Time) index is a measure of the strength of geomagnetic storms
16
- `predicted_t0` is the predicted DST value at the current hour
17
- `predicted_t1` is the predicted DST value at the next hour
 
 
 
 
 
 
 
18
  ''')
19
 
20
  with gr.Row():
@@ -22,6 +35,8 @@ with gr.Blocks(title="Forecasting Geomagnetic Storms", css="") as demo:
22
  df,
23
  x="datetime",
24
  y="DST",
 
 
25
  color="name",
26
  color_legend_position="bottom",
27
  title="Graph of Predicted DST values and Ground Truth",
@@ -30,5 +45,36 @@ with gr.Blocks(title="Forecasting Geomagnetic Storms", css="") as demo:
30
  width=1000,
31
  interactive=True,
32
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  demo.launch(debug='False', share=False)
 
8
  start_datetime = pd.to_datetime('2011-01-01 00:00:00')
9
  df['datetime'] = start_datetime + pd.to_timedelta(df['timestep'], unit='h')
10
 
11
+ def k():
12
+ return gr.update(value=None)
13
+
14
+ def predict_input_image(file):
15
+ return '0.1854984', '8.68441'
16
+
17
  with gr.Blocks(title="Forecasting Geomagnetic Storms", css="") as demo:
18
  with gr.Row():
19
  textmd = gr.Markdown('''
20
  # Forecasting Geomagnetic Storms
21
+ The data used to build the deep learning model can be found [here](https://www.ngdc.noaa.gov/geomag/data/geomag/magnet/?fbclid=IwAR1kRkud565-Q61SiMTiB9dt2_vatxrLbNnP2oHK03JTv9HHkiGHsrcfZO0)
22
+ And the source code of our model is uploaded to Github: [NSAC2023-Dst-prediction](https://github.com/Abrar2652/NSAC2023-Dst-prediction/tree/main)
23
+ DST (Disturbance Storm Time) index is a measure of the strength of geomagnetic storms
24
+ `predicted_t0` is the predicted DST value (in nT) at the current hour
25
+ `predicted_t1` is the predicted DST value (in nT) at the next hour
26
+ Classification of DST values:
27
+ | Quiet-Minor | Moderate storm | Intense Storm | Superintense storm |
28
+ | - | - | - | - |
29
+ | >-50 | -50 to -100 | <-100 | <-250 |
30
+
31
  ''')
32
 
33
  with gr.Row():
 
35
  df,
36
  x="datetime",
37
  y="DST",
38
+ x_title="Datetime",
39
+ y_title="DST (nT)",
40
  color="name",
41
  color_legend_position="bottom",
42
  title="Graph of Predicted DST values and Ground Truth",
 
45
  width=1000,
46
  interactive=True,
47
  )
48
+ with gr.Row():
49
+ with gr.Column(scale=1, min_width=500):
50
+ textmd1 = gr.Markdown('''
51
+ # Realtime Forecast
52
+ ## Inputs
53
+ Solar wind data should be composed of solar-wind readings from the satellites, in the form of a csv file with the following columns:
54
+ bx_gse, by_gse, bz_gse, theta_gse, phi_gse, bx_gsm, by_gsm, bz_gsm, theta_gsm, phi_gsm, bt, density, speed, temperature, source
55
+ ''')
56
+ file1 = gr.File(label="Solar Wind Data (7 days)")
57
+ textmd2 = gr.Markdown('''
58
+ The satellite positions data should be composed of the daily positions of the DSCOVR and ACE Spacecrafts in Geocentric Solar Ecliptic (GSE) Coordinates for projections in the XY, XZ, and YZ planes. The csv file should have the following columns:
59
+ gse_x, gse_y, gse_z
60
+ ''')
61
+ file2 = gr.File(label="Satellite Positions Data (7 days)")
62
+ number = gr.inputs.Number(label="Latest Subspot Number")
63
+
64
+ with gr.Row():
65
+ clear_btn = gr.Button("Clear")
66
+ submit_btn = gr.Button("Submit", elem_id="warning", variant='primary')
67
+ #label = gr.outputs.Label(num_top_classes=4)
68
+ #label = gr.HTML(value="<div style='height:300px; border-width: 1px; border-color: #000000; border-radius: 5px;'></div>")
69
+ with gr.Column(scale=1, min_width=200):
70
+ textmd = gr.Markdown('''
71
+ ## Outputs
72
+ Predicted value of the Disturbance Storm-Time Index (Dst) at time t hour and t+1 hour
73
+ ''')
74
+ label1 = gr.Textbox(label="Dst value (t)")
75
+ label2 = gr.Textbox(label="Dst value (t+1)")
76
+
77
+ clear_btn.click(k, inputs=[], outputs=file1)
78
+ submit_btn.click(predict_input_image, inputs=file1, outputs=[label1, label2])
79
 
80
  demo.launch(debug='False', share=False)