• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

victoriyaforsythe / PyIRI / 15282112201

27 May 2025 05:45PM UTC coverage: 47.272% (-5.8%) from 53.109%
15282112201

push

github

web-flow
Merge pull request #49 from victoriyaforsythe/victoriya_tests

New F1 model, new EDP construction, tests.

361 of 479 new or added lines in 8 files covered. (75.37%)

339 existing lines in 3 files now uncovered.

953 of 2016 relevant lines covered (47.27%)

3.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

4.76
/PyIRI/plotting.py
1
#!/usr/bin/env python
2
# ---------------------------------------------------------
3
# Distribution statement A. Approved for public release.
4
# Distribution is unlimited.
5
# This work was supported by the Office of Naval Research.
6
# ---------------------------------------------------------
7
"""This library contains components visualization routines for PyIRI."""
8

9
import matplotlib.pyplot as plt
7✔
10
import numpy as np
7✔
11
import os
7✔
12

13

14
def PyIRI_plot_mag_dip_lat(mag, alon, alat, alon_2d, alat_2d, plot_dir,
7✔
15
                           plot_name='PyIRI_mag_dip_lat.png'):
16
    """Plot magnetic dip latitude.
17

18
    Parameters
19
    ----------
20
    mag : dict
21
        Dictionary output of IRI_monthly_mean_parameters.
22
    alon : array-like
23
        Flattened array of geo longitudes in degrees.
24
    alat : array-like
25
        Flattened array of geo latitudes in degrees.
26
    alon_2d : array-like
27
        2-D array of geo longitudes in degrees.
28
    alat_2d : array-like
29
        2-D array of geo latitudes in degrees.
30
    plot_dir : str
31
        Direction where to save the figure.
32
    plot_name : str
33
        Output name, without directory, for the saved figure
34
        (default='PyIRI_mag_dip_lat.png')
35

36
    """
37
    figname = os.path.join(plot_dir, plot_name)
×
38
    fig, ax = plt.subplots(1, 1)
×
39
    ax.set_facecolor('grey')
×
40
    ax.set_xlabel('Geo Lon (°)')
×
41
    ax.set_ylabel('Geo Lat (°)')
×
42
    z = np.reshape(mag['mag_dip_lat'], alon_2d.shape)
×
43
    plt.xlim([-180, 180])
×
44
    plt.ylim([-90, 90])
×
45
    plt.xticks(np.arange(-180, 180 + 45, 45))
×
46
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
NEW
47
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
48
    cbar = fig.colorbar(mesh, ax=ax)
×
49
    cbar.set_label('Mag Dip Lat (°)')
×
50
    plt.title('Alt = 300 km')
×
51
    plt.savefig(figname)
×
52
    return
×
53

54

55
def PyIRI_plot_inc(mag, alon, alat, alon_2d, alat_2d, plot_dir,
7✔
56
                   plot_name='PyIRI_inc.png'):
57
    """Plot magnetic inclination.
58

59
    Parameters
60
    ----------
61
    mag : dict
62
        Dictionary output of IRI_monthly_mean_parameters.
63
    alon : array-like
64
        Flattened array of geo longitudes in degrees.
65
    alat : array-like
66
        Flattened array of geo latitudes in degrees.
67
    alon_2d : array-like
68
        2-D array of geo longitudes in degrees.
69
    alat_2d : array-like
70
        2-D array of geo latitudes in degrees.
71
    plot_dir : str
72
        Direction where to save the figure.
73
    plot_name : str
74
        Name for the output figure, without directory (default='PyIRI_inc.png')
75

76
    """
77
    figname = os.path.join(plot_dir, plot_name)
×
78
    fig, ax = plt.subplots(1, 1)
×
79
    ax.set_facecolor('grey')
×
80
    ax.set_xlabel('Geo Lon (°)')
×
81
    ax.set_ylabel('Geo Lat (°)')
×
82
    z = np.reshape(mag['inc'], alon_2d.shape)
×
83
    plt.xlim([-180, 180])
×
84
    plt.ylim([-90, 90])
×
85
    plt.xticks(np.arange(-180, 180 + 45, 45))
×
86
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
NEW
87
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
88
    cbar = fig.colorbar(mesh, ax=ax)
×
89
    cbar.set_label('Inclination (°)')
×
90
    plt.title('Alt = 300 km')
×
91
    plt.savefig(figname)
×
92
    return
×
93

94

95
def PyIRI_plot_modip(mag, alon, alat, alon_2d, alat_2d, plot_dir,
7✔
96
                     plot_name='PyIRI_modip.png'):
97
    """Plot modified dip angle.
98

99
    Parameters
100
    ----------
101
    mag : dict
102
        Dictionary output of IRI_monthly_mean_parameters.
103
    alon : array-like
104
        Flattened array of geo longitudes in degrees.
105
    alat : array-like
106
        Flattened array of geo latitudes in degrees.
107
    alon_2d : array-like
108
        2-D array of geo longitudes in degrees.
109
    alat_2d : array-like
110
        2-D array of geo latitudes in degrees.
111
    plot_dir : str
112
        Direction where to save the figure.
113
    plot_name : str
114
        Name for the output figure, without directory
115
        (default='PyIRI_modip.png')
116

117
    """
118
    figname = os.path.join(plot_dir, 'PyIRI_modip.png')
×
119
    fig, ax = plt.subplots(1, 1)
×
120
    ax.set_facecolor('grey')
×
121
    ax.set_xlabel('Geo Lon (°)')
×
122
    ax.set_ylabel('Geo Lat (°)')
×
123
    z = np.reshape(mag['modip'], alon_2d.shape)
×
124
    plt.xlim([-180, 180])
×
125
    plt.ylim([-90, 90])
×
126
    plt.xticks(np.arange(-180, 180 + 45, 45))
×
127
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
NEW
128
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
129
    cbar = fig.colorbar(mesh, ax=ax)
×
130
    cbar.set_label(r'Modip ($^\circ$)')
×
131
    plt.title('Alt = 300 km')
×
132
    plt.savefig(figname)
×
133
    return
×
134

135

136
def PyIRI_plot_B_F1_bot_min_max(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
137
                                UT, plot_dir,
138
                                plot_name='PyIRI_B_F1_bot_min_max.png'):
139
    """Plot thickness of F1 bottom side for solar min and max.
140

141
    Parameters
142
    ----------
143
    F1 : dict
144
        Dictionary output of IRI_monthly_mean_parameters.
145
    aUT : array-like
146
        Array of universal times in hours used in PyIRI.
147
    alon : array-like
148
        Flattened array of geo longitudes in degrees.
149
    alat : array-like
150
        Flattened array of geo latitudes in degrees.
151
    alon_2d : array-like
152
        2-D array of geo longitudes in degrees.
153
    alat_2d : array-like
154
        2-D array of geo latitudes in degrees.
155
    sun : dict
156
        Dictionary output of IRI_monthly_mean_parameters.
157
    UT : float
158
        UT time frame from array aUT to plot.
159
    plot_dir : str
160
        Direction where to save the figure.
161
    plot_name : str
162
        Name for the output figure, without directory
163
        (default='PyIRI_B_F1_bot_min_max.png')
164

165
    """
166
    ind_time = np.where(aUT == UT)
×
167
    ind_grid = np.where(np.isfinite(alon))
×
168
    figname = os.path.join(plot_dir, plot_name)
×
169
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
170
                           constrained_layout=True)
171
    plt.xlim([-180, 180])
×
172
    plt.ylim([-90, 90])
×
173
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
174
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
175
    abc = ['(a)', '(b)']
×
176
    atitle = ['Solar Min', 'Solar Max']
×
177
    for isol in range(0, 2):
×
178
        ax[isol].set_facecolor('grey')
×
179
        ax[isol].set_xlabel('Geo Lon (°)')
×
180
        ax[isol].set_ylabel('Geo Lat (°)')
×
181
        if isol == 1:
×
182
            ax[1].set_ylabel(' ')
×
183
        z = np.reshape(F1['B_bot'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
184
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
185
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
186
        ax[isol].text(140, 70, abc[isol], c='white')
×
187
        ax[isol].title.set_text(atitle[isol])
×
188
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
189
                         s=20, edgecolors="black", linewidths=0.5)
190
    cbar.set_label('$B^{F1}_{bot}$ (km)')
×
191
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
192
    return
×
193

194

195
def PyIRI_plot_B_F2_bot_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
196
                                UT, plot_dir,
197
                                plot_name='PyIRI_B_F2_bot_min_max.png'):
198
    """Plot thickness of F2 bottom side for solar min and max.
199

200
    Parameters
201
    ----------
202
    F2 : dict
203
        Dictionary output of IRI_monthly_mean_parameters.
204
    aUT : array-like
205
        Array of universal times in hours used in PyIRI
206
    alon : array-like
207
        Flattened array of geo longitudes in degrees.
208
    alat : array-like
209
        Flattened array of geo latitudes in degrees.
210
    alon_2d : array-like
211
        2-D array of geo longitudes in degrees.
212
    alat_2d : array-like
213
        2-D array of geo latitudes in degrees.
214
    sun : dict
215
        Dictionary output of IRI_monthly_mean_parameters.
216
    UT : float
217
        UT time frame from array aUT to plot.
218
    plot_dir : str
219
        Direction where to save the figure.
220
    plot_name : str
221
        Name for the output figure, without directory
222
        (default='PyIRI_B_F2_bot_min_max.png')
223

224
    """
225
    ind_time = np.where(aUT == UT)
×
226
    ind_grid = np.where(np.isfinite(alon))
×
227
    figname = os.path.join(plot_dir, plot_name)
×
228
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
229
                           constrained_layout=True)
230
    plt.xlim([-180, 180])
×
231
    plt.ylim([-90, 90])
×
232
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
233
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
234
    abc = ['(a)', '(b)']
×
235
    atitle = ['Solar Min', 'Solar Max']
×
236
    for isol in range(0, 2):
×
237
        ax[isol].set_facecolor('grey')
×
238
        ax[isol].set_xlabel('Geo Lon (°)')
×
239
        ax[isol].set_ylabel('Geo Lat (°)')
×
240
        if isol == 1:
×
241
            ax[1].set_ylabel(' ')
×
242
        z = np.reshape(F2['B_bot'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
243
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
244
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
245
        ax[isol].text(140, 70, abc[isol], c='white')
×
246
        ax[isol].title.set_text(atitle[isol])
×
247
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
248
                         s=20, edgecolors="black", linewidths=0.5)
249
    cbar.set_label('$B^{F2}_{bot}$ (km)')
×
250
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
251
    return
×
252

253

254
def PyIRI_plot_B_F2_top_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
255
                                UT, plot_dir,
256
                                plot_name='PyIRI_B_F2_top_min_max.png'):
257
    """Plot thickness of F2 topside for solar min and max.
258

259
    Parameters
260
    ----------
261
    F2 : dict
262
        Dictionary output of IRI_monthly_mean_parameters.
263
    aUT : array-like
264
        Array of universal times in hours used in PyIRI.
265
    alon : array-like
266
        Flattened array of geo longitudes in degrees.
267
    alat : array-like
268
        Flattened array of geo latitudes in degrees.
269
    alon_2d : array-like
270
        2-D array of geo longitudes in degrees.
271
    alat_2d : array-like
272
        2-D array of geo latitudes in degrees.
273
    sun : dict
274
        Dictionary output of IRI_monthly_mean_parameters.
275
    UT : float
276
        UT time frame from array aUT to plot.
277
    plot_dir : str
278
        Direction where to save the figure.
279
    plot_name : str
280
        Name for the output figure, without directory
281
        (default='PyIRI_B_F2_top_min_max.png')
282

283
    """
284
    ind_time = np.where(aUT == UT)
×
285
    ind_grid = np.where(np.isfinite(alon))
×
286
    figname = os.path.join(plot_dir, plot_name)
×
287
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
288
                           constrained_layout=True)
289
    plt.xlim([-180, 180])
×
290
    plt.ylim([-90, 90])
×
291
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
292
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
293
    abc = ['(a)', '(b)']
×
294
    atitle = ['Solar Min', 'Solar Max']
×
295
    for isol in range(0, 2):
×
296
        ax[isol].set_facecolor('grey')
×
297
        ax[isol].set_xlabel('Geo Lon (°)')
×
298
        ax[isol].set_ylabel('Geo Lat (°)')
×
299
        if isol == 1:
×
300
            ax[1].set_ylabel(' ')
×
301
        z = np.reshape(F2['B_top'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
302
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
303
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
304
        ax[isol].text(140, 70, abc[isol], c='white')
×
305
        ax[isol].title.set_text(atitle[isol])
×
306
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
307
                         s=20, edgecolors="black", linewidths=0.5)
308
    cbar.set_label('$B^{F2}_{top}$ (km)')
×
309
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
310
    return
×
311

312

313
def PyIRI_plot_M3000_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
314
                             UT, plot_dir, plot_name='PyIRI_M3000_min_max.png'):
315
    """Plot M3000 propagation parameter for solar min and max.
316

317
    Parameters
318
    ----------
319
    F2 : dict
320
        Dictionary output of IRI_monthly_mean_parameters.
321
    aUT : array-like
322
        Array of universal times in hours used in PyIRI.
323
    alon : array-like
324
        Flattened array of geo longitudes in degrees.
325
    alat : array-like
326
        Flattened array of geo latitudes in degrees.
327
    alon_2d : array-like
328
        2-D array of geo longitudes in degrees.
329
    alat_2d : array-like
330
        2-D array of geo latitudes in degrees.
331
    sun : dict
332
        Dictionary output of IRI_monthly_mean_parameters.
333
    UT : float
334
        UT time frame from array aUT to plot.
335
    plot_dir : str
336
        Direction where to save the figure.
337
    plot_name : str
338
        Name for the output figure, without directory
339
        (default='PyIRI_M3000_min_max.png')
340

341
    """
342
    ind_time = np.where(aUT == UT)
×
343
    ind_grid = np.where(np.isfinite(alon))
×
344
    figname = os.path.join(plot_dir, plot_name)
×
345
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
346
                           constrained_layout=True)
347
    plt.xlim([-180, 180])
×
348
    plt.ylim([-90, 90])
×
349
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
350
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
351
    abc = ['(a)', '(b)']
×
352
    atitle = ['Solar Min', 'Solar Max']
×
353
    for isol in range(0, 2):
×
354
        ax[isol].set_facecolor('grey')
×
355
        ax[isol].set_xlabel('Geo Lon (°)')
×
356
        ax[isol].set_ylabel('Geo Lat (°)')
×
357
        if isol == 1:
×
358
            ax[1].set_ylabel(' ')
×
359
        z = np.reshape(F2['M3000'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
360
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
361
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
362
        ax[isol].text(140, 70, abc[isol], c='white')
×
363
        ax[isol].title.set_text(atitle[isol])
×
364
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
365
                         s=20, edgecolors="black", linewidths=0.5)
366
    cbar.set_label('MUF(3000)F2/$fo$F2')
×
367
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
368
    return
×
369

370

371
def PyIRI_plot_hmF2_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
372
                            UT, plot_dir, plot_name='PyIRI_hmF2_min_max.png'):
373
    """Plot hmF2 for solar min and max.
374

375
    Parameters
376
    ----------
377
    F2 : dict
378
        Dictionary output of IRI_monthly_mean_parameters.
379
    aUT : array-like
380
        Array of universal times in hours used in PyIRI.
381
    alon : array-like
382
        Flattened array of geo longitudes in degrees.
383
    alat : array-like
384
        Flattened array of geo latitudes in degrees.
385
    alon_2d : array-like
386
        2-D array of geo longitudes in degrees.
387
    alat_2d : array-like
388
        2-D array of geo latitudes in degrees.
389
    sun : dict
390
        Dictionary output of IRI_monthly_mean_parameters.
391
    UT : float
392
        UT time frame from array aUT to plot.
393
    plot_dir : str
394
        Direction where to save the figure.
395
    plot_name : str
396
        Name for the output figure, without directory
397
        (default='PyIRI_hmF2_min_max.png')
398

399
    """
400
    ind_time = np.where(aUT == UT)
×
401
    ind_grid = np.where(np.isfinite(alon))
×
402
    figname = os.path.join(plot_dir, plot_name)
×
403
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
404
                           constrained_layout=True)
405
    plt.xlim([-180, 180])
×
406
    plt.ylim([-90, 90])
×
407
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
408
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
409
    abc = ['(a)', '(b)']
×
410
    atitle = ['Solar Min', 'Solar Max']
×
411
    for isol in range(0, 2):
×
412
        ax[isol].set_facecolor('grey')
×
413
        ax[isol].set_xlabel('Geo Lon (°)')
×
414
        ax[isol].set_ylabel('Geo Lat (°)')
×
415
        if isol == 1:
×
416
            ax[1].set_ylabel(' ')
×
417
        z = np.reshape(F2['hm'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
418
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
419
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
420
        ax[isol].text(140, 70, abc[isol], c='white')
×
421
        ax[isol].title.set_text(atitle[isol])
×
422
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
423
                         s=20, edgecolors="black", linewidths=0.5)
424
    cbar.set_label('$hm$F2 (km)')
×
425
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
426
    return
×
427

428

429
def PyIRI_plot_hmF1_min_max(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
430
                            UT, plot_dir, plot_name='PyIRI_hmF1_min_max.png'):
431
    """Plot hmF1 for solar min and max.
432

433
    Parameters
434
    ----------
435
    F1 : dict
436
        Dictionary output of IRI_monthly_mean_parameters.
437
    aUT : array-like
438
        Array of universal times in hours used in PyIRI.
439
    alon : array-like
440
        Flattened array of geo longitudes in degrees.
441
    alat : array-like
442
        Flattened array of geo latitudes in degrees.
443
    alon_2d : array-like
444
        2-D array of geo longitudes in degrees.
445
    alat_2d : array-like
446
        2-D array of geo latitudes in degrees.
447
    sun : dict
448
        Dictionary output of IRI_monthly_mean_parameters.
449
    UT : float
450
        UT time frame from array aUT to plot.
451
    plot_dir : str
452
        Direction where to save the figure.
453
    plot_name : str
454
        Name for the output figure, without directory
455
        (default='PyIRI_hmF1_min_max.png')
456

457
    """
458
    ind_time = np.where(aUT == UT)
×
459
    ind_grid = np.where(np.isfinite(alon))
×
460
    figname = os.path.join(plot_dir, plot_name)
×
461
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
462
                           constrained_layout=True)
463
    plt.xlim([-180, 180])
×
464
    plt.ylim([-90, 90])
×
465
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
466
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
467
    abc = ['(a)', '(b)']
×
468
    atitle = ['Solar Min', 'Solar Max']
×
469
    for isol in range(0, 2):
×
470
        ax[isol].set_facecolor('grey')
×
471
        ax[isol].set_xlabel('Geo Lon (°)')
×
472
        ax[isol].set_ylabel('Geo Lat (°)')
×
473
        if isol == 1:
×
474
            ax[1].set_ylabel(' ')
×
475
        z = np.reshape(F1['hm'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
476
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
477
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
478
        ax[isol].text(140, 70, abc[isol], c='white')
×
479
        ax[isol].title.set_text(atitle[isol])
×
480
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
481
                         s=20, edgecolors="black", linewidths=0.5)
482
    cbar.set_label('$hm$F1 (km)')
×
483
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
484
    return
×
485

486

487
def PyIRI_plot_foEs_min_max(Es, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
488
                            UT, plot_dir, plot_name='PyIRI_foEs_min_max.png'):
489
    """Plot foEs for solar min and max.
490

491
    Parameters
492
    ----------
493
    Es : dict
494
        Dictionary output of IRI_monthly_mean_parameters.
495
    aUT : array-like
496
        Array of universal times in hours used in PyIRI.
497
    alon : array-like
498
        Flattened array of geo longitudes in degrees.
499
    alat : array-like
500
        Flattened array of geo latitudes in degrees.
501
    alon_2d : array-like
502
        2-D array of geo longitudes in degrees.
503
    alat_2d : array-like
504
        2-D array of geo latitudes in degrees.
505
    sun : dict
506
        Dictionary output of IRI_monthly_mean_parameters.
507
    UT : float
508
        UT time frame from array aUT to plot.
509
    plot_dir : str
510
        Direction where to save the figure.
511
    plot_name : str
512
        Name for the output figure, without directory
513
        (default='PyIRI_foEs_min_max.png')
514

515
    """
516
    ind_time = np.where(aUT == UT)
×
517
    ind_grid = np.where(np.isfinite(alon))
×
518
    figname = os.path.join(plot_dir, plot_name)
×
519
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
520
                           constrained_layout=True)
521
    plt.xlim([-180, 180])
×
522
    plt.ylim([-90, 90])
×
523
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
524
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
525
    abc = ['(a)', '(b)']
×
526
    atitle = ['Solar Min', 'Solar Max']
×
527
    for isol in range(0, 2):
×
528
        ax[isol].set_facecolor('grey')
×
529
        ax[isol].set_xlabel('Geo Lon (°)')
×
530
        ax[isol].set_ylabel('Geo Lat (°)')
×
531
        if isol == 1:
×
532
            ax[1].set_ylabel(' ')
×
533
        z = np.reshape(Es['fo'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
534
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
535
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
536
        ax[isol].text(140, 70, abc[isol], c='white')
×
537
        ax[isol].title.set_text(atitle[isol])
×
538
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
539
                         s=20, edgecolors="black", linewidths=0.5)
540
    cbar.set_label('$fo$Es (MHz)')
×
541
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
542
    return
×
543

544

545
def PyIRI_plot_foE_min_max(E, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
546
                           UT, plot_dir, plot_name='PyIRI_foE_min_max.png'):
547
    """Plot foE for solar min and max.
548

549
    Parameters
550
    ----------
551
    E : dict
552
        Dictionary output of IRI_monthly_mean_parameters.
553
    aUT : array-like
554
        Array of universal times in hours used in PyIRI.
555
    alon : array-like
556
        Flattened array of geo longitudes in degrees.
557
    alat : array-like
558
        Flattened array of geo latitudes in degrees.
559
    alon_2d : array-like
560
        2-D array of geo longitudes in degrees.
561
    alat_2d : array-like
562
        2-D array of geo latitudes in degrees.
563
    sun : dict
564
        Dictionary output of IRI_monthly_mean_parameters.
565
    UT : float
566
        UT time frame from array aUT to plot.
567
    plot_dir : str
568
        Direction where to save the figure.
569
    plot_name : str
570
        Name for the output figure, without directory
571
        (default='PyIRI_foE_min_max.png')
572

573
    """
574
    ind_time = np.where(aUT == UT)
×
575
    ind_grid = np.where(np.isfinite(alon))
×
576
    figname = os.path.join(plot_dir, plot_name)
×
577
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
578
                           constrained_layout=True)
579
    plt.xlim([-180, 180])
×
580
    plt.ylim([-90, 90])
×
581
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
582
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
583
    abc = ['(a)', '(b)']
×
584
    atitle = ['Solar Min', 'Solar Max']
×
585
    for isol in range(0, 2):
×
586
        ax[isol].set_facecolor('grey')
×
587
        ax[isol].set_xlabel('Geo Lon (°)')
×
588
        ax[isol].set_ylabel('Geo Lat (°)')
×
589
        if isol == 1:
×
590
            ax[1].set_ylabel(' ')
×
591
        z = np.reshape(E['fo'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
592
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
593
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
594
        ax[isol].text(140, 70, abc[isol], c='white')
×
595
        ax[isol].title.set_text(atitle[isol])
×
596
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
597
                         s=20, edgecolors="black", linewidths=0.5)
598
    cbar.set_label('$fo$E (MHz)')
×
599
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
600
    return
×
601

602

603
def PyIRI_plot_foF2_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
604
                            UT, plot_dir, plot_name='PyIRI_foF2_min_max.png'):
605
    """Plot foF2 for solar min and max.
606

607
    Parameters
608
    ----------
609
    F2 : dict
610
        Dictionary output of IRI_monthly_mean_parameters.
611
    aUT : array-like
612
        Array of universal times in hours used in PyIRI.
613
    alon : array-like
614
        Flattened array of geo longitudes in degrees.
615
    alat : array-like
616
        Flattened array of geo latitudes in degrees.
617
    alon_2d : array-like
618
        2-D array of geo longitudes in degrees.
619
    alat_2d : array-like
620
        2-D array of geo latitudes in degrees.
621
    sun : dict
622
        Dictionary output of IRI_monthly_mean_parameters.
623
    UT : float
624
        UT time frame from array aUT to plot.
625
    plot_dir : str
626
        Direction where to save the figure.
627
    plot_name : str
628
        Name for the output figure, without directory
629
        (default='PyIRI_foF2_min_max.png')
630

631
    """
632
    ind_time = np.where(aUT == UT)
×
633
    ind_grid = np.where(np.isfinite(alon))
×
634
    figname = os.path.join(plot_dir, plot_name)
×
635
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
636
                           constrained_layout=True)
637
    plt.xlim([-180, 180])
×
638
    plt.ylim([-90, 90])
×
639
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
640
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
641
    abc = ['(a)', '(b)']
×
642
    atitle = ['Solar Min', 'Solar Max']
×
643
    for isol in range(0, 2):
×
644
        ax[isol].set_facecolor('grey')
×
645
        ax[isol].set_xlabel('Geo Lon (°)')
×
646
        ax[isol].set_ylabel('Geo Lat (°)')
×
647
        if isol == 1:
×
648
            ax[1].set_ylabel(' ')
×
649
        z = np.reshape(F2['fo'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
650
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
651
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
652
        ax[isol].text(140, 70, abc[isol], c='white')
×
653
        ax[isol].title.set_text(atitle[isol])
×
654
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
655
                         s=20, edgecolors="black", linewidths=0.5)
656
    cbar.set_label('$fo$F2 (MHz)')
×
657
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
658
    return
×
659

660

661
def PyIRI_plot_NmF2_min_max(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
662
                            UT, plot_dir, plot_name='PyIRI_NmF2_min_max.png'):
663
    """Plot NmF2 for solar min and max.
664

665
    Parameters
666
    ----------
667
    F2 : dict
668
        Dictionary output of IRI_monthly_mean_parameters.
669
    aUT : array-like
670
        Array of universal times in hours used in PyIRI.
671
    alon : array-like
672
        Flattened array of geo longitudes in degrees.
673
    alat : array-like
674
        Flattened array of geo latitudes in degrees.
675
    alon_2d : array-like
676
        2-D array of geo longitudes in degrees.
677
    alat_2d : array-like
678
        2-D array of geo latitudes in degrees.
679
    sun : dict
680
        Dictionary output of IRI_monthly_mean_parameters.
681
    UT : float
682
        UT time frame from array aUT to plot.
683
    plot_dir : str
684
        Direction where to save the figure.
685
    plot_name : str
686
        Name for the output figure, without directory
687
        (default='PyIRI_NmF2_min_max.png')
688

689
    """
690
    ind_time = np.where(aUT == UT)
×
691
    ind_grid = np.where(np.isfinite(alon))
×
692
    figname = os.path.join(plot_dir, plot_name)
×
693
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
694
                           constrained_layout=True)
695
    plt.xlim([-180, 180])
