示例#1
0
def MapasCD_Imshow(data,
                   lat,
                   lon,
                   lat_down,
                   lat_up,
                   lon_left,
                   long_right,
                   name,
                   titulo,
                   cmap,
                   dt,
                   dmes,
                   levels='Nada'):
    plt.close('all')
    fig = plt.figure(figsize=(14, 18))

    for i in range(0, 12):
        ax = fig.add_subplot(4, 3, i + 1)
        ax.set_title(dmes[i], fontsize=18)
        m = Basemap(projection='merc',
                    llcrnrlat=lat_down,
                    urcrnrlat=lat_up,
                    llcrnrlon=lon_left,
                    urcrnrlon=lon_right,
                    resolution='i',
                    lat_ts=20)
        m.readshapefile(shape,
                        name='AreaMetropolitana',
                        color='k',
                        linewidth=1.5)
        cs = m.imshow(data[i], cmap=cmap)
        parallels = np.arange(lat_down, lat_up + 1, 0.3)
        m.drawparallels(parallels, labels=[1, 0, 0, 0], fontsize=10)
        meridians = np.arange(lon_left, long_right + 1, 0.3)
        m.drawmeridians(meridians, labels=[0, 0, 0, 1], fontsize=10)

    plt.subplots_adjust(left=0.125,
                        bottom=0.085,
                        right=0.9,
                        top=0.95,
                        wspace=0.35,
                        hspace=0.07)

    cbar_ax = fig.add_axes([0.125, 0.05, 0.78, 0.015])
    cbar = fig.colorbar(cs,
                        cax=cbar_ax,
                        orientation='horizontal',
                        format="%.2f")
    cbar.set_label(titulo, fontproperties=prop, fontsize=20)

    plt.savefig(Path_Save + name + '.png', format='png')
    os.system(
        'scp ' + Path_Save + name +
        '.png [email protected]:/var/www/nacorreasa/Graficas_Resultados/Estudio'
    )
示例#2
0
meses = ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Agos', 'Sep', 'Oct', 'Nov','Dic'])

Path_Save_pdf = '/home/nacorreasa/Escritorio/Figuras/'
output = PdfFileWriter()
for j in range(0,len(Meses)):

    plt.close('all')
    fig = plt.figure(figsize=(14,18))

    for i in range(0, len(Horas)):
        ax = fig.add_subplot(4, 3, i+1)
        ax.set_title('Hora: '+str(Horas[i]), fontsize=18)
        m = Basemap(projection='merc', llcrnrlat=lat_down, urcrnrlat=lat_up,
                    llcrnrlon=lon_left, urcrnrlon=long_right, resolution='i', lat_ts=20)
        m.readshapefile(shape, name='AreaMetropolitana', color='k', linewidth=1.5)
        cs = m.imshow(Read_Remues[i], cmap ='rainbow', alpha = 0.5)
        parallels = np.arange(lat_down, lat_up+1, 0.3)
        m.drawparallels(parallels, labels=[1, 0, 0, 0], fontsize=10)
        meridians = np.arange(lon_left, long_right+1, 0.3)
        m.drawmeridians(meridians, labels=[0, 0, 0, 1], fontsize=10)

    plt.subplots_adjust(left=0.125, bottom=0.085, right=0.9, top=0.95, wspace=0.35, hspace=0.07)

    cbar_ax = fig.add_axes([0.125, 0.05, 0.78, 0.015])
    cbar = fig.colorbar(cs, cax=cbar_ax,  orientation='horizontal', format="%.2f")
    cbar.set_label('Irradiancias  durante: ' + meses[i],  fontproperties = prop, fontsize=20 )



    file_j = file(Path_Save_pdf + meses[i] '.pdf', 'rb')
    page_j = PdfFileReader(file_j).getPage(0)