Пример #1
0
if __name__ == '__main__':

    # Save directory
    SAVE = "./"

    # Date range for data
    start = datetime(2016, 6, 15, 6, 0)
    end = datetime(2016, 6, 16, 6, 0)

    # MesoWest station ID
    stn = 'MTMET'

    # Get MesoWest Data
    a = MW.get_mesowest_ts(stn,
                           start,
                           end,
                           variables='wind_direction,PM_25_concentration')

    # Get data we want from the dictionary
    wd = a['wind_direction']
    ws = a['PM_25_concentration']

    rose_with_labels()
    rose_no_labels()
    clock_rose()
    """
    SOME NOTES:
    to look at the values used to create the plot look
      at ax._info
      ax._info['table'] contains the frequency for each bin in each direction
      np.sum(ax._info['table'],axis=0) is the total frequency for each direction
Пример #2
0
    #ax.set_rmax(5)                                         # uncomment to unify all rmax
    ax.set_rmax(np.max(np.sum(ax._info['table'],
                              axis=0)))  # set rmax as the biggest arm

    plt.savefig("wind_hi_clock.png", bbox_inches="tight", dpi=500)
    #plt.show()
    #print np.sum(ax._info['table'],axis=0)


if __name__ == '__main__':
    ##All in-situ stations

    start = datetime(2014, 11, 1, 0, 0)
    end = datetime(2016, 2, 28, 0, 0)

    a = MW.get_mesowest_ts('ukbkb', start, end)

    # The idea is we are creating an ozone rose from a wind rose
    # wd is the wind direction
    # ws is typically the wind speed, but in this case it is ozone
    wd = a['wind direction']
    ws = a['wind speed']

    rose_with_labels()
    rose_no_labels()
    clock_rose()
    """
    SOME NOTES:
    to look at the values used to create the plot look
      at ax._info
      ax._info['table'] contains the frequency for each bin in each direction
Пример #3
0
    plt.savefig("hi_clock.png", bbox_inches="tight", dpi=500)
    #plt.show()
    print np.sum(ax._info['table'], axis=0)


if __name__ == '__main__':
    ##All in-situ stations
    stations = [
        'bgrut', 'qbv', 'qbr', 'fwp', 'o3s08', 'gslm', 'qhv', 'qhw', 'qh3',
        'lms', 'ql4', 'naa', 'qnp', 'qo2', 'qsa', 'qsf', 'mtmet'
    ]

    start = datetime(2015, 6, 1, 0, 0)
    end = datetime(2015, 6, 30, 0, 0)

    a = MW.get_mesowest_ts(stations[-1], start, end)

    # The idea is we are creating an ozone rose from a wind rose
    # wd is the wind direction
    # ws is typically the wind speed, but in this case it is ozone
    wd = a['wind direction']
    ws = a['ozone']

    rose_with_labels()
    rose_no_labels()
    clock_rose()
    """
    SOME NOTES:
    to look at the values used to create the plot look
      at ax._info
      ax._info['table'] contains the frequency for each bin in each direction
Пример #4
0
                         dtype=None,
                         delimiter=',')
    HRRR_dates = HRRR[stn]
    HRRR_DATES = np.array([])
    for j in HRRR_dates:
        converted_time = datetime.strptime(j, '%Y-%m-%d %H:%M')
        HRRR_DATES = np.append(HRRR_DATES, converted_time)

    HRRR_temp = HRRR['temp']
    HRRR_dwpt = HRRR['dwpt']
    HRRR_u = HRRR['u']
    HRRR_v = HRRR['v']
    HRRR_speed = HRRR['speed']

    # Get the MesoWest Observations for the same time period
    a = MesoWest_timeseries.get_mesowest_ts(stn, HRRR_DATES[0], HRRR_DATES[-1])
    MW_DATES = a['datetimes']
    MW_temp = a['temperature']
    MW_dwpt = a['dew point']
    MW_u, MW_v = wind_calcs.wind_spddir_to_uv(a['wind speed'],
                                              a['wind direction'])
    MW_speed = a['wind speed']
    MW_dir = a['wind direction']

    # Plot the comparison
    fig = plt.figure(1)
    plt.clf()
    plt.cla()
    ax = fig.add_subplot(111)
    ax.plot(HRRR_DATES, HRRR_temp, color='k', lw=1)
    ax.plot(MW_DATES, MW_temp, lw=.5, color='r')
Пример #5
0
def plot_ts(stations):
    for stn in stations:

        # Get the HRRR file
        HRRR = np.genfromtxt('./2016/Anal_' + stn + '.csv',
                             names=True,
                             dtype=None,
                             delimiter=',')
        HRRR_dates = HRRR[stn]
        HRRR_DATES = np.array([])
        for j in HRRR_dates:
            converted_time = datetime.strptime(j, '%Y-%m-%d %H:%M')
            HRRR_DATES = np.append(HRRR_DATES, converted_time)

        HRRR_temp = HRRR['temp']
        HRRR_dwpt = HRRR['dwpt']
        HRRR_u = HRRR['u']
        HRRR_v = HRRR['v']
        HRRR_speed = HRRR['speed']

        # Get the MesoWest Observations for the same time period
        a = MesoWest_timeseries.get_mesowest_ts(stn, HRRR_DATES[0],
                                                HRRR_DATES[-1])
        MW_DATES = a['datetimes']
        MW_temp = a['temperature']
        MW_dwpt = a['dew point']
        MW_u, MW_v = wind_calcs.wind_spddir_to_uv(a['wind speed'],
                                                  a['wind direction'])
        MW_speed = a['wind speed']
        MW_dir = a['wind direction']

        # Plot the comparison
        fig = plt.figure(1)
        plt.clf()
        plt.cla()
        ax = fig.add_subplot(111)
        ax.plot(HRRR_DATES, HRRR_temp, color='k', lw=1)
        ax.plot(MW_DATES, MW_temp, lw=.5, color='r')
        plt.title(stn)
        plt.ylabel('Temperature (c)')

        ##Format Ticks##
        ##----------------------------------
        from matplotlib.dates import DateFormatter, YearLocator, MonthLocator, DayLocator, HourLocator
        # Find months
        months = MonthLocator()
        # Find days
        days = DayLocator(bymonthday=[1, 15])
        # Find each 0 and 12 hours
        hours = HourLocator(byhour=[0, 6, 12, 18])
        # Find all hours
        hours_each = HourLocator()
        # Tick label format style
        #dateFmt = DateFormatter('%b %d, %Y\n%H:%M')
        dateFmt = DateFormatter('%b %d\n%Y')
        # Set the x-axis major tick marks
        ax.xaxis.set_major_locator(days)
        # Set the x-axis labels
        ax.xaxis.set_major_formatter(dateFmt)
        # For additional, unlabeled ticks, set x-axis minor axis
        #ax.xaxis.set_minor_locator(hours)

        plt.savefig('./fig/' + stn + '_temp.png')

        # Plot the comparison
        fig = plt.figure(2)
        plt.clf()
        plt.cla()
        ax = fig.add_subplot(111)
        ax.plot(HRRR_DATES, HRRR_dwpt, color='k', lw=1)
        ax.plot(MW_DATES, MW_dwpt, lw=.5, color='g')
        plt.title(stn)
        plt.ylabel('Dew Point (c)')

        ##Format Ticks##
        ##----------------------------------
        from matplotlib.dates import DateFormatter, YearLocator, MonthLocator, DayLocator, HourLocator
        # Find months
        months = MonthLocator()
        # Find days
        days = DayLocator(bymonthday=[1, 15])
        # Find each 0 and 12 hours
        hours = HourLocator(byhour=[0, 6, 12, 18])
        # Find all hours
        hours_each = HourLocator()
        # Tick label format style
        #dateFmt = DateFormatter('%b %d, %Y\n%H:%M')
        dateFmt = DateFormatter('%b %d\n%Y')
        # Set the x-axis major tick marks
        ax.xaxis.set_major_locator(days)
        # Set the x-axis labels
        ax.xaxis.set_major_formatter(dateFmt)
        # For additional, unlabeled ticks, set x-axis minor axis
        #ax.xaxis.set_minor_locator(hours)

        plt.savefig('./fig/' + stn + '_dwpt.png')

        # Plot the comparison
        fig = plt.figure(3)
        plt.clf()
        plt.cla()
        ax = fig.add_subplot(111)
        ax.plot(HRRR_DATES, HRRR_speed, color='k', lw=1)
        ax.plot(MW_DATES, MW_speed, lw=.5, color='b')
        plt.title(stn)
        plt.ylabel('Wind Speed (m/s)')

        ##Format Ticks##
        ##----------------------------------
        from matplotlib.dates import DateFormatter, YearLocator, MonthLocator, DayLocator, HourLocator
        # Find months
        months = MonthLocator()
        # Find days
        days = DayLocator(bymonthday=[1, 15])
        # Find each 0 and 12 hours
        hours = HourLocator(byhour=[0, 6, 12, 18])
        # Find all hours
        hours_each = HourLocator()
        # Tick label format style
        #dateFmt = DateFormatter('%b %d, %Y\n%H:%M')
        dateFmt = DateFormatter('%b %d\n%Y')
        # Set the x-axis major tick marks
        ax.xaxis.set_major_locator(days)
        # Set the x-axis labels
        ax.xaxis.set_major_formatter(dateFmt)
        # For additional, unlabeled ticks, set x-axis minor axis
        #ax.xaxis.set_minor_locator(hours)

        plt.savefig('./fig/' + stn + '_wspeed.png')
Пример #6
0
    ax.set_rmax(np.max(np.sum(ax._info['table'],axis=0)))   # set rmax as the biggest arm

    plt.savefig("wind_hi_clock.png",bbox_inches="tight",dpi=500)
    #plt.show()
    #print np.sum(ax._info['table'],axis=0)


if __name__ == '__main__':
    ##All in-situ stations
    
        
    
    start = datetime(2014,11,1,0,0)
    end   = datetime(2016,2,28,0,0)
    
    a = MW.get_mesowest_ts('ukbkb',start,end)
    
    # The idea is we are creating an ozone rose from a wind rose
    # wd is the wind direction
    # ws is typically the wind speed, but in this case it is ozone
    wd = a['wind direction']
    ws = a['wind speed'] 
    
    rose_with_labels()
    rose_no_labels()
    clock_rose()
    
    
    
    
    """
