def plot_station_grid_sequences(station_grids):
    for S, station_grid in enumerate(station_grids):
        lon_points = [grid_point for grid_point in station_grid[1]]
        lat_points = [grid_point for grid_point in station_grid[0]]

        rlon, rlat = PlotUtils.get_rlon_rlat(lon_points, lat_points)

        # needed to truncate the background map
        # rlat_min, rlat_max, rlon_min, rlon_max = -1.3, 1, -3, 0.5
        rlat_min, rlat_max, rlon_min, rlon_max = np.min(rlat), np.max(
            rlat), np.min(rlon), np.max(rlon)

        for i in range(len(lon_points)):
            fig = plt.figure(figsize=(16, 12))
            ax = plt.subplot(111)

            PlotUtils.plot_map_rlon_rlat(ax=ax,
                                         rlat_min=rlat_min - 0.2,
                                         rlat_max=rlat_max + 0.2,
                                         rlon_min=rlon_min - 0.4,
                                         rlon_max=rlon_max + 0.4,
                                         alpha_background=0.5)
            ax.scatter(rlon[:i + 1], rlat[:i + 1], s=20, color='red')
            plt.title('Station %s - Grid Point %s' % (S, i))
            plt.axis('scaled')
            fig.savefig(
                '/home/n1no/Documents/ethz/master_thesis/code/project/preprocessing/station_grid_plots/station_%s_grid_point_%s.png'
                % (S, i))
            plt.close()

        if S >= 3:
            break
def plot_station_grids(station_grids):
    fig = plt.figure(figsize=(30, 20))
    ax = plt.subplot(111)

    lon_points = [
        grid_point for station_grid in station_grids
        for grid_point in station_grid[1]
    ]
    lat_points = [
        grid_point for station_grid in station_grids
        for grid_point in station_grid[0]
    ]

    rlon, rlat = PlotUtils.get_rlon_rlat(lon_points, lat_points)

    # needed to truncate the background map
    # rlat_min, rlat_max, rlon_min, rlon_max = -1.3, 1, -3, 0.5
    rlat_min, rlat_max, rlon_min, rlon_max = np.min(rlat), np.max(
        rlat), np.min(rlon), np.max(rlon)

    PlotUtils.plot_map_rlon_rlat(ax=ax,
                                 rlat_min=rlat_min,
                                 rlat_max=rlat_max,
                                 rlon_min=rlon_min,
                                 rlon_max=rlon_max,
                                 alpha_background=0.5)

    ax.scatter(rlon, rlat, s=1, color='red')
    plt.title('Grid Points around Stations')
    plt.axis('scaled')
    fig.savefig(
        '/home/n1no/Documents/ethz/master_thesis/code/project/preprocessing/station_grid_plots/station_grid_plot.png'
    )
    plt.close()