forked from w2naf/grapeDRF_doppler_model
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_w2naf_grapeDRF_2024eclipse.py
More file actions
executable file
·125 lines (105 loc) · 3.75 KB
/
plot_w2naf_grapeDRF_2024eclipse.py
File metadata and controls
executable file
·125 lines (105 loc) · 3.75 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
#!/usr/bin/env python
import os
import datetime
import logging
logger = logging.getLogger(__name__)
import numpy as np
import pandas as pd
import matplotlib as mpl
from matplotlib import pyplot as plt
import grapeDRF
letters = 'abcdefghijklmnopqrztuvwxyz'
mpl.rcParams['font.size'] = 12
mpl.rcParams['font.weight'] = 'bold'
mpl.rcParams['axes.grid'] = True
mpl.rcParams['axes.titlesize'] = 30
mpl.rcParams['grid.linestyle'] = ':'
mpl.rcParams['figure.figsize'] = np.array([15, 8])
mpl.rcParams['axes.xmargin'] = 0
mpl.rcParams['legend.fontsize'] = 'xx-large'
station_dct = {}
sdct = station_dct['w2naf'] = {}
sdct['QTH'] = 'Spring Brook, PA'
if __name__ == '__main__':
output_dir = os.path.join('output','w2naf_2024eclipse')
if not os.path.exists(output_dir):
os.makedirs(output_dir)
sDate = datetime.datetime(2024,4,8)
eDate = datetime.datetime(2024,4,9)
station = 'w2naf'
lat = 41.335116 # W2NAF
lon = -75.600692 # W2NAF
figd = {}
figd['solar_lat'] = lat
figd['solar_lon'] = lon
figd['overlaySolarElevation'] = True
figd['overlayEclipse'] = True
figd['xlim'] = (sDate,eDate)
# 'center_frequencies': array([ 2.5 , 3.33, 5. , 7.85, 10. , 14.67, 15. , 20. , 25. ])
cfreqs = [20,15,10,5]
# cfreqs = [3.33,7.85,14.67]
plot_list = []
plot_list.append('WDgrape')
# plot_list.append('VLF')
# plot_list.append('gmag')
str_sDate = sDate.strftime('%Y%m%d.%H%M')
str_eDate = eDate.strftime('%Y%m%d.%H%M')
png_ = []
png_.append(str_sDate)
png_.append(str_eDate)
png_.append(station)
for pll in plot_list:
png_.append(pll)
if pll == 'WDgrape':
png_ = png_ + ['{!s}'.format(x) for x in cfreqs]
png_fname = '_'.join(png_)+'.png'
png_fpath = os.path.join(output_dir,png_fname)
nrows = len(plot_list)
if 'WDgrape' in plot_list:
nrows += len(cfreqs) - 1
ncols = 1
ax_inx = 0
axs = []
fig = plt.figure(figsize=(22,nrows*5))
letter_fdict = {'size':32}
# Grape Plots ##########################
if 'WDgrape' in plot_list:
gDRF = grapeDRF.GrapeDRF(sDate,eDate,station)
g_figd = figd.copy()
for cfreq in cfreqs:
print(' {!s} MHz...'.format(cfreq))
ax_inx += 1
ax = fig.add_subplot(nrows,ncols,ax_inx)
axs.append(ax)
gDRF.plot_ax(cfreq,ax,**g_figd)
ax.set_title('({!s})'.format(letters[ax_inx-1]),loc='left',fontdict=letter_fdict)
ax.set_title('{!s} MHz Receiver'.format(cfreq))
# Finalize Figure ######################
for ax_inx,ax in enumerate(axs):
ax.set_xlim(sDate,eDate)
xticks = ax.get_xticks()
ax.set_xticks(xticks)
if ax_inx != len(axs)-1:
ax.set_xlabel('')
xtkls = ['']*len(xticks)
else:
ax.set_xlabel('UTC')
xtkls = []
for xtk in xticks:
dt = mpl.dates.num2date(xtk)
xtkl = dt.strftime('%H:%M')
xtkls.append(xtkl)
ax.set_xticklabels(xtkls)
sdct = station_dct.get(station,{})
if 'QTH' in sdct:
stxt = '{!s} ({!s})'.format(station.upper(),sdct['QTH'])
else:
stxt = station.upper()
txt = []
txt.append(stxt)
txt.append(sDate.strftime('%d %b %Y'))
fontdict = {'size':42,'weight':'bold'}
fig.text(0.5,1.,'\n'.join(txt),fontdict=fontdict,ha='center',va='bottom')
fig.tight_layout()
fig.savefig(png_fpath,bbox_inches='tight')
print(png_fpath)