Beispiel #1
0
#double check to make sure the mask files match up with the data files
for d,m in zip(datafiles, maskfiles):
    [d_stat,d_date,d_type] = d.split('_')
    [m_stat,m_date,m_type] = m.split('_')
    print 'Checking mask/data match for %s'%(d_date)
    if d_date == m_date and d_stat == m_stat:
        print 'Check!'
        continue
    else:
        sys.exit("Error: Mask files don't match data files")

#open, altitude resample, and concatenate data and mask files

for d,m in zip(datafiles, maskfiles):
    d_temp, data_prod = LNC.lnc_reader(d)
    d_realt = LNC.alt_resample(d_temp,altrange)

    try:
        d_event = pan.concat([d_event,d_realt])
    except NameError:
        d_event = d_realt

    m_temp, data_prod = LNC.lnc_reader(m)
    m_realt = LNC.alt_resample(m_temp,altrange)

    try:
        m_event = pan.concat([m_event,m_realt])
    except NameError:
        m_event = m_realt
Beispiel #2
0

"""
   To plot from lidar data files

"""

#set up plot
theFig = plt.figure(1)
theFig.clf()
theAx = theFig.add_subplot(111)
theAx.set_title('')
theAx.set_ylabel('height (meters)')
theAx.set_xlabel('hours from July 6 00:00:00')

df, product = LNC.lnc_reader('/home/datatmp/nchaparr/UBC_20120707_BR532.txt')
data, timestamps, altitudes = LNC.pandas_to_numpy(df)
print 'scattering limits', data.max(), data.min()

data = data[:,:1300]
xtick_ind = [int(i*1436.0/10) for i in range(10)]
ytick_ind = [int(i*1300.0/10) for i in range(10)]
xticks = [timestamps[ind] for ind in xtick_ind]
yticks = [altitudes[:1300][ind] for ind in ytick_ind]
yticks = list(reversed(yticks))

xticks1 = [int(1.0*(timestamps[ind] - np.datetime64('2012-07-06T00:00:00.000000000-0700'))/np.timedelta64(1, 'h')+7) for ind in xtick_ind]

print 'timestamps and durations from 0hrs', timestamps[1], timestamps[1430],  xticks, xticks1

im = theAx.imshow(data.T[::-1], aspect = .5, vmax=abs(data).max(), vmin=abs(data).min())
    if BR_type in f:
        BRfiles.append(f)

#make sure the files are in a common order of ascending date (assuming they're all
#from the same station
BRfiles.sort()
    
counter = 0
header = {}

#open, altitude resample, and concatenate data and mask files

dataprods = []
counter = 0
for br in BRfiles:
    br_temp, tempprod = LNC.lnc_reader(br)
    br_realt = LNC.alt_resample(br_temp,altrange)

    if counter == 0:
        br_event = br_realt
        dataprods.append(BR_type)
    else:
        br_event = pan.concat([br_event,br_realt])
    
    counter +=1
        

altrange = br_realt.columns.values    
#sort by index to make certain data is in order then set date ranges to match

br_event = br_event.sort_index()