×
696
    plt.ylim([-90, 90])
×
697
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
698
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
699
    abc = ['(a)', '(b)']
×
700
    atitle = ['Solar Min', 'Solar Max']
×
701
    for isol in range(0, 2):
×
702
        ax[isol].set_facecolor('grey')
×
703
        ax[isol].set_xlabel('Geo Lon (°)')
×
704
        ax[isol].set_ylabel('Geo Lat (°)')
×
705
        if isol == 1:
×
706
            ax[1].set_ylabel(' ')
×
707
        z = np.reshape(F2['Nm'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
708
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
709
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
710
        ax[isol].text(140, 70, abc[isol], c='white')
×
711
        ax[isol].title.set_text(atitle[isol])
×
712
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time],
×
713
                         c='red', s=20, edgecolors="black", linewidths=0.5)
714
    cbar.set_label('$Nm$F2 (m$^{-3}$)')
×
715
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
716
    return
×
717

718

719
def PyIRI_plot_NmF1_min_max(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
720
                            UT, plot_dir, plot_name='PyIRI_NmF1_min_max.png'):
721
    """Plot NmF1 for solar min and max.
722

723
    Parameters
724
    ----------
725
    F1 : dict
726
        Dictionary output of IRI_monthly_mean_parameters.
727
    aUT : array-like
728
        Array of universal times in hours used in PyIRI.
729
    alon : array-like
730
        Flattened array of geo longitudes in degrees.
731
    alat : array-like
732
        Flattened array of geo latitudes in degrees.
733
    alon_2d : array-like
734
        2-D array of geo longitudes in degrees.
735
    alat_2d : array-like
736
        2-D array of geo latitudes in degrees.
737
    sun : dict
738
        Dictionary output of IRI_monthly_mean_parameters.
739
    UT : float
740
        UT time frame from array aUT to plot.
741
    plot_dir : str
742
        Direction where to save the figure.
743
    plot_name : str
744
        Name for the output figure, without directory
745
        (default='PyIRI_NmF1_min_max.png')
746

747
    """
748
    ind_time = np.where(aUT == UT)
×
749
    ind_grid = np.where(np.isfinite(alon))
×
750
    figname = os.path.join(plot_dir, plot_name)
×
751
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
752
                           constrained_layout=True)
753
    plt.xlim([-180, 180])
×
754
    plt.ylim([-90, 90])
×
755
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
756
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
757
    abc = ['(a)', '(b)']
×
758
    atitle = ['Solar Min', 'Solar Max']
×
759
    for isol in range(0, 2):
×
760
        ax[isol].set_facecolor('grey')
×
761
        ax[isol].set_xlabel('Geo Lon (°)')
×
762
        ax[isol].set_ylabel('Geo Lat (°)')
×
763
        if isol == 1:
×
764
            ax[1].set_ylabel(' ')
×
765
        z = np.reshape(F1['Nm'][ind_time, ind_grid, isol], alon_2d.shape)
×
NEW
766
        mesh = ax[isol].pcolormesh(alon_2d, alat_2d, z)
×
NEW
767
        cbar = fig.colorbar(mesh, ax=ax[isol])
×
768
        ax[isol].text(140, 70, abc[isol], c='white')
×
769
        ax[isol].title.set_text(atitle[isol])
×
770
        ax[isol].scatter(sun['lon'][ind_time], sun['lat'][ind_time],
×
771
                         c='red', s=20, edgecolors="black", linewidths=0.5)
772
    cbar.set_label('$Nm$F1 (m$^{-3}$)')
×
773
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
774
    return
×
775

776

777
def PyIRI_plot_foF1_min_max(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
778
                            UT, plot_dir, plot_name='PyIRI_foF1_min_max.png'):
779
    """Plot foF1 for solar min and max.
780

781
    Parameters
782
    ----------
783
    F1 : dict
784
        Dictionary output of IRI_monthly_mean_parameters.
785
    aUT : array-like
786
        Array of universal times in hours used in PyIRI.
787
    alon : array-like
788
        Flattened array of geo longitudes in degrees.
789
    alat : array-like
790
        Flattened array of geo latitudes in degrees.
791
    alon_2d : array-like
792
        2-D array of geo longitudes in degrees.
793
    alat_2d : array-like
794
        2-D array of geo latitudes in degrees.
795
    sun : dict
796
        Dictionary output of IRI_monthly_mean_parameters.
797
    UT : float
798
        UT time frame from array aUT to plot.
799
    plot_dir : str
800
        Direction where to save the figure.
801
    plot_name : str
802
        Name for the output figure, without directory
803
        (default='PyIRI_foF1_min_max.png')
804

805
    """
806
    ind_time = np.where(aUT == UT)
×
807
    ind_grid = np.where(np.isfinite(alon))
×
808
    figname = os.path.join(plot_dir, plot_name)
×
809
    fig, ax = plt.subplots(1, 3, sharex=True, sharey=True, figsize=(10, 3),
×
810
                           constrained_layout=True)
811
    ax[0].set_facecolor('grey')
×
812
    ax[0].set_xlabel('Geo Lon (°)')
×
813
    ax[0].set_ylabel('Geo Lat (°)')
×
814
    plt.xlim([-180, 180])
×
815
    plt.ylim([-90, 90])
×
816
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
817
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
818
    abc = ['(a)', '(b)', '(c)']
×
819
    ax[0].text(130, 70, abc[0], c='white')
×
820
    P = F1['P'][ind_time, ind_grid, 0]
×
821
    foF1_min = F1['fo'][ind_time, ind_grid, 0]
×
822
    foF1_max = F1['fo'][ind_time, ind_grid, 1]
×
823
    # --------------------------------
824
    z = np.reshape(P, alon_2d.shape)
×
NEW
825
    mesh = ax[0].pcolormesh(alon_2d, alat_2d, z)
×
NEW
826
    cbar0 = fig.colorbar(mesh, ax=ax[0])
×
UNCOV
827
    ax[0].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20,
×
828
                  edgecolors="black", linewidths=0.5, zorder=2)
829
    cbar0.set_label('Probability')
×
830
    ax[1].set_facecolor('grey')
×
831
    ax[1].set_xlabel('Geo Lon (°)')
×
832
    ax[1].set_ylabel(' ')
×
833
    ax[1].text(130, 70, abc[1], c='white')
×
834
    ax[1].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20,
×
835
                  edgecolors="black", linewidths=0.5, zorder=2)
836
    # --------------------------------
837
    z = np.reshape(foF1_min, alon_2d.shape)
×
NEW
838
    mesh = ax[1].pcolormesh(alon_2d, alat_2d, z)
×
NEW
839
    cbar1 = fig.colorbar(mesh, ax=ax[1])
×
840
    cbar1.set_label('$fo$F1 (MHz)')
×
841
    ax[2].set_facecolor('grey')
×
842
    ax[2].set_xlabel('Geo Lon (°)')
×
843
    ax[2].set_ylabel(' ')
×
844
    ax[2].text(130, 70, abc[2], c='white')
×
845
    ax[2].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20,
×
846
                  edgecolors="black", linewidths=0.5, zorder=2)
847
    # --------------------------------
848
    z2 = np.reshape(foF1_max, alon_2d.shape)
×
NEW
849
    mesh = ax[2].pcolormesh(alon_2d, alat_2d, z2)
×
NEW
850
    cbar = fig.colorbar(mesh, ax=ax[2])
×
NEW
851
    cbar.set_label('$fo$F1 (MHz)')
×
852
    ax[0].title.set_text('Probability')
×
853
    ax[1].title.set_text('Solar Min')
×
854
    ax[2].title.set_text('Solar Max')
×
855
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
856
    return
×
857

858

859
def PyIRI_EDP_sample(EDP, aUT, alon, alat, lon_plot, lat_plot, aalt,
7✔
860
                     UT, plot_dir, plot_name='PyIRI_EDP_sample.png'):
861
    """Plot EDP for one location for solar min and max.
862

863
    Parameters
864
    ----------
865
    EDP : array-like
866
        3-D electron density array output of IRI_monthly_mean_parameters.
867
    aUT : array-like
868
        Array of universal times in hours used in PyIRI
869
    alon : array-like
870
        Flattened array of geo longitudes in degrees.
871
    alat : array-like
872
        Flattened array of geo latitudes in degrees.
873
    lon_plot : float
874
        Longitude location for EDP.
875
    lat_plot : array-like
876
        Latitude location for EDP.
877
    sun : dict
878
        Dictionary output of IRI_monthly_mean_parameters.
879
    UT : float
880
        UT time frame from array aUT to plot.
881
    plot_dir : str
882
        Direction where to save the figure.
883
    plot_name : str
884
        Name for the output figure, without directory
885
        (default='PyIRI_EDP_sample.png')
886

887
    """
888
    figname = os.path.join(plot_dir, plot_name)
×
NEW
889
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(5, 5),
×
890
                           constrained_layout=True)
891
    ax.set_xlabel('Electron Density (m$^{-3}$)')
×
892
    ax.set_ylabel('Altitude (km)')
×
893
    ax.set_facecolor("grey")
×
894
    ind_grid = np.where((alon == lon_plot) & (alat == lat_plot))
×
895
    ind_time = np.where(aUT == UT)
×
896
    ind_vert = np.where(aalt >= 0)
×
897
    ind_min = 0, ind_time, ind_vert, ind_grid
×
898
    x = np.reshape(EDP[ind_min], aalt.shape)
×
NEW
899
    ax.plot(x, aalt, c='black', label='Sol min', linewidth=1)
×
900
    ind_max = 1, ind_time, ind_vert, ind_grid
×
901
    x = np.reshape(EDP[ind_max], aalt.shape)
×
NEW
902
    ax.plot(x, aalt, c='white', label='Sol max', linewidth=1)
×
903
    ax.legend(loc='upper right', prop={'size': 8})
×
904
    plt.title(str(lon_plot) + ' Lon, ' + str(lat_plot) + ' Lat')
×
905
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
906
    return
×
907

908

909
def PyIRI_EDP_sample_1day(EDP, aUT, alon, alat, lon_plot, lat_plot, aalt,
7✔
910
                          UT, plot_dir, plot_name='PyIRI_EDP_sample_1day.png'):
911
    """Plot EDP for one location.
912

913
    Parameters
914
    ----------
915
    EDP : array-like
916
        3-D electron density array output of IRI_density_1day.
917
    aUT : array-like
918
        Array of universal times in hours used in PyIRI
919
    alon : array-like
920
        Flattened array of geo longitudes in degrees.
921
    alat : array-like
922
        Flattened array of geo latitudes in degrees.
923
    lon_plot : float
924
        Longitude location for EDP.
925
    lat_plot : array-like
926
        Latitude location for EDP.
927
    sun : dict
928
        Dictionary output of IRI_monthly_mean_parameters.
929
    UT : float
930
        UT time frame from array aUT to plot.
931
    plot_dir : str
932
        Direction where to save the figure.
933
    plot_name : str
934
        Name for the output figure, without directory
935
        (default='PyIRI_EDP_sample_1day.png')
936

937
    """
938
    figname = os.path.join(plot_dir, plot_name)
×
NEW
939
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(5, 5),
×
940
                           constrained_layout=True)
941
    ax.set_xlabel('Electron Density (m$^{-3}$)')
×
942
    ax.set_ylabel('Altitude (km)')
×
943
    ax.set_facecolor("grey")
×
944
    ind_grid = np.where((alon == lon_plot) & (alat == lat_plot))
×
945
    ind_time = np.where(aUT == UT)
×
946
    ind_vert = np.where(aalt >= 0)
×
947
    ind = ind_time, ind_vert, ind_grid
×
948
    x = np.reshape(EDP[ind], aalt.shape)
×
NEW
949
    ax.plot(x, aalt, c='black', linewidth=1)
×
950
    plt.title(str(lon_plot) + ' Lon, ' + str(lat_plot) + ' Lat')
×
951
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
952
    return
×
953

954

955
def PyIRI_plot_B_F1_bot(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
956
                        UT, plot_dir, plot_name='PyIRI_B_F1_bot.png'):
957
    """Plot thickness of F1 bottom side.
958

959
    Parameters
960
    ----------
961
    F1 : dict
962
        Dictionary output of IRI_monthly_mean_parameters.
963
    aUT : array-like
964
        Array of universal times in hours used in PyIRI.
965
    alon : array-like
966
        Flattened array of geo longitudes in degrees.
967
    alat : array-like
968
        Flattened array of geo latitudes in degrees.
969
    alon_2d : array-like
970
        2-D array of geo longitudes in degrees.
971
    alat_2d : array-like
972
        2-D array of geo latitudes in degrees.
973
    sun : dict
974
        Dictionary output of IRI_monthly_mean_parameters.
975
    UT : float
976
        UT time frame from array aUT to plot.
977
    plot_dir : str
978
        Direction where to save the figure.
979
    plot_name : str
980
        Name for the output figure, without directory
981
        (default='PyIRI_B_F1_bot.png')
982

983
    """
984
    ind_time = np.where(aUT == UT)
×
985
    ind_grid = np.where(np.isfinite(alon))
×
986
    figname = os.path.join(plot_dir, plot_name)
×
NEW
987
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
988
                           constrained_layout=True)
989
    plt.xlim([-180, 180])
×
990
    plt.ylim([-90, 90])
×
991
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
992
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
993
    ax.set_facecolor('grey')
×
994
    ax.set_xlabel('Geo Lon (°)')
×
995
    ax.set_ylabel('Geo Lat (°)')
×
996
    z = np.reshape(F1['B_bot'][ind_time, ind_grid], alon_2d.shape)
×
NEW
997
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
998
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
999
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1000
               s=20, edgecolors="black", linewidths=0.5)
1001
    cbar.set_label('$B^{F1}_{bot}$ (km)')
×
1002
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1003
    return
×
1004

1005

1006
def PyIRI_plot_B_F2_bot(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1007
                        UT, plot_dir,
1008
                        plot_name='PyIRI_B_F2_bot.png'):
1009
    """Plot thickness of F2 bottom side.
1010

1011
    Parameters
1012
    ----------
1013
    F2 : dict
1014
        Dictionary output of IRI_monthly_mean_parameters.
1015
    aUT : array-like
1016
        Array of universal times in hours used in PyIRI
1017
    alon : array-like
1018
        Flattened array of geo longitudes in degrees.
1019
    alat : array-like
1020
        Flattened array of geo latitudes in degrees.
1021
    alon_2d : array-like
1022
        2-D array of geo longitudes in degrees.
1023
    alat_2d : array-like
1024
        2-D array of geo latitudes in degrees.
1025
    sun : dict
1026
        Dictionary output of IRI_monthly_mean_parameters.
1027
    UT : float
1028
        UT time frame from array aUT to plot.
1029
    plot_dir : str
1030
        Direction where to save the figure.
1031
    plot_name : str
1032
        Name for the output figure, without directory
1033
        (default='PyIRI_B_F2_bot.png')
1034

1035
    """
1036
    ind_time = np.where(aUT == UT)
×
1037
    ind_grid = np.where(np.isfinite(alon))
×
1038
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1039
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1040
                           constrained_layout=True)
1041
    plt.xlim([-180, 180])
×
1042
    plt.ylim([-90, 90])
×
1043
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1044
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1045
    ax.set_facecolor('grey')
×
1046
    ax.set_xlabel('Geo Lon (°)')
×
1047
    ax.set_ylabel('Geo Lat (°)')
×
1048
    z = np.reshape(F2['B_bot'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1049
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1050
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1051
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1052
               s=20, edgecolors="black", linewidths=0.5)
1053
    cbar.set_label('$B^{F2}_{bot}$ (km)')
×
1054
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1055
    return
×
1056

1057

1058
def PyIRI_plot_B_F2_top(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1059
                        UT, plot_dir,
1060
                        plot_name='PyIRI_B_F2_top.png'):
1061
    """Plot thickness of F2 topside.
1062

1063
    Parameters
1064
    ----------
1065
    F2 : dict
1066
        Dictionary output of IRI_monthly_mean_parameters.
1067
    aUT : array-like
1068
        Array of universal times in hours used in PyIRI.
1069
    alon : array-like
1070
        Flattened array of geo longitudes in degrees.
1071
    alat : array-like
1072
        Flattened array of geo latitudes in degrees.
1073
    alon_2d : array-like
1074
        2-D array of geo longitudes in degrees.
1075
    alat_2d : array-like
1076
        2-D array of geo latitudes in degrees.
1077
    sun : dict
1078
        Dictionary output of IRI_monthly_mean_parameters.
1079
    UT : float
1080
        UT time frame from array aUT to plot.
1081
    plot_dir : str
1082
        Direction where to save the figure.
1083
    plot_name : str
1084
        Name for the output figure, without directory
1085
        (default='PyIRI_B_F2_top.png')
1086

1087
    """
1088
    ind_time = np.where(aUT == UT)
×
1089
    ind_grid = np.where(np.isfinite(alon))
×
1090
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1091
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1092
                           constrained_layout=True)
1093
    plt.xlim([-180, 180])
×
1094
    plt.ylim([-90, 90])
×
1095
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1096
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1097
    ax.set_facecolor('grey')
×
1098
    ax.set_xlabel('Geo Lon (°)')
×
1099
    ax.set_ylabel('Geo Lat (°)')
×
1100
    z = np.reshape(F2['B_top'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1101
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1102
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1103
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1104
               s=20, edgecolors="black", linewidths=0.5)
1105
    cbar.set_label('$B^{F2}_{top}$ (km)')
×
1106
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1107
    return
×
1108

1109

1110
def PyIRI_plot_M3000(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1111
                     UT, plot_dir, plot_name='PyIRI_M3000.png'):
1112
    """Plot M3000 propagation parameter.
1113

1114
    Parameters
1115
    ----------
1116
    F2 : dict
1117
        Dictionary output of IRI_monthly_mean_parameters.
1118
    aUT : array-like
1119
        Array of universal times in hours used in PyIRI.
1120
    alon : array-like
1121
        Flattened array of geo longitudes in degrees.
1122
    alat : array-like
1123
        Flattened array of geo latitudes in degrees.
1124
    alon_2d : array-like
1125
        2-D array of geo longitudes in degrees.
1126
    alat_2d : array-like
1127
        2-D array of geo latitudes in degrees.
1128
    sun : dict
1129
        Dictionary output of IRI_monthly_mean_parameters.
1130
    UT : float
1131
        UT time frame from array aUT to plot.
1132
    plot_dir : str
1133
        Direction where to save the figure.
1134
    plot_name : str
1135
        Name for the output figure, without directory
1136
        (default='PyIRI_M3000.png')
1137

1138
    """
1139
    ind_time = np.where(aUT == UT)
×
1140
    ind_grid = np.where(np.isfinite(alon))
×
1141
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1142
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1143
                           constrained_layout=True)
1144
    plt.xlim([-180, 180])
×
1145
    plt.ylim([-90, 90])
×
1146
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1147
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1148
    ax.set_facecolor('grey')
×
1149
    ax.set_xlabel('Geo Lon (°)')
×
1150
    ax.set_ylabel('Geo Lat (°)')
×
1151
    z = np.reshape(F2['M3000'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1152
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1153
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1154
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1155
               s=20, edgecolors="black", linewidths=0.5)
1156
    cbar.set_label('MUF(3000)F2/$fo$F2')
×
1157
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1158
    return
×
1159

1160

1161
def PyIRI_plot_hmF2(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1162
                    UT, plot_dir, plot_name='PyIRI_hmF2.png'):
1163
    """Plot hmF2.
1164

1165
    Parameters
1166
    ----------
1167
    F2 : dict
1168
        Dictionary output of IRI_monthly_mean_parameters.
1169
    aUT : array-like
1170
        Array of universal times in hours used in PyIRI.
1171
    alon : array-like
1172
        Flattened array of geo longitudes in degrees.
1173
    alat : array-like
1174
        Flattened array of geo latitudes in degrees.
1175
    alon_2d : array-like
1176
        2-D array of geo longitudes in degrees.
1177
    alat_2d : array-like
1178
        2-D array of geo latitudes in degrees.
1179
    sun : dict
1180
        Dictionary output of IRI_monthly_mean_parameters.
1181
    UT : float
1182
        UT time frame from array aUT to plot.
1183
    plot_dir : str
1184
        Direction where to save the figure.
1185
    plot_name : str
1186
        Name for the output figure, without directory
1187
        (default='PyIRI_hmF2.png')
1188

1189
    """
1190
    ind_time = np.where(aUT == UT)
×
1191
    ind_grid = np.where(np.isfinite(alon))
×
1192
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1193
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1194
                           constrained_layout=True)
1195
    plt.xlim([-180, 180])
×
1196
    plt.ylim([-90, 90])
×
1197
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1198
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1199
    ax.set_facecolor('grey')
×
1200
    ax.set_xlabel('Geo Lon (°)')
×
1201
    ax.set_ylabel('Geo Lat (°)')
×
1202
    z = np.reshape(F2['hm'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1203
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1204
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1205
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1206
               s=20, edgecolors="black", linewidths=0.5)
1207
    cbar.set_label('$hm$F2 (km)')
×
1208
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1209
    return
×
1210

1211

1212
def PyIRI_plot_hmF1(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1213
                    UT, plot_dir, plot_name='PyIRI_hmF1.png'):
1214
    """Plot hmF1 for solar min and max.
1215

1216
    Parameters
1217
    ----------
1218
    F1 : dict
1219
        Dictionary output of IRI_monthly_mean_parameters.
1220
    aUT : array-like
1221
        Array of universal times in hours used in PyIRI.
1222
    alon : array-like
1223
        Flattened array of geo longitudes in degrees.
1224
    alat : array-like
1225
        Flattened array of geo latitudes in degrees.
1226
    alon_2d : array-like
1227
        2-D array of geo longitudes in degrees.
1228
    alat_2d : array-like
1229
        2-D array of geo latitudes in degrees.
1230
    sun : dict
1231
        Dictionary output of IRI_monthly_mean_parameters.
1232
    UT : float
1233
        UT time frame from array aUT to plot.
1234
    plot_dir : str
1235
        Direction where to save the figure.
1236
    plot_name : str
1237
        Name for the output figure, without directory
1238
        (default='PyIRI_hmF1_min_max.png')
1239

1240
    """
1241
    ind_time = np.where(aUT == UT)
×
1242
    ind_grid = np.where(np.isfinite(alon))
×
1243
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1244
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1245
                           constrained_layout=True)
1246
    plt.xlim([-180, 180])
×
1247
    plt.ylim([-90, 90])
×
1248
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1249
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1250
    ax.set_facecolor('grey')
×
1251
    ax.set_xlabel('Geo Lon (°)')
×
1252
    ax.set_ylabel('Geo Lat (°)')
×
1253
    z = np.reshape(F1['hm'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1254
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1255
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1256
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1257
               s=20, edgecolors="black", linewidths=0.5)
1258
    cbar.set_label('$hm$F1 (km)')
×
1259
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1260
    return
×
1261

1262

1263
def PyIRI_plot_foEs(Es, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1264
                    UT, plot_dir, plot_name='PyIRI_foEs.png'):
1265
    """Plot foEs.
1266

1267
    Parameters
1268
    ----------
1269
    Es : dict
1270
        Dictionary output of IRI_monthly_mean_parameters.
1271
    aUT : array-like
1272
        Array of universal times in hours used in PyIRI.
1273
    alon : array-like
1274
        Flattened array of geo longitudes in degrees.
1275
    alat : array-like
1276
        Flattened array of geo latitudes in degrees.
1277
    alon_2d : array-like
1278
        2-D array of geo longitudes in degrees.
1279
    alat_2d : array-like
1280
        2-D array of geo latitudes in degrees.
1281
    sun : dict
1282
        Dictionary output of IRI_monthly_mean_parameters.
1283
    UT : float
1284
        UT time frame from array aUT to plot.
1285
    plot_dir : str
1286
        Direction where to save the figure.
1287
    plot_name : str
1288
        Name for the output figure, without directory
1289
        (default='PyIRI_foEs_min_max.png')
1290

1291
    """
1292
    ind_time = np.where(aUT == UT)
×
1293
    ind_grid = np.where(np.isfinite(alon))
×
1294
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1295
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1296
                           constrained_layout=True)
1297
    plt.xlim([-180, 180])
×
1298
    plt.ylim([-90, 90])
×
1299
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1300
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1301
    ax.set_facecolor('grey')
×
1302
    ax.set_xlabel('Geo Lon (°)')
×
1303
    ax.set_ylabel('Geo Lat (°)')
×
1304
    z = np.reshape(Es['fo'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1305
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1306
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1307
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1308
               s=20, edgecolors="black", linewidths=0.5)
1309
    cbar.set_label('$fo$Es (MHz)')
×
1310
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1311
    return
×
1312

1313

1314
def PyIRI_plot_foE(E, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1315
                   UT, plot_dir, plot_name='PyIRI_foE.png'):
1316
    """Plot foE.
1317

1318
    Parameters
1319
    ----------
1320
    E : dict
1321
        Dictionary output of IRI_monthly_mean_parameters.
1322
    aUT : array-like
1323
        Array of universal times in hours used in PyIRI.
1324
    alon : array-like
1325
        Flattened array of geo longitudes in degrees.
1326
    alat : array-like
1327
        Flattened array of geo latitudes in degrees.
1328
    alon_2d : array-like
1329
        2-D array of geo longitudes in degrees.
1330
    alat_2d : array-like
1331
        2-D array of geo latitudes in degrees.
1332
    sun : dict
1333
        Dictionary output of IRI_monthly_mean_parameters.
1334
    UT : float
1335
        UT time frame from array aUT to plot.
1336
    plot_dir : str
1337
        Direction where to save the figure.
1338
    plot_name : str
1339
        Name for the output figure, without directory
1340
        (default='PyIRI_foE_min_max.png')
1341

1342
    """
1343
    ind_time = np.where(aUT == UT)
×
1344
    ind_grid = np.where(np.isfinite(alon))
×
1345
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1346
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1347
                           constrained_layout=True)
1348
    plt.xlim([-180, 180])
×
1349
    plt.ylim([-90, 90])
×
1350
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1351
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1352
    ax.set_facecolor('grey')
×
1353
    ax.set_xlabel('Geo Lon (°)')
×
1354
    ax.set_ylabel('Geo Lat (°)')
×
1355
    z = np.reshape(E['fo'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1356
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1357
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1358
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1359
               s=20, edgecolors="black", linewidths=0.5)
1360
    cbar.set_label('$fo$E (MHz)')
×
1361
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1362
    return
×
1363

1364

1365
def PyIRI_plot_foF2(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1366
                    UT, plot_dir, plot_name='PyIRI_foF2.png'):
1367
    """Plot foF2.
1368

1369
    Parameters
1370
    ----------
1371
    F2 : dict
1372
        Dictionary output of IRI_monthly_mean_parameters.
1373
    aUT : array-like
1374
        Array of universal times in hours used in PyIRI.
1375
    alon : array-like
1376
        Flattened array of geo longitudes in degrees.
1377
    alat : array-like
1378
        Flattened array of geo latitudes in degrees.
1379
    alon_2d : array-like
1380
        2-D array of geo longitudes in degrees.
1381
    alat_2d : array-like
1382
        2-D array of geo latitudes in degrees.
1383
    sun : dict
1384
        Dictionary output of IRI_monthly_mean_parameters.
1385
    UT : float
1386
        UT time frame from array aUT to plot.
1387
    plot_dir : str
1388
        Direction where to save the figure.
1389
    plot_name : str
1390
        Name for the output figure, without directory
1391
        (default='PyIRI_foF2_min_max.png')
1392

1393
    """
1394
    ind_time = np.where(aUT == UT)
×
1395
    ind_grid = np.where(np.isfinite(alon))
×
1396
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1397
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1398
                           constrained_layout=True)
