Set these variables :
my_qth
- to your current operating locationmy_log_file
- to the path to the ADIF file to useall_qths
- a list of locators to plot as places of interest on the graph.my_qth = 'IO91vk'
my_log_file = 'log.adi' #'contacts.adi'
all_qths = [ my_qth ] #,'CM86xx','DO13' ] # list of locations you operate from uses first as center
print ('My QTH: {}, all QTHs: {}.'.format(my_qth,', '.join(all_qths)))
My QTH: IO91vk, all QTHs: IO91vk.
Let's load my log from ADIF file.
Alternate Approach - build a dictionary of DXCC entities with list of grids. None if no GS. Add defaults. Average.
adif_reader = adif.ADIFReader(open (my_log_file,'rU'))
ad_contacts = adif_reader.load()
'''TODO clean up extras'''
ad_all_contact_dxcc = set([ q['dxcc'] for q in ad_contacts if 'dxcc' in q])
ad_contact_grids = set([ q['gridsquare'] for q in ad_contacts if 'gridsquare' in q])
ad_plotted_by_grid = set([ q['dxcc'] for q in ad_contacts if 'gridsquare' in q])
ad_plot_by_dxcc = ad_all_contact_dxcc.difference(ad_plotted_by_grid)
ad_dxcc_grids = [ loc_for_dxcc(d) for d in ad_plot_by_dxcc ]
#ad_no_grid = [ q for q in ad_contacts if 'gridsquare' not in q ]
all_dxcc_locs = [ loc_for_dxcc(d) for d in all_dxcc() ]
ctc_dxcc_locs = [ loc_for_dxcc(d) for d in ad_all_contact_dxcc ]
Now we can draw a map in Azimuth Equidistant Projection centered on our QTH and plot contacts by grid, then by DXCC.
print ('Number of grid contacts: \t{}\nNumber of DXCC contacts: \t{}\nTotal Contacts: \t\t{}'.format(
len(ad_contact_grids),
len(ad_dxcc_grids),
len(ad_contacts)
))
Number of grid contacts: 359 Number of DXCC contacts: 5 Total Contacts: 431
m = azmap(my_qth)
# Draw GCR lines to each contact
draw_circle(m, my_qth, ad_contact_grids)
draw_circle(m, my_qth, ad_dxcc_grids)
# Draw our markers for contacts.
draw_qth( m, ad_contact_grids, color='blue',alpha=0.5)
draw_qth( m, all_qths, color='red', alpha=0.5, marker='8')
draw_qth( m, ad_dxcc_grids, alpha=0.5, marker='h',color='yellow')
title_text = plt.title('Contacts - {}'.format(my_qth))
Let's just draw all the DXCC from where I am to see where the 'action' might be. Blue is everything, red are contacts with DXCCs that are in the log file.
m = azmap(my_qth)
plt.title('All DXCC from {}'.format(my_qth))
draw_circle(m, my_qth, all_dxcc_locs)
draw_qth(m,all_dxcc_locs,color='blue',alpha=0.5)
draw_qth(m,ctc_dxcc_locs,color='red',alpha=0.5)
ctc_bearings = [ to_polar(*relative_offset_qth(m,my_qth,lonlat_dest=ctc_dict[dx]))[1] for dx in ctc_dict ]
dxcc_bearings = [ to_polar(*relative_offset_qth(m,my_qth,grid_dest=dxcc_loc))[1] for dxcc_loc in all_dxcc_locs ]
print 'Contacted DXCCs : ',len(ctc_bearings),'/', len(dxcc_bearings)
Contacted DXCCs : 61 / 340
dxcc_data
<- number of DXCC entities in that bin (azimuth bucket)ctc_data
<- number of DXCC entities in that bin in log file.Note : ctc_data
can exceed the DXCC number if you've moved your QTH over the course of the log.
ax = setup_polar_plot()
bars(ax,bins(), ctc_data,color='red')
bars(ax,bins(), dxcc_data)
p = plt.title('Number of DXCCs by Azimuth Angle from {}\n'.format(my_qth))
l = plt.legend(['Contacts','All DXCC'])
ax = setup_polar_plot()
bars(ax,bins(), np.log10([ x+0.49 for x in ctc_data]),color='red')
bars(ax,bins(), np.log10(dxcc_data))
p = plt.title('Number of DXCCs ($log_{{10}}$) by Azimuth Angle from {}\n'.format(my_qth))
l = plt.legend(['My Contacts','All DXCC'])