""" 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())
# header = pan.read_hdf(filename,'header') # # dataout_dict = {} # for dtype in datatypes: # dataout_dict[dtype] = pan.read_hdf(filename,dtype) # ## store.close() # # return header, dataout_dict if __name__=='__main__': olddir = os.getcwd() os.chdir('E:\CORALNet\ASCII_Files\Smoke2012\Whistler') newdir = ltools.set_dir('Select Event Folder') os.chdir(newdir) PR_type = 'PR532' BR_type = 'BR532' MSK_type = 'PR532_msk' #set altitude range and date step sizes minalt = 150 # minimum altitude in meters maxalt = 15000 # maximum altitude in meters altstep = 30 # altitude step in meters altrange = np.arange(minalt,maxalt+altstep,altstep) start = []#datetime.datetime(2013,04,22,00) end = []#datetime.datetime(2013,05,04,17)
@author: dashamstyr """ import LNC_tools as ltools import os, sys import numpy as np import matplotlib.pyplot as plt import slowhist as h2d from matplotlib import cm olddir = os.getcwd() os.chdir('C:\Users\dashamstyr\Dropbox\PhD - General') filepath = ltools.get_files('Select LNC file', filetype = ('.h5', '*.h5')) datatypes = ['BR532','PR532'] header, data_dict = ltools.from_HDF(filepath[0], datatypes) try: BRdat = data_dict[datatypes[0]] except KeyError: sys.exit("No BR532 data available!") try: PRdat = data_dict[datatypes[1]] except KeyError: sys.exit("No PR532 data available!")
import numpy as np import os,sys import LNC_tools as LNC #---------------------------------------------------------------------------- #Uses tools created in LNC_tools to open all files in a folder and resample #them to a regular spacing in altitude/date the concatenates them into one #pandas dataframe and plots it using LNC_plot #July 05, 2012 #---------------------------------------------------------------------------- olddir = os.getcwd() #os.chdir('K:\CORALNet\Data\ASCII Files') newdir = LNC.set_dir('Select Event Folder') os.chdir(newdir) files = os.listdir(newdir) maskfiles = [] datafiles = [] procfiles = [] rawfiles = [] #set altitude range and date step sizes altrange = np.arange(10,10010,10)#meters timestep = '120S' #seconds #set buffer around backscatter ratio of 1 for mask
## startdate = dt.datetime(2013, 4, 29, 17, 0) enddate = dt.datetime(2013, 4, 30, 16, 0) minalt = 500 maxalt = 10000 fig = plt.figure() h_set = ["12"] olddir = os.getcwd() os.chdir("C:\Users\dashamstyr\Desktop\CORALNet - May2013\ASCII") filepath = LNC.get_files("Select first file to be plotted", filetype=(".pickle", "*.pickle")) if filepath[0] == "{": filepath = filepath[1:-1] [path, filename] = os.path.split(filepath) os.chdir(path) df = pan.load(filename) df = df.loc[startdate:enddate, :maxalt] if minalt != 0: df.loc[:, :minalt] = "nan" datetime = df.index alt = df.columns ax = fig.add_subplot(2, 1, 1)
## # startdate = dt.datetime(2013,4,29,17,0) # enddate = dt.datetime(2013,4,30,16,0) minalt = 200 maxalt = 12000 fig = plt.figure() h_set = ['12'] olddir = os.getcwd() os.chdir('C:\Users\dashamstyr\Dropbox\Lidar Files\UBC Cross-Cal\Processed') filepath = LNC.get_files('Select first file to be plotted', filetype = ('.pickle','*.pickle')) if filepath[0] == '{': filepath = filepath[1:-1] df = LNC.from_HDF(filepath,[]) df = df.loc[:,:maxalt] if minalt != 0: df.loc[:,:minalt] = 'nan' datetime = df.index alt = df.columns ax = fig.add_subplot(2,1,1) im = backscatter_plot(fig, ax, datetime,alt[::-1],df.T[::-1], fsize = fsize) cbar = fig.colorbar(im, orientation = 'vertical', aspect = 6) cbar.ax.tick_params(labelsize = fsize)
startdate = dt.datetime(2012,8,4,0,0) enddate = dt.datetime(2012,8,16,0,0) minalt = 150 maxalt = 8000 fig = plt.figure() h_set = ['12'] olddir = os.getcwd() os.chdir('C:\Users\dashamstyr\Dropbox\PhD - General\My Papers\Smoke Depol July 2012\CORALNet Data') filepath = LNC.get_files('Select files', filetype = ('.h5','*.h5')) if filepath[0] == '{': filepath = filepath[1:-1] [path, filename] = os.path.split(filepath[0]) os.chdir(path) dtypes = ['BR532','PR532_msk'] header, df_dict = LNC.from_HDF(filename, dtypes) df = df_dict[dtypes[0]] alt = [c for c in df.columns if c >= minalt and c <= maxalt] datetime = [d for d in df.index if d >= startdate and d <= enddate]
import os, sys import numpy as np import datetime as dt import bisect import matplotlib.pyplot as plt import matplotlib.colors as clr import pandas as pan import LNC_tools as LNC import LNC_plot as LNCplt minalt = 500 maxalt = 8000 os.chdir('F:\Siberian Smoke Data\CORALNet Data\WHI\July3') filepath = LNC.get_files('Select data file', filetype = ('.pickle','*.pickle')) if filepath[0] == '{': filepath = filepath[1:-1] [path, filename] = os.path.split(filepath) os.chdir(path) df = pan.load(filename) daterange = df.index ymin = df.columns[0] ymax = df.columns[-1] df = df.loc[:,:maxalt] df.loc[:,:minalt] = 'nan'
import LNC_tools as LNC import time, datetime #---------------------------------------------------------------------------- #Uses tools created in LNC_tools to open all files in a folder and resample #them to a regular spacing in altitude/date the concatenates them into one #pandas dataframe and plots it using LNC_plot #This version only handles backscatter ratio, not polarization #October 07, 2013 #---------------------------------------------------------------------------- olddir = os.getcwd() #os.chdir('K:\CORALNet\Data\ASCII Files') newdir = LNC.set_dir('Select Event Folder') os.chdir(newdir) BR_type = 'BR1064' files = os.listdir(newdir) BRfiles = [] PRfiles = [] procfiles = [] rawfiles = [] #set altitude range and date step sizes altrange = np.arange(10,5010,10)#meters timestep = '120S' #seconds