1399
    plt.xlim([-180, 180])
×
1400
    plt.ylim([-90, 90])
×
1401
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1402
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1403
    ax.set_facecolor('grey')
×
1404
    ax.set_xlabel('Geo Lon (°)')
×
1405
    ax.set_ylabel('Geo Lat (°)')
×
1406
    z = np.reshape(F2['fo'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1407
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1408
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1409
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red',
×
1410
               s=20, edgecolors="black", linewidths=0.5)
1411
    cbar.set_label('$fo$F2 (MHz)')
×
1412
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1413
    return
×
1414

1415

1416
def PyIRI_plot_NmF2(F2, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1417
                    UT, plot_dir, plot_name='PyIRI_NmF2.png'):
1418
    """Plot NmF2.
1419

1420
    Parameters
1421
    ----------
1422
    F2 : dict
1423
        Dictionary output of IRI_monthly_mean_parameters.
1424
    aUT : array-like
1425
        Array of universal times in hours used in PyIRI.
1426
    alon : array-like
1427
        Flattened array of geo longitudes in degrees.
1428
    alat : array-like
1429
        Flattened array of geo latitudes in degrees.
1430
    alon_2d : array-like
1431
        2-D array of geo longitudes in degrees.
1432
    alat_2d : array-like
1433
        2-D array of geo latitudes in degrees.
1434
    sun : dict
1435
        Dictionary output of IRI_monthly_mean_parameters.
1436
    UT : float
1437
        UT time frame from array aUT to plot.
1438
    plot_dir : str
1439
        Direction where to save the figure.
1440
    plot_name : str
1441
        Name for the output figure, without directory
1442
        (default='PyIRI_NmF2_min_max.png')
1443

1444
    """
1445
    ind_time = np.where(aUT == UT)
×
1446
    ind_grid = np.where(np.isfinite(alon))
×
1447
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1448
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1449
                           constrained_layout=True)
1450
    plt.xlim([-180, 180])
×
1451
    plt.ylim([-90, 90])
×
1452
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1453
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1454
    ax.set_facecolor('grey')
×
1455
    ax.set_xlabel('Geo Lon (°)')
×
1456
    ax.set_ylabel('Geo Lat (°)')
×
1457
    z = np.reshape(F2['Nm'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1458
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1459
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1460
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time],
×
1461
               c='red', s=20, edgecolors="black", linewidths=0.5)
1462
    cbar.set_label('$Nm$F2 (m$^{-3}$)')
×
1463
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1464
    return
×
1465

1466

1467
def PyIRI_plot_NmF1(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1468
                    UT, plot_dir, plot_name='PyIRI_NmF1.png'):
1469
    """Plot NmF1.
1470

1471
    Parameters
1472
    ----------
1473
    F1 : dict
1474
        Dictionary output of IRI_monthly_mean_parameters.
1475
    aUT : array-like
1476
        Array of universal times in hours used in PyIRI.
1477
    alon : array-like
1478
        Flattened array of geo longitudes in degrees.
1479
    alat : array-like
1480
        Flattened array of geo latitudes in degrees.
1481
    alon_2d : array-like
1482
        2-D array of geo longitudes in degrees.
1483
    alat_2d : array-like
1484
        2-D array of geo latitudes in degrees.
1485
    sun : dict
1486
        Dictionary output of IRI_monthly_mean_parameters.
1487
    UT : float
1488
        UT time frame from array aUT to plot.
1489
    plot_dir : str
1490
        Direction where to save the figure.
1491
    plot_name : str
1492
        Name for the output figure, without directory
1493
        (default='PyIRI_NmF1_min_max.png')
1494

1495
    """
1496
    ind_time = np.where(aUT == UT)
×
1497
    ind_grid = np.where(np.isfinite(alon))
×
1498
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1499
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1500
                           constrained_layout=True)
1501
    plt.xlim([-180, 180])
×
1502
    plt.ylim([-90, 90])
×
1503
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1504
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1505
    ax.set_facecolor('grey')
×
1506
    ax.set_xlabel('Geo Lon (°)')
×
1507
    ax.set_ylabel('Geo Lat (°)')
×
1508
    z = np.reshape(F1['Nm'][ind_time, ind_grid], alon_2d.shape)
×
NEW
1509
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1510
    cbar = fig.colorbar(mesh, ax=ax)
×
UNCOV
1511
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time],
×
1512
               c='red', s=20, edgecolors="black", linewidths=0.5)
1513
    cbar.set_label('$Nm$F1 (m$^{-3}$)')
×
1514
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1515
    return
×
1516

1517

1518
def PyIRI_plot_foF1(F1, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1519
                    UT, plot_dir, plot_name='PyIRI_foF1.png'):
1520
    """Plot foF1.
1521

1522
    Parameters
1523
    ----------
1524
    F1 : dict
1525
        Dictionary output of IRI_monthly_mean_parameters.
1526
    aUT : array-like
1527
        Array of universal times in hours used in PyIRI.
1528
    alon : array-like
1529
        Flattened array of geo longitudes in degrees.
1530
    alat : array-like
1531
        Flattened array of geo latitudes in degrees.
1532
    alon_2d : array-like
1533
        2-D array of geo longitudes in degrees.
1534
    alat_2d : array-like
1535
        2-D array of geo latitudes in degrees.
1536
    sun : dict
1537
        Dictionary output of IRI_monthly_mean_parameters.
1538
    UT : float
1539
        UT time frame from array aUT to plot.
1540
    plot_dir : str
1541
        Direction where to save the figure.
1542
    plot_name : str
1543
        Name for the output figure, without directory
1544
        (default='PyIRI_foF1_min_max.png')
1545

1546
    """
1547
    ind_time = np.where(aUT == UT)
×
1548
    ind_grid = np.where(np.isfinite(alon))
×
1549
    figname = os.path.join(plot_dir, plot_name)
×
1550
    fig, ax = plt.subplots(1, 2, sharex=True, sharey=True, figsize=(8, 3),
×
1551
                           constrained_layout=True)
1552
    ax[0].set_facecolor('grey')
×
1553
    ax[0].set_xlabel('Geo Lon (°)')
×
1554
    ax[0].set_ylabel('Geo Lat (°)')
×
1555
    plt.xlim([-180, 180])
×
1556
    plt.ylim([-90, 90])
×
1557
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
1558
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
1559
    abc = ['(a)', '(b)']
×
1560
    ax[0].text(130, 70, abc[0], c='white')
×
1561
    P = F1['P'][ind_time, ind_grid]
×
1562
    foF1 = F1['fo'][ind_time, ind_grid]
×
1563
    # --------------------------------
1564
    z = np.reshape(P, alon_2d.shape)
×
NEW
1565
    mesh = ax[0].pcolormesh(alon_2d, alat_2d, z)
×
NEW
1566
    cbar0 = fig.colorbar(mesh, ax=ax[0])
×
UNCOV
1567
    ax[0].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20,
×
1568
                  edgecolors="black", linewidths=0.5, zorder=2)
1569
    cbar0.set_label('Probability')
×
1570
    ax[1].set_facecolor('grey')
×
1571
    ax[1].set_xlabel('Geo Lon (°)')
×
1572
    ax[1].set_ylabel(' ')
×
1573
    ax[1].text(130, 70, abc[1], c='white')
×
1574
    ax[1].scatter(sun['lon'][ind_time], sun['lat'][ind_time], c='red', s=20,
×
1575
                  edgecolors="black", linewidths=0.5, zorder=2)
1576
    # --------------------------------
1577
    z2 = np.reshape(foF1, alon_2d.shape)
×
NEW
1578
    mesh = ax[1].pcolormesh(alon_2d, alat_2d, z2)
×
NEW
1579
    cbar = fig.colorbar(mesh, ax=ax[1])
×
NEW
1580
    cbar.set_label('$fo$F1 (MHz)')
×
1581
    ax[0].title.set_text('Probability')
×
1582
    ax[1].title.set_text('foF1')
×
1583
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1584
    return
×
1585

1586

1587
def PyIRI_plot_1location_diurnal_par(F2, F1, E, Es, alon, alat,
7✔
1588
                                     lon_plot, lat_plot, aUT, plot_dir,
1589
                                     plot_name='PyIRI_diurnal.png'):
1590
    """Plot diurnal parameters for one location.
1591

1592
    Parameters
1593
    ----------
1594
    F2 : dict
1595
        Dictionary output of IRI_monthly_mean_parameters.
1596
    F1 : dict
1597
        Dictionary output of IRI_monthly_mean_parameters.
1598
    E : dict
1599
        Dictionary output of IRI_monthly_mean_parameters.
1600
    Es : dict
1601
        Dictionary output of IRI_monthly_mean_parameters.
1602
    alon : array-like
1603
        Flattened array of geo longitudes in degrees.
1604
    alat : array-like
1605
        Flattened array of geo latitudes in degrees.
1606
    lon_plot : float
1607
        Longitude location for EDP.
1608
    lat_plot : array-like
1609
        Latitude location for EDP.
1610
    aUT : array-like
1611
        Array of universal times in hours used in PyIRI.
1612
    plot_dir : str
1613
        Direction where to save the figure.
1614
    plot_name : str
1615
        Name for the output figure, without directory
1616
        (default='PyIRI_foF1_min_max.png')
1617

1618
    """
1619
    figname = os.path.join(plot_dir, plot_name)
×
1620
    fig, ax = plt.subplots(4, 1, sharex=True, sharey=False, figsize=(4, 7),
×
1621
                           constrained_layout=True)
1622
    plt.xlim([0, 24])
×
1623
    plt.xticks(np.arange(0, 24 + 4, 4))
×
1624

1625
    ind_grid = np.where((alon == lon_plot) & (alat == lat_plot))[0]
×
1626

1627
    # --------------------------------
1628
    ax[0].set_facecolor('grey')
×
1629
    ax[0].set_xlabel('UT (hours)')
×
1630
    ax[0].set_ylabel('Peak Density (m$^{-3}$)')
×
NEW
1631
    ax[0].plot(aUT, F2['Nm'][:, ind_grid], label='NmF2', c='red', zorder=2)
×
NEW
1632
    ax[0].plot(aUT, F1['Nm'][:, ind_grid], label='NmF1', c='green', zorder=1)
×
1633
    ax[0].plot(aUT, E['Nm'][:, ind_grid], label='NmE', c='yellow')
×
1634
    ax[0].plot(aUT, Es['Nm'][:, ind_grid], label='NmEs', c='blue')
×
1635
    ax[0].legend(loc='upper left', prop={'size': 6})
×
1636
    # --------------------------------
1637
    ax[1].set_facecolor('grey')
×
1638
    ax[1].set_xlabel('UT (hours)')
×
1639
    ax[1].set_ylabel('Peak Height (km)')
×
NEW
1640
    ax[1].plot(aUT, F2['hm'][:, ind_grid], label='hmF2', c='red', zorder=2)
×
NEW
1641
    ax[1].plot(aUT, F1['hm'][:, ind_grid], label='hmF1', c='green', zorder=1)
×
1642
    ax[1].plot(aUT, E['hm'][:, ind_grid], label='hmE', c='yellow')
×
1643
    ax[1].plot(aUT, Es['hm'][:, ind_grid], label='hmEs', c='blue')
×
1644
    ax[1].legend(loc='upper left', prop={'size': 6})
×
1645
    # --------------------------------
1646
    ax[2].set_facecolor('grey')
×
1647
    ax[2].set_xlabel('UT (hours)')
×
1648
    ax[2].set_ylabel('Top Thickness (km)')
×
NEW
1649
    ax[2].plot(aUT, F2['B_top'][:, ind_grid], label='B_top F2', c='red',
×
1650
               zorder=2)
NEW
1651
    ax[2].plot(aUT, E['B_top'][:, ind_grid], label='B_top E', c='yellow',
×
1652
               zorder=1)
1653
    ax[2].plot(aUT, Es['B_top'][:, ind_grid], label='B_top Es', c='blue')
×
1654
    ax[2].legend(loc='upper left', prop={'size': 6})
×
1655
    # --------------------------------
1656
    ax[3].set_facecolor('grey')
×
1657
    ax[3].set_xlabel('UT (hours)')
×
1658
    ax[3].set_ylabel('Bottom Thickness (km)')
×
NEW
1659
    ax[3].plot(aUT, F2['B_bot'][:, ind_grid], label='B_bot F2', c='red',
×
1660
               zorder=2)
NEW
1661
    ax[3].plot(aUT, F1['B_bot'][:, ind_grid], label='B_bot F1', c='green',
×
1662
               zorder=1)
1663
    ax[3].plot(aUT, E['B_bot'][:, ind_grid], label='B_bot E', c='yellow')
×
1664
    ax[3].plot(aUT, Es['B_top'][:, ind_grid], label='B_bot Es', c='blue')
×
1665
    ax[3].legend(loc='upper left', prop={'size': 6})
×
1666
    # --------------------------------
1667
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1668
    return
×
1669

1670

1671
def PyIRI_plot_1location_diurnal_density(EDP, alon, alat, lon_plot, lat_plot,
7✔
1672
                                         aalt, aUT, plot_dir,
1673
                                         plot_name='PyIRI_EDP_diurnal.png'):
1674
    """Plot diurnal parameters for one location.
1675

1676
    Parameters
1677
    ----------
1678
    EDP : array-like
1679
        3-D electron density array output of IRI_density_1day
1680
        with shape [N_T, N_V, N_H].
1681
    alon : array-like
1682
        Flattened array of geo longitudes in degrees.
1683
    alat : array-like
1684
        Flattened array of geo latitudes in degrees.
1685
    lon_plot : float
1686
        Longitude location for EDP.
1687
    lat_plot : array-like
1688
        Latitude location for EDP.
1689
    aalt : array-like
1690
        Flattened array of altitudes in km.
1691
    aUT : array-like
1692
        Array of universal times in hours used in PyIRI.
1693
    plot_dir : str
1694
        Direction where to save the figure.
1695
    plot_name : str
1696
        Name for the output figure, without directory
1697
        (default='PyIRI_foF1_min_max.png')
1698

1699
    """
1700
    figname = os.path.join(plot_dir, plot_name)
×
1701
    fig, ax = plt.subplots(1, 1, figsize=(6, 3), constrained_layout=True)
×
1702
    plt.xlim([0, 24])
×
1703
    plt.xticks(np.arange(0, 24 + 4, 4))
×
1704
    ax.set_facecolor('grey')
×
1705
    ax.set_xlabel('UT (hours)')
×
1706
    ax.set_ylabel('Altitude (km)')
×
UNCOV
1707
    ind_grid = np.where((alon == lon_plot) & (alat == lat_plot))[0]
×
1708
    z = np.transpose(np.reshape(EDP[:, :, ind_grid], (aUT.size, aalt.size)))
×
NEW
1709
    mesh = ax.pcolormesh(aUT, aalt, z)
×
NEW
1710
    cbar = fig.colorbar(mesh, ax=ax)
×
1711
    cbar.set_label('Electron Density (m$^{-3}$)')
×
1712
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
1713
    return
×
1714

1715

1716
def PyIRI_plot_vTEC(TEC, aUT, alon, alat, alon_2d, alat_2d, sun,
7✔
1717
                    UT, plot_dir, plot_name='PyIRI_vTEC.png'):
1718
    """Plot vTEC.
1719

1720
    Parameters
1721
    ----------
1722
    TEC : array-like
1723
        Array output of edp_to_vtec.
1724
    aUT : array-like
1725
        Array of universal times in hours used in PyIRI.
1726
    alon : array-like
1727
        Flattened array of geo longitudes in degrees.
1728
    alat : array-like
1729
        Flattened array of geo latitudes in degrees.
1730
    alon_2d : array-like
1731
        2-D array of geo longitudes in degrees.
1732
    alat_2d : array-like
1733
        2-D array of geo latitudes in degrees.
1734
    sun : dict
1735
        Dictionary output of IRI_monthly_mean_parameters.
1736
    UT : float
1737
        UT time frame from array aUT to plot.
1738
    plot_dir : str
1739
        Direction where to save the figure.
1740
    plot_name : str
1741
        Name for the output figure, without directory
1742
        (default='PyIRI_NmF1_min_max.png')
1743

1744
    """
NEW
1745
    ind_time = np.where(aUT == UT)
×
NEW
1746
    ind_grid = np.where(np.isfinite(alon))
×
NEW
1747
    figname = os.path.join(plot_dir, plot_name)
×
NEW
1748
    fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=(6, 3),
×
1749
                           constrained_layout=True)
NEW
1750
    plt.xlim([-180, 180])
×
NEW
1751
    plt.ylim([-90, 90])
×
NEW
1752
    plt.xticks(np.arange(-180, 180 + 45, 90))
×
NEW
1753
    plt.yticks(np.arange(-90, 90 + 45, 45))
×
NEW
1754
    ax.set_facecolor('grey')
×
NEW
1755
    ax.set_xlabel('Geo Lon (°)')
×
NEW
1756
    ax.set_ylabel('Geo Lat (°)')
×
NEW
1757
    z = np.reshape(TEC[ind_time, ind_grid], alon_2d.shape)
×
NEW
1758
    mesh = ax.pcolormesh(alon_2d, alat_2d, z)
×
NEW
1759
    cbar = fig.colorbar(mesh, ax=ax)
×
NEW
1760
    ax.scatter(sun['lon'][ind_time], sun['lat'][ind_time],
×
1761
               c='red', s=20, edgecolors="black", linewidths=0.5)
NEW
1762
    cbar.set_label('vTEC (TECU)')
×
NEW
1763
    plt.savefig(figname, format='pdf', bbox_inches='tight')
×
NEW
1764
    return
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc