Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ClassifyStorms
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
pick
public
ClassifyStorms
Commits
0d51d05e
Commit
0d51d05e
authored
May 09, 2019
by
Leonie Pick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pl.Selection() and pl.IndexDist()
parent
2d98190a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
36 deletions
+26
-36
Plots.py
Plots.py
+26
-36
No files found.
Plots.py
View file @
0d51d05e
...
@@ -32,9 +32,9 @@ def Selection(Time,Date,HMC,Index_thres1,StormIndices,IndexMin,IndexMin1,IndexMi
...
@@ -32,9 +32,9 @@ def Selection(Time,Date,HMC,Index_thres1,StormIndices,IndexMin,IndexMin1,IndexMi
ax
[
i
].
plot
(
Time
[
start
:
end
,
4
],
HMC
[
start
:
end
]
-
100
,
color
=
'gray'
)
ax
[
i
].
plot
(
Time
[
start
:
end
,
4
],
HMC
[
start
:
end
]
-
100
,
color
=
'gray'
)
ax
[
i
].
plot
(
Time
[
start
:
end
,
4
],
HMC
[
start
:
end
]
-
200
,
color
=
'gray'
)
ax
[
i
].
plot
(
Time
[
start
:
end
,
4
],
HMC
[
start
:
end
]
-
200
,
color
=
'gray'
)
ax
[
i
].
plot
(
Time
[
start
:
end
,
4
],
HMC
[
start
:
end
]
-
300
,
color
=
'gray'
)
ax
[
i
].
plot
(
Time
[
start
:
end
,
4
],
HMC
[
start
:
end
]
-
300
,
color
=
'gray'
)
ax
[
i
].
scatter
(
Time
[
np
.
asarray
(
IndexMin
),
4
],
HMC
[
np
.
asarray
(
IndexMin
)]
-
100
,
color
=
'midnightblue'
,
s
=
5
,
zorder
=
4
)
ax
[
i
].
scatter
(
Time
[
np
.
asarray
(
IndexMin
),
4
],
HMC
[
np
.
asarray
(
IndexMin
)]
-
100
,
color
=
'midnightblue'
,
s
=
10
,
zorder
=
4
)
ax
[
i
].
scatter
(
Time
[
np
.
asarray
(
IndexMin1
,
dtype
=
int
),
4
],
HMC
[
np
.
asarray
(
IndexMin1
,
dtype
=
int
)]
-
200
,
color
=
'midnightblue'
,
s
=
5
,
zorder
=
5
)
ax
[
i
].
scatter
(
Time
[
np
.
asarray
(
IndexMin1
,
dtype
=
int
),
4
],
HMC
[
np
.
asarray
(
IndexMin1
,
dtype
=
int
)]
-
200
,
color
=
'midnightblue'
,
s
=
10
,
zorder
=
5
)
ax
[
i
].
scatter
(
Time
[
np
.
asarray
(
IndexMin2
,
dtype
=
int
),
4
],
HMC
[
np
.
asarray
(
IndexMin2
,
dtype
=
int
)]
-
300
,
color
=
'maroon'
,
s
=
5
,
zorder
=
6
)
ax
[
i
].
scatter
(
Time
[
np
.
asarray
(
IndexMin2
,
dtype
=
int
),
4
],
HMC
[
np
.
asarray
(
IndexMin2
,
dtype
=
int
)]
-
300
,
color
=
'maroon'
,
s
=
10
,
zorder
=
6
)
ax
[
i
].
text
(
0.02
,
0.94
,
'Step 1'
,
transform
=
ax
[
i
].
transAxes
);
ax
[
i
].
text
(
0.02
,
0.745
,
'Step 2a'
,
transform
=
ax
[
i
].
transAxes
)
ax
[
i
].
text
(
0.02
,
0.94
,
'Step 1'
,
transform
=
ax
[
i
].
transAxes
);
ax
[
i
].
text
(
0.02
,
0.745
,
'Step 2a'
,
transform
=
ax
[
i
].
transAxes
)
ax
[
i
].
text
(
0.02
,
0.535
,
'Step 2b'
,
transform
=
ax
[
i
].
transAxes
);
ax
[
i
].
text
(
0.02
,
0.325
,
'Step 3'
,
transform
=
ax
[
i
].
transAxes
)
ax
[
i
].
text
(
0.02
,
0.535
,
'Step 2b'
,
transform
=
ax
[
i
].
transAxes
);
ax
[
i
].
text
(
0.02
,
0.325
,
'Step 3'
,
transform
=
ax
[
i
].
transAxes
)
...
@@ -80,11 +80,14 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
...
@@ -80,11 +80,14 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
# Overlap of storm times with Kp
# Overlap of storm times with Kp
Kp_indices
=
np
.
where
(
np
.
logical_and
(
KpHours_all
>=
min
(
TimeDecYear
[
YearsIndex
]),
KpHours_all
<
max
(
TimeDecYear
[
YearsIndex
])))[
0
]
Kp_indices
=
np
.
where
(
np
.
logical_and
(
KpHours_all
>=
min
(
TimeDecYear
[
YearsIndex
]),
KpHours_all
<
max
(
TimeDecYear
[
YearsIndex
])))[
0
]
Kp_red
=
Kp_all
[
Kp_indices
];
KpHours_red
=
KpHours_all
[
Kp_indices
]
Kp_red
=
Kp_all
[
Kp_indices
];
KpHours_red
=
KpHours_all
[
Kp_indices
]
Kp_range
=
np
.
around
(
np
.
arange
(
0
,
9
,
0.3333333
),
3
)
Kp_step
=
0.3333333
Kp_range
=
np
.
around
(
np
.
arange
(
0
,
9
,
Kp_step
),
3
)
Storms1932
=
np
.
where
(
TimeDecYear
[
Storms
]
>=
1932.000171
)[
0
]
Storms1932
=
np
.
where
(
TimeDecYear
[
Storms
]
>=
1932.000171
)[
0
]
HMC_range
=
np
.
linspace
(
-
np
.
ceil
(
np
.
nanmax
(
HMC
[
Storms
[
Storms1932
]])),
-
np
.
floor
(
np
.
nanmin
(
HMC
[
Storms
[
Storms1932
]])),
len
(
Kp_range
))
HMC_step
=
7.78
HMC_range
=
np
.
arange
(
10
,
480
+
HMC_step
,
HMC_step
)
Index_range
=
HMC_range
Index_range
=
Kp_range
#HMC_range
step
=
Kp_step
#HMC_step
years
=
np
.
arange
(
1932
,
2016
,
1
)
years
=
np
.
arange
(
1932
,
2016
,
1
)
Percentages
=
np
.
zeros
((
len
(
years
),
len
(
Index_range
)))
Percentages
=
np
.
zeros
((
len
(
years
),
len
(
Index_range
)))
...
@@ -98,7 +101,6 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
...
@@ -98,7 +101,6 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
else
:
else
:
Kp_indices
=
np
.
where
(
np
.
logical_and
(
KpHours_red
>=
years
[
l
],
KpHours_red
<
years
[
l
]
+
1
))[
0
]
Kp_indices
=
np
.
where
(
np
.
logical_and
(
KpHours_red
>=
years
[
l
],
KpHours_red
<
years
[
l
]
+
1
))[
0
]
StormsBlock
=
np
.
where
(
np
.
logical_and
(
TimeDecYear
[
Storms
]
>=
years
[
l
],
TimeDecYear
[
Storms
]
<
years
[
l
]
+
1
))[
0
]
StormsBlock
=
np
.
where
(
np
.
logical_and
(
TimeDecYear
[
Storms
]
>=
years
[
l
],
TimeDecYear
[
Storms
]
<
years
[
l
]
+
1
))[
0
]
#Kp_year = Kp_red[Kp_indices]; KpHours_year = KpHours_red[Kp_indices]
Kp
=
Kp_red
[
Kp_indices
];
KpHours
=
KpHours_red
[
Kp_indices
]
Kp
=
Kp_red
[
Kp_indices
];
KpHours
=
KpHours_red
[
Kp_indices
]
Kp_hours
=
np
.
zeros
((
len
(
Kp
)
*
3
,
2
))
Kp_hours
=
np
.
zeros
((
len
(
Kp
)
*
3
,
2
))
...
@@ -110,7 +112,6 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
...
@@ -110,7 +112,6 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
j
+=
3
j
+=
3
KpStorms
=
np
.
where
(
np
.
in1d
(
np
.
around
(
Kp_hours
[:,
0
],
6
),
TimeDecYear
[
Storms
][
Storms1932
]))[
0
]
KpStorms
=
np
.
where
(
np
.
in1d
(
np
.
around
(
Kp_hours
[:,
0
],
6
),
TimeDecYear
[
Storms
][
Storms1932
]))[
0
]
#KpValues = Kp_hours[KpStorms,1]
KpValues
=
np
.
zeros
(
len
(
KpStorms
))
KpValues
=
np
.
zeros
(
len
(
KpStorms
))
for
k
in
range
(
len
(
KpStorms
)):
for
k
in
range
(
len
(
KpStorms
)):
if
(
KpStorms
[
k
]
+
13
in
range
(
len
(
Kp_hours
))
and
KpStorms
[
k
]
-
13
in
range
(
len
(
Kp_hours
))):
if
(
KpStorms
[
k
]
+
13
in
range
(
len
(
Kp_hours
))
and
KpStorms
[
k
]
-
13
in
range
(
len
(
Kp_hours
))):
...
@@ -120,11 +121,11 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
...
@@ -120,11 +121,11 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
HMCValues
=
-
HMC
[
Storms
[
StormsBlock
]]
HMCValues
=
-
HMC
[
Storms
[
StormsBlock
]]
#
KpValuesAll.extend(KpValues.tolist())
KpValuesAll
.
extend
(
KpValues
.
tolist
())
#
Hist[l,:], bin_edges = np.histogram(KpValues, bins = Index_range)
Hist
[
l
,:],
bin_edges
=
np
.
histogram
(
KpValues
,
bins
=
Index_range
)
KpValuesAll
.
extend
(
HMCValues
.
tolist
())
#
KpValuesAll.extend(HMCValues.tolist())
Hist
[
l
,:],
bin_edges
=
np
.
histogram
(
HMCValues
,
bins
=
Index_range
)
#
Hist[l,:], bin_edges = np.histogram(HMCValues, bins = Index_range)
Hist
[
l
,:]
*=
100
/
len
(
Storms1932
)
Hist
[
l
,:]
*=
100
/
len
(
Storms1932
)
...
@@ -155,43 +156,32 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
...
@@ -155,43 +156,32 @@ def IndexDist(Time,YearsIndex,Storms,Kp_all,KpHours_all,HMC,Save):
ax1
.
set_yticks
(
np
.
arange
(
0
,
len
(
years
)
-
1
,
1
)
-
0.5
,
minor
=
True
)
ax1
.
set_yticks
(
np
.
arange
(
0
,
len
(
years
)
-
1
,
1
)
-
0.5
,
minor
=
True
)
ax1
.
set_yticks
(
np
.
arange
(
0
,
len
(
years
)
-
1
,
4
)
-
0.5
)
ax1
.
set_yticks
(
np
.
arange
(
0
,
len
(
years
)
-
1
,
4
)
-
0.5
)
ax1
.
set_yticklabels
(
years
[
0
:
len
(
years
)
-
1
][::
4
])
ax1
.
set_yticklabels
(
years
[
0
:
len
(
years
)
-
1
][::
4
])
ax1
.
axvline
((
bound25
-
Index_range
[
0
])
/
27
-
0.5
,
color
=
'black'
,
linestyle
=
'--'
)
ax1
.
axvline
((
bound25
-
Index_range
[
0
])
/
step
-
0.5
,
color
=
'black'
,
linestyle
=
'--'
)
ax1
.
axvline
((
bound75
-
Index_range
[
0
])
/
27
-
0.5
,
color
=
'black'
,
linestyle
=
'--'
)
ax1
.
axvline
((
bound75
-
Index_range
[
0
])
/
step
-
0.5
,
color
=
'black'
,
linestyle
=
'--'
)
#ax1.axvline(np.where(Index_range == bound25)[0]-0.5,color='black',linestyle='--')
#ax1.axvline(np.where(Index_range == bound75)[0]-0.5,color='black',linestyle='--')
cax
=
plt
.
subplot
(
gs
[
1
])
cax
=
plt
.
subplot
(
gs
[
1
])
bar
=
plt
.
colorbar
(
im
,
cax
=
cax
,
orientation
=
'vertical'
)
bar
=
plt
.
colorbar
(
im
,
cax
=
cax
,
orientation
=
'vertical'
)
bar
.
set_label
(
'Occurrence [%]'
)
bar
.
set_label
(
'Occurrence [%]'
)
ax2
.
bar
(
np
.
arange
(
0
,
len
(
Index_range
)
-
1
,
1
),
SumHist
,
width
=
1.0
,
align
=
'edge'
,
color
=
'gray'
,
zorder
=
1
)
ax2
.
bar
(
np
.
arange
(
0
,
len
(
Index_range
)
-
1
,
1
),
SumHist
,
width
=
1.0
,
align
=
'edge'
,
color
=
'gray'
,
zorder
=
1
)
ax2
.
axvline
((
bound25
-
Index_range
[
0
])
/
27
,
color
=
'black'
,
linestyle
=
'--'
,
label
=
'Q1'
)
ax2
.
axvline
((
bound25
-
Index_range
[
0
])
/
step
,
color
=
'black'
,
linestyle
=
'--'
,
label
=
'Q1'
)
ax2
.
axvline
((
bound75
-
Index_range
[
0
])
/
27
,
color
=
'black'
,
linestyle
=
'--'
,
label
=
'Q3'
)
ax2
.
axvline
((
bound75
-
Index_range
[
0
])
/
step
,
color
=
'black'
,
linestyle
=
'--'
,
label
=
'Q3'
)
#ax2.axvline(np.where(Index_range == bound25)[0],color='black',linestyle='--',label='Q1')
#ax2.axvline(np.where(Index_range == bound75)[0],color='black',linestyle='--',label='Q3')
ax2
.
set_xticks
(
np
.
arange
(
0
,
len
(
Index_range
),
3
))
ax2
.
set_xticks
(
np
.
arange
(
0
,
len
(
Index_range
),
3
))
ax2
.
set_xticks
(
np
.
arange
(
0
,
len
(
Index_range
),
1
),
minor
=
True
)
ax2
.
set_xticks
(
np
.
arange
(
0
,
len
(
Index_range
),
1
),
minor
=
True
)
ax2
.
set_xlim
([
0
,
27
])
ax2
.
set_xlim
([
0
,
27
])
ax2
.
legend
(
loc
=
4
,
ncol
=
1
,
frameon
=
False
,
fontsize
=
10
)
ax2
.
legend
(
loc
=
4
,
ncol
=
1
,
frameon
=
False
,
fontsize
=
10
)
ax2
.
set_ylabel
(
'Occurrence [%]'
)
ax2
.
set_ylabel
(
'Occurrence [%]'
)
#
ax2.set_xticklabels(np.arange(0,10,1))
ax2
.
set_xticklabels
(
np
.
arange
(
0
,
10
,
1
))
#ax2.set_xlabel('Kp level
')
ax2
.
set_xlabel
(
'Kp
'
)
#
ax2.set_ylim([0,10.5])
ax2
.
set_ylim
([
0
,
10.5
])
ax2
.
set_xticklabels
(
np
.
around
(
Index_range
[::
3
]
/
100
,
1
))
#ax2.set_xticklabels(np.around(Index_range[::3]/100,1))
ax2
.
set_xlabel
(
'-HMC/100 [nT]'
)
#ax2.set_xlabel('-HMC/100 [nT]')
ax2
.
set_ylim
([
0
,
45
])
#ax2.set_ylim([0,45])
#ax3.fill_between(np.arange(0,len(Kp_range)-1,1)+0.5,CumSum,CumSum2,color='maroon')
#ax3.set_ylim([0,105])
#ax3.set_ylabel('Cum. Occurrence [%]')
#ax3.spines['right'].set_color('maroon')
#ax3.tick_params(axis='y', colors='maroon')
#ax3.yaxis.label.set_color('maroon')
if
Save
==
True
:
if
Save
==
True
:
fig
.
savefig
(
'./Dump/Fig/
HMC
Dist.pdf'
,
format
=
'pdf'
,
dpi
=
200
,
transparent
=
True
)
fig
.
savefig
(
'./Dump/Fig/
Kp
Dist.pdf'
,
format
=
'pdf'
,
dpi
=
200
,
transparent
=
True
)
#fig.savefig('./Dump/Fig/
HMC
Dist.png',format='png',dpi=200,transparent=True)
#fig.savefig('./Dump/Fig/
Kp
Dist.png',format='png',dpi=200,transparent=True)
plt
.
show
()
plt
.
show
()
###
###
###
###
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment