Пример #1
0
                station_min_max[station_index][year]['spd_min'] = min_spd
                station_min_max[station_index][year]['spd_max'] = max_spd
                dir_min, dir_max = np.argmin(year_spd), np.argmax(year_spd)
                yr_dir_min, yr_dir_max = year_dir[dir_min], year_dir[dir_max]
                station_min_max[station_index][year]['dir_at_min'] = yr_dir_min
                station_min_max[station_index][year]['dir_at_max'] = yr_dir_max
            try:
                # A stacked histogram with normed
                # (displayed in percent) results.
                ax = new_axes()
                ax.set_title(station_index.split(":")[-1] +
                             " stacked histogram with normed (displayed in %)"
                             "\nresults (spd in knots), All Time.")
                ax.bar(all_time_dir, all_time_spd, normed=True,
                       opening=0.8, edgecolor='white')
                set_legend(ax)

                fig = plt.gcf()
                fig.set_size_inches(8, 8)
                fname = './images/%s.png' % station_index.split(":")[-1]
                fig.savefig(fname, dpi=100)
            except Exception as e:
                print("Error when plotting %s" % e)
                pass

        except Exception as e:  # Be specific here!
            print("Error: %s" % e)
            pass

# <codecell>
Пример #2
0
for station in st_list.keys():
    if st_list[station]['hasObsData']:
        df = st_list[station]['obsData']
        try:
            # A stacked histogram with normed (displayed in percent) results.
            ax = new_axes()  # Wind rose polar axes
            ax.set_title("Station " + station.split(":")[-1] +
                         "\nstacked histogram with normed (displayed in %)")
            wind_speed = df['wind_speed (m/s)'].values
            wind_direction = df['wind_from_direction (degree)'].values
            ax.bar(wind_direction,
                   wind_speed,
                   normed=True,
                   opening=0.8,
                   edgecolor='white')
            set_legend(ax, 'Wind Speed (m/s)')

            fig = plt.gcf()
            fig.set_size_inches(8, 8)
            fname = './images/%s.png' % station.split(":")[-1]
            fig.savefig(fname, dpi=100)
        except Exception as e:
            print("Error when plotting %s" % e)

# <markdowncell>

# #### Define a couple plotting functions

# <codecell>

Пример #3
0
for f in filelist:
    os.remove("./images/{}".format(f))

# Do work...
for station in st_list.keys():    
    if st_list[station]['hasObsData']:
        df = st_list[station]['obsData']
        try:
            # A stacked histogram with normed (displayed in percent) results.
            ax = new_axes()  # Wind rose polar axes
            ax.set_title("Station " + station.split(":")[-1] +
                         "\nstacked histogram with normed (displayed in %)")
            wind_speed = df['wind_speed (m/s)'].values
            wind_direction = df['wind_from_direction (degree)'].values
            ax.bar(wind_direction, wind_speed, normed=True, opening=0.8, edgecolor='white')
            set_legend(ax, 'Wind Speed (m/s)')

            fig = plt.gcf()
            fig.set_size_inches(8, 8)
            fname = './images/%s.png' % station.split(":")[-1]
            fig.savefig(fname, dpi=100)
        except Exception as e:
            print("Error when plotting %s" % e)

# <markdowncell>

# #### Define a couple plotting functions

# <codecell>

def plot_probability_density(annual_max, station_id):
Пример #4
0
                station_min_max[station_index][year]['dir_at_min'] = yr_dir_min
                station_min_max[station_index][year]['dir_at_max'] = yr_dir_max
            try:
                # A stacked histogram with normed
                # (displayed in percent) results.
                ax = new_axes()
                ax.set_title(
                    station_index.split(":")[-1] +
                    " stacked histogram with normed (displayed in %)"
                    "\nresults (spd in knots), All Time.")
                ax.bar(all_time_dir,
                       all_time_spd,
                       normed=True,
                       opening=0.8,
                       edgecolor='white')
                set_legend(ax)

                fig = plt.gcf()
                fig.set_size_inches(8, 8)
                fname = './images/%s.png' % station_index.split(":")[-1]
                fig.savefig(fname, dpi=100)
            except Exception as e:
                print("Error when plotting %s" % e)
                pass

        except Exception as e:  # Be specific here!
            print("Error: %s" % e)
            pass

# <codecell>