Commit da98c4d7 authored by Leonie Pick's avatar Leonie Pick

Started to implement changes for index histograms and event selection plots

parent f636a1b0
This diff is collapsed.
......@@ -16,6 +16,8 @@ mpl.use('TkAgg')
import matplotlib.pyplot as plt
plt.style.use('bmh')
import matplotlib.gridspec as gridspec
from matplotlib.patches import Rectangle
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
# Scipy
from scipy import interp
from scipy.signal import butter, filtfilt
......
......@@ -32,7 +32,7 @@ def Search_TargetEvents(HMC, HMC11y, HMC5d, dHMC, HTime, DTime, grid, Plot, Save
mini_range = grid[2]
thresHMC = grid[3]
scaling = HMC11y/min(HMC11y)
scaling = HMC11y/np.nanmin(HMC11y)
Index_thres1 = np.percentile(HMC,percentile)*scaling**(power)
#YearLow = DTime[np.argmin(scaling)]
#YearHigh = DTime[np.argmax(scaling)]
......@@ -129,10 +129,10 @@ def Search_TargetEvents(HMC, HMC11y, HMC5d, dHMC, HTime, DTime, grid, Plot, Save
if HMC_diff <= -thresHMC:
IndexMin2.append(i)
if Plot == True:
pl.Selection(HTime,DTime,HMC,Index_thres1,StormIndices,IndexMin,IndexMin1,IndexMin2,Save)
#if Plot == True:
#pl.Selection(HTime,DTime,HMC,Index_thres1,StormIndices,IndexMin,IndexMin1,IndexMin2,Save)
return IndexMin2
return Index_thres1, StormIndices, IndexMin1, IndexMin2
###
###
def Get_TargetEvents(HMC, HMC11y, HMC5d, dHMC, Kp_all, KpHours_all, Reference, Time, Date, YearStart, Plot, Save):
......@@ -168,9 +168,12 @@ def Get_TargetEvents(HMC, HMC11y, HMC5d, dHMC, Kp_all, KpHours_all, Reference, T
threshold = 0
for i in range(len(grid)):
Storms = Search_TargetEvents(HMC[YearsIndex], HMC11y[YearsIndex], HMC5d[YearsIndex], dHMC[YearsIndex],
Index_thres, Storms_a, Storms_b, Storms = Search_TargetEvents(HMC[YearsIndex], HMC11y[YearsIndex], HMC5d[YearsIndex], dHMC[YearsIndex],
Time[YearsIndex,:], Date[YearsIndex], grid[i,:], Plot, Save)
if Plot == True:
pl.Selection(Time[YearsIndex,:], Date[YearsIndex], HMC[YearsIndex], Index_thres, Storms_a, Storms_b, Storms, Kp_all, KpHours_all, Save)
#Found_CIRs = np.where(np.in1d(TrTimeIndex[np.logical_or(TrClass==0,TrClass==2)],Storms+YearsIndex[0]))[0]
#Found_CMEs = np.where(np.in1d(TrTimeIndex[TrClass==1],Storms+YearsIndex[0]))[0]
FoundStorms['CIRs_'+str(int(i))] = np.where(np.in1d(TrTimeIndex[np.logical_or(TrClass==0,TrClass==2)],Storms+YearsIndex[0]))[0]
......@@ -212,7 +215,7 @@ def Get_TargetEvents(HMC, HMC11y, HMC5d, dHMC, Kp_all, KpHours_all, Reference, T
###
if Plot == True:
pl.IndexDist(Time,YearsIndex,StormsWin[SelectStr],Kp_all,KpHours_all,HMC,Save)
pl.IndexDist(Time,YearsIndex,StormsWin[SelectStr],TrTimeIndex,Kp_all,KpHours_all,HMC,Save)
return StormsWin, TrFound, FoundStorms
###
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment