예제 #1
0
def plot_sat_temp(projection, temp_sparse, temp,
                     lons, lats, date, plot_filename):
    import matplotlib.pyplot as plt
    '''Plot temperature on the map'''
    fig = plt.figure(1, figsize=(12, 12))

    if projection == 'italy':
        ax = utils.get_projection(plt, projection, regions=True,
                                  sat=True, background=False,
                                  coastlines=True)
    else:
        ax = utils.get_projection(plt, projection, regions=False,
                                  sat=True, background=False,
                                  coastlines=True)

    utils.add_vals_on_map(ax=ax, projection=projection,
                          var=temp_sparse, lons=lons, lats=lats)

    plt.title('Temperature live | Ultimo aggiornamento %s' % date[0])

    utils.add_logo_on_map(
        ax=ax, logo='meteoindiretta_logo.png', zoom=0.15, pos=(0.92, 0.1))
    utils.add_logo_on_map(
        ax=ax, logo='meteonetwork_logo.png', zoom=0.3, pos=(0.15, 0.05))

    if projection == 'italy':
        utils.add_hist_on_map(ax=ax, var=temp, label='Temperatura [C]')
    else:
        utils.add_hist_on_map(ax=ax, var=temp, label='Temperatura [C]', loc=2, width="25%")

    plt.savefig(plot_filename, dpi=100, bbox_inches='tight')
    plt.clf()
예제 #2
0
def plot_temperature_max(projection,
                         plot_type,
                         temp_sparse,
                         temp,
                         lons,
                         lats,
                         date,
                         plot_filename='output.png'):
    import matplotlib.pyplot as plt
    '''Plot temperature on the map'''
    fig = plt.figure(1, figsize=(10, 10))
    ax = utils.get_projection(plt, projection, regions=False)

    utils.add_vals_on_map(ax=ax,
                          var=temp_sparse,
                          projection=projection,
                          lons=lons,
                          lats=lats)

    plt.title('Temperature massime %s' % date)

    utils.add_logo_on_map(ax=plt.gca(),
                          logo='meteoindiretta_logo.png',
                          zoom=0.15,
                          pos=(0.92, 0.1))
    utils.add_logo_on_map(ax=plt.gca(),
                          logo='meteonetwork_logo.png',
                          zoom=0.3,
                          pos=(0.15, 0.05))
    utils.add_hist_on_map(plt.gca(), temp, label='Temperatura [C]')

    plt.savefig(plot_filename, dpi=100, bbox_inches='tight')
    plt.clf()
예제 #3
0
def plot_gust(projection,
              gust_sparse,
              gust,
              lons,
              lats,
              date,
              plot_filename='output.png'):
    import matplotlib.pyplot as plt
    fig = plt.figure(1, figsize=(10, 10))
    ax = utils.get_projection(plt, projection, regions=False)

    utils.add_vals_on_map(ax=ax,
                          var=gust_sparse,
                          projection=projection,
                          lons=lons,
                          lats=lats,
                          minval=0,
                          maxval=150,
                          cmap='gist_stern_r')

    plt.title('Raffica massima giornaliera %s' % date)

    utils.add_logo_on_map(ax=plt.gca(),
                          logo='meteoindiretta_logo.png',
                          zoom=0.15,
                          pos=(0.92, 0.1))
    utils.add_logo_on_map(ax=plt.gca(),
                          logo='meteonetwork_logo.png',
                          zoom=0.3,
                          pos=(0.15, 0.05))
    utils.add_hist_on_map(plt.gca(), gust, label='Raffica [kmh/h]')

    plt.savefig(plot_filename, dpi=100, bbox_inches='tight')
    plt.clf()
예제 #4
0
def plot_rain(projection,
              rain_sparse,
              rain,
              lons,
              lats,
              date,
              plot_filename='output.png'):
    import matplotlib.pyplot as plt

    fig = plt.figure(1, figsize=(10, 10))
    ax = utils.get_projection(plt, projection, regions=False)

    utils.add_vals_on_map(ax=ax,
                          var=rain_sparse,
                          projection=projection,
                          lons=lons,
                          lats=lats,
                          minval=0,
                          maxval=150,
                          cmap='gist_stern_r')

    plt.title('Precipitazioni live | Ultimo aggiornamento %s' % date[0])

    utils.add_logo_on_map(ax=ax,
                          logo='meteoindiretta_logo.png',
                          zoom=0.15,
                          pos=(0.92, 0.1))
    utils.add_logo_on_map(ax=ax,
                          logo='meteonetwork_logo.png',
                          zoom=0.3,
                          pos=(0.15, 0.05))
    utils.add_hist_on_map(ax=ax, var=rain, label='Pioggia giornaliera [mm]')

    plt.savefig(plot_filename, dpi=100, bbox_inches='tight')
    plt.clf()
예제 #5
0
def plot_synoptic(projection,
                  u,
                  v,
                  mslp,
                  lons,
                  lats,
                  date,
                  plot_filename='output.png'):
    import matplotlib.pyplot as plt

    fig = plt.figure(1, figsize=(10, 10))
    ax = utils.get_projection(plt, projection, regions=False)

    utils.add_vals_on_map(ax=ax,
                          var=mslp,
                          projection=projection,
                          lons=lons,
                          lats=lats,
                          minval=960,
                          maxval=1050,
                          colors=False,
                          fontsize=8)

    utils.add_barbs_on_map(ax=ax,
                           projection=projection,
                           u=u,
                           v=v,
                           lons=lons,
                           lats=lats,
                           magnitude=True)

    plt.title('Pressione e venti  | Ultimo aggiornamento %s' % date[0])

    utils.add_logo_on_map(ax=ax,
                          logo='meteoindiretta_logo.png',
                          zoom=0.15,
                          pos=(0.92, 0.1))
    utils.add_logo_on_map(ax=ax,
                          logo='meteonetwork_logo.png',
                          zoom=0.3,
                          pos=(0.15, 0.05))

    plt.savefig(plot_filename, dpi=100, bbox_inches='tight')
    plt.clf()
예제 #6
0
def plot_humidity(projection, hum_sparse, hum,
                  lons, lats, date, plot_filename):
    import matplotlib.pyplot as plt

    fig = plt.figure(1, figsize=(12, 12))
    ax = utils.get_projection(plt, projection, regions=False)

    utils.add_vals_on_map(ax=ax, var=hum_sparse, projection=projection,
                          lons=lons, lats=lats, minval=0, maxval=100, cmap='jet_r')

    plt.title('Umidita live | Ultimo aggiornamento %s' % date[0])

    utils.add_logo_on_map(
        ax=ax, logo='meteoindiretta_logo.png', zoom=0.15, pos=(0.92, 0.1))
    utils.add_logo_on_map(
        ax=ax, logo='meteonetwork_logo.png', zoom=0.3, pos=(0.15, 0.05))
    utils.add_hist_on_map(ax=ax, var=hum, label='Umidita [%]')

    plt.savefig(plot_filename, dpi=100, bbox_inches='tight')
    plt.clf()
예제 #7
0
def plot_gust(projection, gust_sparse, gust, u, v,
              lons, lats, date, plot_filename):
    import matplotlib.pyplot as plt

    fig = plt.figure(1, figsize=(12, 12))
    ax = utils.get_projection(plt, projection, regions=False)

    utils.add_vals_on_map(ax=ax, var=gust_sparse, projection=projection,
                          lons=lons, lats=lats, minval=0, maxval=150, cmap='gist_stern_r', fontsize=10)

    utils.add_barbs_on_map(ax=ax, projection=projection, u=u, v=v,
                           lons=lons, lats=lats)

    plt.title('Raffiche live | Ultimo aggiornamento %s' % date[0])

    utils.add_logo_on_map(
        ax=ax, logo='meteoindiretta_logo.png', zoom=0.15, pos=(0.92, 0.1))
    utils.add_logo_on_map(
        ax=ax, logo='meteonetwork_logo.png', zoom=0.3, pos=(0.15, 0.05))
    utils.add_hist_on_map(ax=ax, var=gust, label='Raffica [km/h]')

    plt.savefig(plot_filename, dpi=100, bbox_inches='tight')
    plt.clf()