good_loc = rbn_df.dropna( subset=['dx_lat', 'dx_lon', 'de_lat', 'de_lon']) good_count_map = good_loc['callsign'].count() total_count_map = len(rbn_df) good_pct_map = float(good_count_map) / total_count_map * 100. good_count += good_count_map total_count += total_count_map print 'Geolocation success: {0:d}/{1:d} ({2:.1f}%)'.format( good_count_map, total_count_map, good_pct_map) # Go plot!! rbn_lib.rbn_map_plot(rbn_df, legend=False, ax=ax0, tick_font_size=9, ncdxf=True) title = map_sTime.strftime('%H%M - ') + map_eTime.strftime( '%H%M UT') ax0.set_title(title, loc='center') ax0.set_title(map_sTime.strftime('%d %b %Y'), loc='right') if kk == 0: ax0.set_title('Preflare', loc='left') else: ax0.set_title('Flare Peak', loc='left') letter_prop = {'weight': 'bold', 'size': 20} # ax0.text(.015,.90,'({0})'.format(letters[kk]),transform=ax0.transAxes,**letter_prop) # for item in (ax0.get_xticklabels() + ax0.get_yticklabels()):
rbn_df = rbn_lib.read_rbn(map_sTime,map_eTime,data_dir='data/rbn') # Figure out how many records properly geolocated. good_loc = rbn_df.dropna(subset=['dx_lat','dx_lon','de_lat','de_lon']) good_count_map = good_loc['callsign'].count() total_count_map = len(rbn_df) good_pct_map = float(good_count_map) / total_count_map * 100. good_count += good_count_map total_count += total_count_map print 'Geolocation success: {0:d}/{1:d} ({2:.1f}%)'.format(good_count_map,total_count_map,good_pct_map) # Go plot!! rbn_lib.rbn_map_plot(rbn_df,legend=False,ax=ax0,tick_font_size=9,ncdxf=False,plot_paths=False) title = map_sTime.strftime('%d %b %Y %H%M UT - ')+map_eTime.strftime('%d %b %Y %H%M UT') ax0.set_title(title) letter_prop = {'weight':'bold','size':16} ax0.text(.015,.90,'({0})'.format(letters[kk]),transform=ax0.transAxes,**letter_prop) print map_sTime # leg = rbn_lib.band_legend(fig,loc='center',bbox_to_anchor=[0.48,0.180],ncdxf=False) leg = rbn_lib.band_legend(fig,loc='center',bbox_to_anchor=[0.45,0.180],ncdxf=False) title_prop = {'weight':'bold','size':22} fig.text(0.525,0.925,'Reverse Beacon Network',ha='center',**title_prop) fig.savefig(filepath,bbox_inches='tight') # fig.savefig(filepath[:-3]+'pdf',bbox_inches='tight')
#!/usr/bin/env python import os import datetime import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import rbn_lib sTime = datetime.datetime(2010, 11, 19) eTime = datetime.datetime(2010, 11, 19) data_dir = os.path.join('data', 'rbn') rbn_df = rbn_lib.read_rbn(sTime, eTime, data_dir=data_dir) import ipdb ipdb.set_trace() fig = plt.figure(figsize=(10, 8)) ax = fig.add_subplot(111) rbn_lib.rbn_map_plot(rbn_df, legend=False, ax=ax) outfile = os.path.join('output', 'rbn', 'rbn_test.png') fig.savefig(outfile, bbox_inches='tight')
rbn_df = rbn_lib.read_rbn(map_sTime,map_eTime,data_dir='data/rbn') # Figure out how many records properly geolocated. good_loc = rbn_df.dropna(subset=['dx_lat','dx_lon','de_lat','de_lon']) good_count_map = good_loc['callsign'].count() total_count_map = len(rbn_df) good_pct_map = float(good_count_map) / total_count_map * 100. good_count += good_count_map total_count += total_count_map print 'Geolocation success: {0:d}/{1:d} ({2:.1f}%)'.format(good_count_map,total_count_map,good_pct_map) # Go plot!! bounds = dict(llcrnrlon=-135.,llcrnrlat=20,urcrnrlon=-60.,urcrnrlat=60.) rbn_lib.rbn_map_plot(rbn_df,legend=True,ax=ax0,tick_font_size=9,ncdxf=True,**bounds) title = map_sTime.strftime('%H%M - ')+map_eTime.strftime('%H%M UT') ax0.set_title(title) #leg = rbn_lib.band_legend(fig,loc='center',bbox_to_anchor=[0.48,0.360],ncdxf=True) title_prop = {'weight':'bold','size':22} fig.text(0.525,1.025,'Reverse Beacon Network',ha='center',**title_prop) fig.tight_layout(h_pad=2.5,w_pad=3.5) fig.savefig(filepath,bbox_inches='tight') good_pct = float(good_count)/total_count * 100. print '' print 'Final stats for: {0}'.format(filepath) print 'Geolocation success: {0:d}/{1:d} ({2:.1f}%)'.format(good_count,total_count,good_pct)