@@ -141,9 +141,14 @@ def plot_solarwind_and_dst_prediction(DSCOVR_data, STEREOA_data, DST_data, DSTPR
141141
142142 # STEREO-A minute resolution data with timeshift
143143 plt .plot_date (stam ['time' ][sta_index_future ], stam ['btot' ][sta_index_future ],
144- '-' , c = c_sta , linewidth = lw , label = 'B STEREO-A' )
145- plt .plot_date (stam ['time' ][sta_index_future ], stam ['bn' ][sta_index_future ],
146- '-' , c = c_sta , alpha = 0.5 , linewidth = lw , label = 'Bn RTN STEREO-A' )
144+ '-' , c = c_sta , linewidth = lw , label = 'B {}' .format (stam .source ))
145+ if 'stereo' in stam .source .lower ():
146+ plt .plot_date (stam ['time' ][sta_index_future ], stam ['bn' ][sta_index_future ],
147+ '-' , c = c_sta , alpha = 0.5 , linewidth = lw , label = 'Bn RTN {}' .format (stam .source ))
148+ else :
149+ plt .plot_date (stam ['time' ][sta_index_future ], stam ['bz' ][sta_index_future ],
150+ '-' , c = c_sta , alpha = 0.5 , linewidth = lw , label = 'Bz GSM {}' .format (stam .source ))
151+
147152
148153 # Indicate 0 level for Bz
149154 plt .plot_date ([plotstart ,plotend ], [0 ,0 ],'--k' , alpha = 0.5 , linewidth = 1 )
@@ -157,8 +162,8 @@ def plot_solarwind_and_dst_prediction(DSCOVR_data, STEREOA_data, DST_data, DSTPR
157162
158163 if 'stereo' in stam .source .lower ():
159164 pred_source = 'STEREO-Ahead Beacon'
160- elif 'omni ' in stam .source .lower ():
161- pred_source = '27-day SW-Recurrence Model (OMNI )'
165+ elif 'dscovr' in stam . source . lower () or 'noaa ' in stam .source .lower ():
166+ pred_source = '27-day SW-Recurrence Model (NOAA )'
162167 plt .title ('L1 real time solar wind from NOAA SWPC for ' + datetime .strftime (timestamp , "%Y-%m-%d %H:%M" )+ ' UT & {}' .format (pred_source ), fontsize = fs_title )
163168
164169 # SUBPLOT 2: Solar wind speed
@@ -212,17 +217,17 @@ def plot_solarwind_and_dst_prediction(DSCOVR_data, STEREOA_data, DST_data, DSTPR
212217 dstplotmin = np .nanmin (np .concatenate ((dst ['dst' ], dst_pred ['dst' ])))- 20
213218
214219 if dstplotmin > - 100 : # Low activity (normal)
215- plt .ylim ([- 100 ,np . nanmax ( dst [ 'dst' ]) + 20 ])
220+ plt .ylim ([- 100 , dstplotmax + 30 ])
216221 else : # High activity
217222 plt .ylim ([dstplotmin , dstplotmax ])
218223
219224 # Plot predicted Dst
220225 if not verification_mode :
221226 plt .plot_date (dst_pred ['time' ], dst_pred ['dst' ], '-' , c = c_sta_dst , label = dst_label , markersize = 3 , linewidth = 1 )
222227 # Add generic error bars of +/-15 nT:
223- error = 15
228+ error = 8
224229 plt .fill_between (dst_pred ['time' ], dst_pred ['dst' ]- error , dst_pred ['dst' ]+ error , alpha = 0.2 ,
225- label = 'Error for high speed streams ' )
230+ label = 'prediction accuracy +/- 8 nT ' )
226231 else :
227232 #load saved data l prefix is for loaded - WARNING This will crash if called right now
228233 [timenowb , sta_ptime , sta_vr , sta_btime , sta_btot , sta_br ,sta_bt , sta_bn , rbtime_num , rbtot , rbzgsm , rptime_num , rpv , rpn , lrdst_time , lrdst , lcom_time , ldst_burton , ldst_obrien ,ldst_temerin_li ]= pickle .load (open (verify_filename ,'rb' ) )
@@ -240,10 +245,10 @@ def plot_solarwind_and_dst_prediction(DSCOVR_data, STEREOA_data, DST_data, DSTPR
240245
241246 # Plot solar wind density:
242247 avg_newell_coupling = newell_coupling .get_weighted_average ('ec' )
243- plt .plot_date (newell_coupling ['time' ], avg_newell_coupling / 4421. , '-' , color = c_ec , label = 'Newell coupling' ,linewidth = 1.5 )
248+ plt .plot_date (newell_coupling ['time' ], avg_newell_coupling / 4421. , '-' , color = c_ec , label = 'Newell coupling 4h weighted mean ' ,linewidth = 1.5 )
244249 plt .ylabel ('Newell Coupling / 4421\n $\mathregular{[(km/s)^{4/3} nT^{2/3}]}$' ,fontsize = fs_ylabel )
245250 # For y limits check where the maximum and minimum are for DSCOVR and STEREO taken together:
246- plt .ylim ([0 ,np .nanmax (avg_newell_coupling / 4421. )* 1.1 ])
251+ plt .ylim ([0 ,np .nanmax (avg_newell_coupling / 4421. )* 1.2 ])
247252
248253 # Indicate level of interest (Ec/4421 = 1.0)
249254 plt .plot_date ([plotstart ,plotend ], [1 ,1 ],'--k' , alpha = 0.5 , linewidth = 1 )
@@ -288,7 +293,7 @@ def plot_solarwind_and_dst_prediction(DSCOVR_data, STEREOA_data, DST_data, DSTPR
288293 logger .info ('Plot saved as png:\n ' + filename )
289294
290295
291- def plot_solarwind_science (DSCOVR_data , STEREOA_data , verification_mode = False , timestamp = None , past_days = 7 , future_days = 7 , outfile = 'predstorm_science.png' , ** kwargs ):
296+ def plot_solarwind_science (DSCOVR_data , STEREOA_data , verification_mode = False , timestamp = None , past_days = 7 , future_days = 7 , plot_step = 20 , outfile = 'predstorm_science.png' , ** kwargs ):
292297 """
293298 Plots solar wind variables, past from DSCOVR and future/predicted from STEREO-A.
294299 Total B-field and Bz (top), solar wind speed (second), particle density (third)
@@ -355,6 +360,7 @@ def plot_solarwind_science(DSCOVR_data, STEREOA_data, verification_mode=False, t
355360 timeutc = mdates .date2num (timestamp )
356361
357362 n_plots = 3
363+ plst = plot_step
358364
359365 plotstart = timeutc - past_days
360366 plotend = timeutc + future_days
@@ -365,10 +371,10 @@ def plot_solarwind_science(DSCOVR_data, STEREOA_data, verification_mode=False, t
365371 axes .append (ax1 )
366372
367373 # Total B-field and Bz (DSCOVR)
368- plt .plot_date (dism ['time' ], dism ['btot' ],'-' , c = 'black' , label = 'B' , linewidth = lw )
369- plt .plot_date (dism ['time' ], dism ['bx' ],'-' , c = 'teal' , label = 'Bx' , linewidth = lw )
370- plt .plot_date (dism ['time' ], dism ['by' ],'-' , c = 'orange' , label = 'By' , linewidth = lw )
371- plt .plot_date (dism ['time' ], dism ['bz' ],'-' , c = 'purple' , label = 'Bz' , linewidth = lw )
374+ plt .plot_date (dism ['time' ][:: plst ] , dism ['btot' ][:: plst ],'-' , c = 'black' , label = 'B' , linewidth = lw )
375+ plt .plot_date (dism ['time' ][:: plst ] , dism ['bx' ][:: plst ],'-' , c = 'teal' , label = 'Bx' , linewidth = lw )
376+ plt .plot_date (dism ['time' ][:: plst ] , dism ['by' ][:: plst ],'-' , c = 'orange' , label = 'By' , linewidth = lw )
377+ plt .plot_date (dism ['time' ][:: plst ] , dism ['bz' ][:: plst ],'-' , c = 'purple' , label = 'Bz' , linewidth = lw )
372378
373379 # STEREO-A minute resolution data with timeshift
374380 plt .plot_date (stam ['time' ][sta_index_future ], stam ['btot' ][sta_index_future ],
@@ -392,8 +398,8 @@ def plot_solarwind_science(DSCOVR_data, STEREOA_data, verification_mode=False, t
392398
393399 if 'stereo' in stam .source .lower ():
394400 pred_source = 'STEREO-Ahead Beacon'
395- elif 'omni ' in stam .source .lower ():
396- pred_source = '27-day SW-Recurrence Model (OMNI )'
401+ elif 'dscovr' in stam . source . lower () or 'noaa ' in stam .source .lower ():
402+ pred_source = '27-day SW-Recurrence Model (NOAA )'
397403 plt .title ('L1 real time solar wind from NOAA SWPC for ' + datetime .strftime (timestamp , "%Y-%m-%d %H:%M" )+ ' UT & {}' .format (pred_source ), fontsize = fs_title )
398404
399405 # SUBPLOT 2: Solar wind speed
@@ -402,7 +408,7 @@ def plot_solarwind_science(DSCOVR_data, STEREOA_data, verification_mode=False, t
402408 axes .append (ax2 )
403409
404410 # Plot solar wind speed (DSCOVR):
405- plt .plot_date (dism ['time' ], dism ['speed' ],'-' , c = 'black' , label = 'speed' ,linewidth = lw )
411+ plt .plot_date (dism ['time' ][:: plst ] , dism ['speed' ][:: plst ],'-' , c = 'black' , label = 'speed' ,linewidth = lw )
406412 plt .ylabel ('Speed $\mathregular{[km \\ s^{-1}]}$' , fontsize = fs_ylabel )
407413
408414 # Plot STEREO-A data with timeshift and savgol filter
@@ -425,7 +431,7 @@ def plot_solarwind_science(DSCOVR_data, STEREOA_data, verification_mode=False, t
425431 axes .append (ax3 )
426432
427433 # Plot solar wind density:
428- plt .plot_date (dism ['time' ], dism ['density' ],'-k' , label = 'density' ,linewidth = lw )
434+ plt .plot_date (dism ['time' ][:: plst ] , dism ['density' ][:: plst ],'-k' , label = 'density' ,linewidth = lw )
429435 plt .ylabel ('Density $\mathregular{[ccm^{-3}]}$' ,fontsize = fs_ylabel )
430436 # For y limits check where the maximum and minimum are for DSCOVR and STEREO taken together:
431437 plt .ylim ([0 ,np .nanmax (np .nanmax (np .concatenate ((dism ['density' ],stam ['density' ][sta_index_future ])))+ 10 )])
0 commit comments