Пример #7
0
    plt.savefig("hi_clock.png",bbox_inches="tight",dpi=500)
    #plt.show()
    print np.sum(ax._info['table'],axis=0)


if __name__ == '__main__':
    ##All in-situ stations
    stations = ['bgrut','qbv','qbr','fwp','o3s08','gslm','qhv','qhw','qh3',
               'lms','ql4','naa','qnp','qo2','qsa','qsf','mtmet']
        
    
    start = datetime(2015,6,1,0,0)
    end   = datetime(2015,6,30,0,0)
    
    a = MW.get_mesowest_ts(stations[-1],start,end)
    
    # The idea is we are creating an ozone rose from a wind rose
    # wd is the wind direction
    # ws is typically the wind speed, but in this case it is ozone
    wd = a['wind direction']
    ws = a['ozone'] 
    
    rose_with_labels()
    rose_no_labels()
    clock_rose()
    
    
    
    
    """
Пример #8
0

if __name__ == '__main__':

    # Save directory
    SAVE = './'

    # Date range for data
    start = datetime(2016, 6, 15, 6, 0)
    end = datetime(2016, 6, 16, 6, 0)

    # MesoWest station ID
    stn = 'MTMET'

    # Get MesoWest Data
    a = MW.get_mesowest_ts(stn, start, end)

    # Get data we want from the dictionary
    wd = a['wind_direction']
    ws = a['wind_speed']

    rose_with_labels()
    rose_no_labels()
    clock_rose()
    """
    SOME NOTES:
    to look at the values used to create the plot look
      at ax._info
      ax._info['table'] contains the frequency for each bin in each direction
      np.sum(ax._info['table'],axis=0) is the total frequency for each direction
      np.max(np.sum(ax._info['table'],axis=0)) is the maximum frequency I like