-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflare_atten_figures.m
More file actions
244 lines (204 loc) · 6.8 KB
/
flare_atten_figures.m
File metadata and controls
244 lines (204 loc) · 6.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
% flare_atten_figures.m
% Todd Anderson
% March 16 2023
%
% Reproduce/remake figures from Anderson et al 2020 paper
%
% Figures:
% 1. sample path distribution
% mark WWLLN stations!
% 2. sample trailing mean of path distribution
% 3. flare attenuation
%% load data
f906 = importdata("20170906_attenplotvars.mat");
f910 = importdata("20170910_attenplotvars.mat");
f906.gc = importdata("grid_crossings_10m_20170906.mat");
f910.gc = importdata("grid_crossings_10m_20170910.mat");
coastlines = importdata('coastlines.mat');
coastlat = coastlines.coastlat;
coastlon = coastlines.coastlon;
geoidrefvec = [1,90,-180];
stations = importdata("stations.mat");
%% 1. sample path distribution
k = 73;
pathdist = f906.gc(:,:,k);
datestring = string(datestr(f906.time_10m, "mmm dd yyyy"));
timestring = string(datestr(f906.time_10m, "hh:MM"));
h = figure(1);
h.Position = [-1000 -200 980 600];
hold off
t = tiledlayout(1,1, "TileSpacing","compact", "Padding", "compact");
nexttile;
% worldmap("World")
h1 = axesm("pcarree");
h1.FontSize = 12;
framem;
gridm;
mlabel("south");
plabel("west");
tightmap;
geoshow(pathdist, geoidrefvec, "DisplayType","texturemap");
hold on
geoshow(coastlat, coastlon, "Color","black");
% geoshow([stations{:,1}], [stations{:,2}], "DisplayType", "multipoint", "Marker", "square", "MarkerFaceColor", "blue", "MarkerEdgeColor","black", "MarkerSize", 8, "DisplayName", "WWLLN stations");
% legend(h1, ["","","","WWLLN Stations","",""], "Location","southoutside", "FontSize", 15)
set(gca,'ColorScale','log');
crameri('-hawaii');
caxis([0.1 1000]);
cb = colorbar;
% cb.Layout.Tile = 'east';
cb.Label.String = "number of paths";
cb.Label.FontSize = 15;
cb.FontSize = 15;
%
titlestr = sprintf("WWLLN propagation paths\n%s %s-%s", ...
datestring(k), timestring(k-1), timestring(k));
title(titlestr, "FontSize", 20);
% save
% exportgraphics(h, "figures/lanl/flare906_examplepaths2_nostations.jpg")
%% 2. sample trailing mean of path distribution
k = 73;
pathmedian = median(f906.gc(:,:,k-6:k-1), 3, "omitnan");
datestring = string(datestr(f906.time_10m, "mmm dd yyyy"));
timestring = string(datestr(f906.time_10m, "hh:MM"));
h = figure(1);
h.Position = [-1000 -200 980 600];
hold off
t = tiledlayout(1,1, "TileSpacing","compact", "Padding", "compact");
nexttile;
% worldmap("World")
h1 = axesm("pcarree");
h1.FontSize = 12;
framem;
gridm;
mlabel("south");
plabel("west");
tightmap;
geoshow(pathmedian, geoidrefvec, "DisplayType","texturemap");
hold on
geoshow(coastlat, coastlon, "Color","black");
% geoshow([stations{:,1}], [stations{:,2}], "DisplayType", "multipoint", "Marker", "square", "MarkerFaceColor", "blue", "MarkerEdgeColor","black", "MarkerSize", 8, "DisplayName", "WWLLN stations");
% legend(h1, ["","","","WWLLN Stations","",""], "Location","southoutside", "FontSize", 15)
set(gca,'ColorScale','log');
crameri('-hawaii');
caxis([0.1 1000]);
cb = colorbar;
% cb.Layout.Tile = 'east';
cb.Label.String = "number of paths";
cb.Label.FontSize = 15;
cb.FontSize = 15;
%
titlestr = sprintf("median WWLLN propagation paths\n%s %s-%s", ...
datestring(k), timestring(k-7), timestring(k-1));
title(titlestr, "FontSize", 20);
% save
% exportgraphics(h, "figures/lanl/flare906_examplepathmedian2_nostations.jpg")
%% 3. flare attenuation
% uncomment contour and subsolar point plotting as needed
d = 6;
if d == 6
% September 6 2017, 12:00-12:10
k = 73;
flareatten = f906.dB_gridcross_sm12(:,:,k);
datestring = string(datestr(f906.time_10m, "mmm dd yyyy"));
timestring = string(datestr(f906.time_10m, "hh:MM"));
clat = f906.latc(:,4,k);
clon = f906.lonc(:,4,k);
sslat = f906.ss_lat(k);
sslon = f906.ss_lon(k);
figname = "figures/lanl/flare906_atten.jpg";
elseif d == 10
% September 10 2017, 16:40-16:50
k = 97;
flareatten = f910.dB_gridcross_sm12(:,:,k);
datestring = string(datestr(f910.time_10m, "mmm dd yyyy"));
timestring = string(datestr(f910.time_10m, "hh:MM"));
clat = f910.latc(:,4,k);
clon = f910.lonc(:,4,k);
sslat = f910.ss_lat(k);
sslon = f910.ss_lon(k);
figname = "figures/lanl/flare910_atten.jpg";
else
error("try d == 6 or d == 10 !")
end
flareatten(abs(flareatten) == Inf) = NaN;
h = figure(1);
h.Position = [-1000 -200 980 600];
hold off
t = tiledlayout(1,1, "TileSpacing","compact", "Padding", "compact");
nexttile;
% worldmap("World")
h1 = axesm("pcarree");
h1.FontSize = 12;
framem;
gridm;
mlabel("south");
plabel("west");
tightmap;
geoshow(flareatten, geoidrefvec, "DisplayType","texturemap");
hold on
geoshow(coastlat, coastlon, "Color","black");
% geoshow(sslat, sslon, DisplayType="point", Marker="square", MarkerFaceColor="yellow", MarkerSize=8);
% geoshow(clat, clon, Color="yellow", LineWidth=2)
% geoshow([stations{:,1}], [stations{:,2}], "DisplayType", "multipoint", "Marker", "square", "MarkerFaceColor", "blue", "MarkerEdgeColor","black", "MarkerSize", 8, "DisplayName", "WWLLN stations");
% legend(h1, ["","","","WWLLN Stations","",""], "Location","southoutside", "FontSize", 15)
% set(gca,'ColorScale','log');
ncolors = 64;
g = [1 1 1]*0.8;
cmap = crameri('vik', ncolors);
cmap = [g; cmap; g];
cextents = [-10 10];
offset = range(cextents)*(size(cmap,1)/ncolors - 1)/2;
caxis(cextents + [-offset offset]);
colormap(cmap);
cb = colorbar;
% cb.Layout.Tile = 'east';
cb.Label.String = "10 log_{10}ss/ss_b";
cb.Label.FontSize = 15;
cb.FontSize = 15;
%
titlestr = sprintf("attenuation of WWLLN propagation paths\n%s %s-%s", ...
datestring(k), timestring(k-1), timestring(k));
title(titlestr, "FontSize", 20);
% save
% exportgraphics(h, figname)
%% contour comparison with xray flux
d = 6;
if d == 6
dt_crad = datetime(f906.time_10m, "ConvertFrom","datenum");
crad = f906.maxrad(:,4);
dt_xrs = datetime(f906.time_num_20, "ConvertFrom", "datenum");
xrs_A = f906.xrs_AFLUX_20;
figname = "figures/lanl/flare906_crad_xrs.jpg";
elseif d == 10
dt_crad = datetime(f910.time_10m, "ConvertFrom","datenum");
crad = f910.maxrad(:,4);
dt_xrs = datetime(f910.time_num_10, "ConvertFrom", "datenum");
xrs_A = f910.xrs_AFLUX_10;
figname = "figures/lanl/flare910_crad_xrs.jpg";
else
error("try d == 6 or d == 10 !")
end
datestring = string(datestr(dt_crad(1), "mmm dd yyyy"));
purple = [0.6 0.2 0.6];
yellow = [0.5 0.3 0.0];
h = figure(2);
h.Position = [-1000 -200 980 600];
yyaxis left
semilogy(dt_xrs,xrs_A, '-', LineWidth=1, Color=purple);
ylim([1E-8 1E-3])
ylabel("X-ray irradiance (W m^{-2})", FontSize=15);
ax = gca;
ax.YColor = purple;
colororder(purple);
yyaxis right
plot(dt_crad,crad, '-', LineWidth=1, color=yellow)
ylim([0 90])
ylabel("Attenuation region radius (\circ)", FontSize=15);
ax = gca;
ax.YColor = yellow;
set(gca, "FontSize", 15)
titlestr = sprintf("GOES-13 0.05-0.4 nm X-ray irradiance and WWLLN -6 dB contour radius\n%s", datestring);
title(titlestr, FontSize=20);
% save
exportgraphics(h, figname, Resolution=300)