Ejemplo n.º 1
0
def Create_interaction(test=False, profile=None, **kwargs):
    'Main program to start the moving lines and set up all the map and interactions'

    warnings.simplefilter(action="ignore", category=FutureWarning)

    goto_cwd()
    ui = Create_gui()
    ui.tb.set_message('Creating basemap')
    profile = Get_basemap_profile()
    m = mi.build_basemap(ax=ui.ax1, profile=profile)
    if profile:
        sla, slo = profile['Start_lat'], profile['Start_lon']
    else:
        sla, slo = None, None
    line = init_plot(m, start_lat=sla, start_lon=slo, color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        ui.tb.set_message('putting labels and aeronet')
        mi.plot_map_labels(m, flabels)
        mi.plot_map_labels(m, faero, marker='*', skip_lines=2, color='y')
    except:
        print 'Label files not found!'
    get_datestr(ui)
    ui.tb.set_message('making the Excel connection')
    wb = ex.dict_position(datestr=ui.datestr,
                          color=line.get_color(),
                          profile=profile,
                          version=__version__,
                          platform_file=platform_filename,
                          **kwargs)
    ui.tb.set_message('Building the interactivity on the map')
    lines = mi.LineBuilder(line, m=m, ex=wb, tb=ui.tb, blit=True)
    ui.tb.set_message('Saving temporary excel file')
    savetmp(ui, wb)

    build_buttons(ui, lines)
    lines.get_bg(redraw=True)
    bind_move_window(ui, lines)
    ui.tb.set_message('Ready for interaction')

    def stopandquit():
        'simple function to handle the stop and quit'
        lines.ex.wb.close()
        ui.root.quit()
        ui.root.destroy()

    ui.root.protocol('WM_DELETE_WINDOW', stopandquit)
    if not test:
        ui.root.mainloop()
    return lines, ui
Ejemplo n.º 2
0
def Create_interaction(test=False,profile=None,**kwargs):
    'Main program to start the moving lines and set up all the map and interactions'
    
    warnings.simplefilter(action = "ignore", category = FutureWarning)
    
    goto_cwd()
    ui = Create_gui()
    ui.tb.set_message('Creating basemap')
    profile = Get_basemap_profile()
    m = mi.build_basemap(ax=ui.ax1,profile=profile)
    if profile:
        sla,slo = profile['Start_lat'],profile['Start_lon']
    else:
        sla,slo = None,None
    line = init_plot(m,start_lat=sla,start_lon=slo,color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        ui.tb.set_message('putting labels and aeronet')
        mi.plot_map_labels(m,flabels)
        mi.plot_map_labels(m,faero,marker='*',skip_lines=2,color='y')
    except:
        print 'Label files not found!'
    get_datestr(ui)
    ui.tb.set_message('making the Excel connection')
    wb = ex.dict_position(datestr=ui.datestr,color=line.get_color(),profile=profile,
         version=__version__,platform_file=platform_filename,**kwargs)
    ui.tb.set_message('Building the interactivity on the map')
    lines = mi.LineBuilder(line,m=m,ex=wb,tb=ui.tb,blit=True)
    ui.tb.set_message('Saving temporary excel file')
    savetmp(ui,wb)
    
    build_buttons(ui,lines)
    lines.get_bg(redraw=True)
    bind_move_window(ui,lines)
    ui.tb.set_message('Ready for interaction')
    def stopandquit():
        'simple function to handle the stop and quit'
        lines.ex.wb.close()
        ui.root.quit()
        ui.root.destroy()

    ui.root.protocol('WM_DELETE_WINDOW',stopandquit)
    if not test:
        ui.root.mainloop()
    return lines,ui
Ejemplo n.º 3
0
def Create_interaction(**kwargs):
    #fig,ax = plt.subplots()
    m = mi.build_basemap()
    plt.gca().set_title('line segments')
    lat0, lon0 = mi.pll('22 58.783S'), mi.pll('14 38.717E')
    x0, y0 = m(lon0, lat0)
    line, = m.plot([x0], [y0], 'ro-')
    text = ('Press s to stop interaction\\n'
            'Press i to restart interaction\\n')
    #plt.text(1.0,0.1,text)
    wb = ex.dict_position(**kwargs)
    lines = mi.LineBuilder(line, m=m, ex=wb)
    print 'after line builder'
    plt.show()
    print 'after show'
    plt.gcf().canvas._tkcanvas.master.geometry("900x1000")
    print 'after canvas'
    g = gui.gui(lines)
    g.make_gui()
    print 'after gui'
    return lines
Ejemplo n.º 4
0
def Create_interaction(**kwargs):
    #fig,ax = plt.subplots()
    m = mi.build_basemap()
    plt.gca().set_title('line segments')
    lat0,lon0 = mi.pll('22 58.783S'), mi.pll('14 38.717E')
    x0,y0 = m(lon0,lat0)
    line, = m.plot([x0],[y0],'ro-')
    text = ('Press s to stop interaction\\n'
            'Press i to restart interaction\\n')
    #plt.text(1.0,0.1,text)
    wb = ex.dict_position(**kwargs)
    lines = mi.LineBuilder(line,m=m,ex=wb)
    print 'after line builder'
    plt.show()
    print 'after show'
    plt.gcf().canvas._tkcanvas.master.geometry("900x1000")
    print 'after canvas'
    g = gui.gui(lines)
    g.make_gui()
    print 'after gui'
    return lines
def Create_interaction(test=False,**kwargs):
    ui = Create_gui()

    m = mi.build_basemap(ax=ui.ax1)
    line = init_plot(m,color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        mi.plot_map_labels(m,flabels)
        mi.plot_map_labels(m,faero,marker='*',skip_lines=2,color='y')
    except:
        print 'Label files not found!'
        
    get_datestr(ui)
    wb = ex.dict_position(datestr=ui.datestr,color=line.get_color(),**kwargs)
    lines = mi.LineBuilder(line,m=m,ex=wb,tb=ui.tb)
    savetmp(ui,wb)
    
    build_buttons(ui,lines)    
    if not test:
        ui.root.mainloop()
    return lines,ui
def Create_interaction(test=False, **kwargs):
    ui = Create_gui()

    m = mi.build_basemap(ax=ui.ax1)
    line = init_plot(m, color='red')

    flabels = 'labels.txt'
    faero = 'aeronet_locations.txt'
    try:
        mi.plot_map_labels(m, flabels)
        mi.plot_map_labels(m, faero, marker='*', skip_lines=2, color='y')
    except:
        print 'Label files not found!'

    get_datestr(ui)
    wb = ex.dict_position(datestr=ui.datestr, color=line.get_color(), **kwargs)
    lines = mi.LineBuilder(line, m=m, ex=wb, tb=ui.tb)
    savetmp(ui, wb)

    build_buttons(ui, lines)
    if not test:
        ui.root.mainloop()
    return lines, ui
rts[i]['tau_fl']


# In[96]:


for i,daystr in enumerate(dds):
    print rts[i]['lat'][rts[i]['fl']][:,0].shape,rts[i]['lon'][rts[i]['fl']][:,0].shape,rts[i]['tau_fl'].shape


# In[97]:


fig = plt.figure()
ax = plt.subplot(111)
m = build_basemap(lower_left=[-2,-25],upper_right=[15,-8],ax=ax,larger=False)
sa = []
for i,daystr in enumerate(dds):
    x,y = m(rts[i]['lon'][rts[i]['fl']][:,0]+i*0.03,rts[i]['lat'][rts[i]['fl']][:,0])
    sca = ax.scatter(x,y,c=rts[i]['tau_fl'],
              s=10,alpha=0.7,vmin=0.0,vmax=60.0,edgecolor='None')
    sa.append(sca)
#pu.prelim()
cb = plt.colorbar(sa[0])
cb.set_label('COD')
plt.savefig(fp+'..//zen_ict/v3/{}_COD_map.png'.format(vr),transparent=True,dpi=600)


# In[98]:

rts[i]['tau_fl']


# In[234]:


for i,daystr in enumerate(dds):
    print rts[i]['lat'][rts[i]['fl']][:,0].shape,rts[i]['lon'][rts[i]['fl']][:,0].shape,rts[i]['tau_fl'].shape


# In[354]:


fig = plt.figure(figsize=(10,6))
ax = plt.subplot(111)
m = build_basemap(lower_left=[123,33],upper_right=[131,39],ax=ax,larger=False)
sa = []
for i,daystr in enumerate(dds):
    x,y = m(rts[i]['lon'][rts[i]['fl']][:,0]+i*0.03,rts[i]['lat'][rts[i]['fl']][:,0])
    sca = ax.scatter(x,y,c=rts[i]['tau_fl'],
              s=30,marker='s',alpha=0.5,vmin=0.0,vmax=50.0,edgecolor='None')
    sa.append(sca)
#pu.prelim()
plt.title('Cirrus Optical Depth from 4STAR')
cb = plt.colorbar(sa[0])
cb.set_label('COD')
plt.savefig(fp+'plot/KORUS_COD_map.png',transparent=True,dpi=600)


# In[355]:
# In[158]:

taufl.x_edge.shape,taufl.y_edge.shape


# In[167]:

help(m.pcolor)


# In[166]:

fig = plt.figure()
ax = plt.subplot(111)
m = build_basemap(lower_left=[-55,40],upper_right=[-35,55],ax=ax,larger=False)
x,y = m((taufl.x_edge[:-1]+taufl.x_edge[1:])/2.0,(taufl.y_edge[:-1]+taufl.y_edge[1:])/2.0)
cc = m.contourf(x,y,taufl.statistic,vmin=0,vmax=26,cmap=plt.cm.gnuplot2_r)
ax.set_title('Mean COD from NAAMES 2015 for boundary layer liquid clouds')
cb = plt.colorbar(cc)
cb.set_label('COD')
#plt.savefig(fp+'../plot/NAAMES_map_COD_stasts.png',dpi=600,transparent=True)


# In[132]:

reffl.statistic


# In[122]:
iams_c3,iams_c3h = lu.load_ict(fp+'dc8\\SEAC4RS-AMS_DC8_20130821_R1.ict',return_header=True)


# # Now start plotting the files

# In[17]:

import map_interactive as mi


# ## Check out the cld case #1

# In[27]:

fig,ax = plt.subplots(1,1)
m = mi.build_basemap(lower_left=[-100,15],upper_right=[-85,32],ax=ax)
xt,yt = m(-95.3831,29.7628)
ax.text(xt,yt,'+')
ax.text(xt,yt,'Houston, TX',horizontalalignment='right',verticalalignment='top')
cs = m.scatter(istar_cld['Longitude'],istar_cld['Latitude'],marker='o',latlon=True,
               c=istar_cld['Start_UTC'],s=20,cmap=plt.cm.rainbow,edgecolor='none')
cb = plt.colorbar(cs)
cb.set_label('UTC [h]')


# In[30]:

it = (istar_cld['Start_UTC']>19)&(istar_cld['Start_UTC']<22)


# In[31]: