• xiaoziran
    了解作者
  • matlab
    开发工具
  • 6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 13
    下载次数
  • 2018-12-06 19:35
    上传日期
calipso一级气溶胶产品1064nm和532nm波长的后向散射系数比值,色比垂直剖面图
make_color_ratio_image.zip
  • make_color_ratio_image_uniform_alt.m
    7.3KB
  • avg_lidar_data.m
    1.2KB
  • regrid_lidar.m
    596B
  • uniform_alt.m
    358B
  • kathys_color_ratio_colors.m
    6.3KB
  • convertTAITime.m
    123B
内容介绍
function make_color_ratio_image_uniform_alt(l1b_fName,lat_lim,avg,figureNum,withColorbar) % make_color_ratio_image_uniform_alt % % Usage: % make_color_ratio_image_uniform_alt(l1b_fName,start_lat,len,avg,figureN % um,withColorbar) % % Example: % To make a color ratio browse image for all profiles in level 1 file "fname" from % latitudes 0 to 40N, averaged to 5 km horizontal resolution (15 % profiles): % make_lidar_image_uniform_alt(l1b_fName,[0 40],15,figureNum,withColorbar) % % Description: % Makes an image of the attenuated color ratio % % Inputs: % l1b_fName - Level 1B calipso data file name % lat_lim - Two element array (1x2) containting the latitude limits % of the region of interest % avg - number of shots to average, 1 for none, 2 for 2, etc. % figureNum - the figure number you would like to plot the image in % withColorbar - [optional] use 'withColorbar' to add the color bar % % Requirements: lidar_colorbar.m, kathys_lidar_colors.m, uniform_alt.m, % readHDF.m, bsearch.m % % Acknowledgements: % This is based on Kathy Powells IDL code to accomplish a similar task. The colorbar function is based % on the colorbarf function written by Blair Greenan. % Original Author: R. Kuehn, improved version 7/10/2007. This code was % originally called make_lidar_image_uniform_alt, written by R. Kuehn. It % was modified to make color ratio images by J. Tackett, 8/23/2010. % Get the color info [rgb colors_532 color_bar color_bar_labels] = kathys_color_ratio_colors; % The following code was inserted here to show how the colors are assigned to each pixel (data elements % within the attenuated backscatter profiles). % Load uniform data alt = uniform_alt(20); metadata = hdfread(l1b_fName, '/metadata', 'Fields', 'Lidar_Data_Altitudes', 'FirstRecord',1 ,'NumRecords',1); l1_alt=metadata{1}; %l1_alt = load_altitudes(); % Load all the latitudes array from the L1 file variable = 'Latitude'; [info lat] = readHDF(l1b_fName,variable); variable = 'Longitude'; [info lon] = readHDF(l1b_fName,variable); % TODO Print warning if the wanted latitude is > 75 or < 75. if abs(lat_lim(1)) > 75 || abs(lat_lim(2))> 75 error('Cannot plot latitudes poleward of 75 degrees for now.') return end % ---- Need to correct for wrap-around at poles! TODO!! latTmp = abs(lat - repmat(lat_lim(1),size(lat,1),1)); ilat(1) = find(latTmp==min(latTmp),1,'first'); latTmp = abs(lat - repmat(lat_lim(2),size(lat,1),1)); ilat(2) = find(latTmp==min(latTmp),1,'first'); fprintf('New latitudes %f %f\n',lat(ilat(1)),lat(ilat(2))); indA = min([ilat(1)-1 ilat(2)-1]); % DECREMENT for readHDF!1! indB = abs(ilat(2)-ilat(1)); % Load attenuated backscatter data start = [indA 0]; edges = [indB 583]; variable = 'Total_Attenuated_Backscatter_532'; [info betaP_532] = readHDF(l1b_fName,variable,start,edges); data532 = betaP_532'; clear betaP_532; variable = 'Attenuated_Backscatter_1064'; [info betaP_1064] = readHDF(l1b_fName,variable,start,edges); data1064 = betaP_1064'; clear betaP_1064; % Average data horizontally if avg > 1, data532 = avg_lidar_data(data532,avg); data1064 = avg_lidar_data(data1064,avg); end % make the color ratio colorRatio = data1064./data532; clear data532 clear data1064 start = [indA 0]; edges = [indB 1]; variable = 'Latitude'; [info lat2] = readHDF(l1b_fName,variable,start,edges); B=regrid_lidar(l1_alt,colorRatio,alt); % Make the profile number %profile_num = (indA+[0:avg:indB-avg]')/15; profile_num = [1:1:size(B,2)]; alt_num = size(B,1); % Load profile time data and convert to utc and matlab time format start = [indA 0]; edges = [indB 1]; variable = 'Profile_Time'; [info TAI] = readHDF(l1b_fName,variable,start,edges); if avg > 1, TAI = avg_lidar_data(TAI,avg); end matlab_serial_date = convertTAITime(TAI); len = length(matlab_serial_date); datestr([matlab_serial_date(1) matlab_serial_date(len)],21) % Load latitude and longitude information start = [indA 0]; edges = [indB 1]; variable = 'Latitude'; [info lat] = readHDF(l1b_fName,variable,start,edges); if avg > 1, lat = avg_lidar_data(lat,avg); end start = [indA 0]; edges = [indB 1]; variable = 'Longitude'; [info lon] = readHDF(l1b_fName,variable,start,edges); if avg > 1, lon = avg_lidar_data(lon,avg); end % ist and iend are the selected start and end locations along the orbit track nAlt = size(B,1); nProf = size(B,2); if nargin == 5, if strcmp('withColorbar',withColorbar), addColorbar = 1; end else addColorbar = 0; end % For some reason adding the color bar messes up the colormap for the image. % I spent a bunch of time trying to figure out why and was unable to determine the exact cause. % So, when adding a colorbar draw the image as MxNx3 if addColorbar, out_img = zeros(nAlt,nProf,3,'uint16'); else out = zeros(nAlt,nProf,'uint8'); out2 = zeros(nAlt,nProf); end for ic=1:nProf, % the_profile_mfs contains the color ratio values, 0.01:0.01:.... % division by 1.0e-1 converts the color ratio values to an integer value. % each integer value is associated to a color within colors_532. % tmp = floor(data(:,ic) / 1.0e-1); tmp = zeros(uint16(alt_num),1); tmp(B(:,ic)<0) = 1; tmp(B(:,ic)<0.1 & B(:,ic)>0.0) = 2; tmp(B(:,ic)<0.2 & B(:,ic)>0.1) = 3; tmp(B(:,ic)<0.3 & B(:,ic)>0.2) = 4; tmp(B(:,ic)<0.4 & B(:,ic)>0.3) = 5; tmp(B(:,ic)<0.5 & B(:,ic)>0.4) = 6; tmp(B(:,ic)<0.6 & B(:,ic)>0.5) = 7; tmp(B(:,ic)<0.7 & B(:,ic)>0.6) = 8; tmp(B(:,ic)<0.8 & B(:,ic)>0.7) = 9; tmp(B(:,ic)<0.9 & B(:,ic)>0.8) = 10; tmp(B(:,ic)<1.0 & B(:,ic)>0.9) = 11; tmp(B(:,ic)<1.1 & B(:,ic)>1.0) = 12; tmp(B(:,ic)<1.2 & B(:,ic)>1.1) = 13; tmp(B(:,ic)<1.3 & B(:,ic)>1.2) = 14; tmp(B(:,ic)<1.4 & B(:,ic)>1.3) = 15; tmp(B(:,ic)<1.5 & B(:,ic)>1.4) = 16; tmp(B(:,ic)<1.6 & B(:,ic)>1.5) = 17; tmp(B(:,ic)<1.7 & B(:,ic)>1.6) = 18; tmp(B(:,ic)>1.7) = 18; tmp(isnan(B(:,ic))) = 1; tmp(isinf(B(:,ic))) = 1; tmp(tmp==0) = 1; % Convert the out value (which is an index) to a color. if addColorbar, rgb(251,:) = 160; tmp = colors_532(tmp); out_img(:,ic,1) = uint16(rgb(tmp,1)/255*65535); out_img(:,ic,2) = uint16(rgb(tmp,2)/255*65535); out_img(:,ic,3) = uint16(rgb(tmp,3)/255*65535); else out(:,ic) = colors_532(tmp) - 1; % Required for uint8 image indexing end end TheFig = figure(figureNum); clf if addColorbar, imgSize = [1024 512]; temp = get(TheFig,'Position'); set(TheFig,'Position',[temp(1) temp(2) imgSize(1) imgSize(2)]); clf h=image(profile_num,alt,out_img); IH = gca; set(gca,'YDir','normal') xx = get(gca,'XTick'); %%cc = cell(size(xx)); cc = ''; for j=1:length(xx), cc = strvcat(cc,sprintf('%5.2f',lat(xx(j)))); end set(gca,'XTickLabel',cc); cb=lidar_colorbar(rgb,color_bar,color_bar_labels,'vert'); set(cb,'Position',[0.935 0.113 0.013 0.845]) set(IH,'Position',[0.06 0.111 0.86 0.844]); ylabel('Altitude (km) ') xlabel('Latitude ') title('Attenuated Color Ratio ') else pcolor(profile_num,alt,out2); shading flat;% view(2) caxis([-4 -1]) %colormap(rgb/255); %image(profile_num,alt,out); %get(h) %set(h,'YAxis','reverse') end
评论
  • tomly 2021-03-19 04:47:57
    我用的是matlab2016a,运行的时候会报错,uniform_alt.m 提示未定义函数或变量 'load_altitudes'。
相关推荐
  • make_lidar_image.zip
    calipso一级数据产品总衰减后续散射剖面图
  • matlabcnhelp.rar
    matlab中文帮助很难找的,快速下载
  • MobilePolice.rar
    移动警察,车牌识别,车牌定位系统源代码,已经运用在移动车载稽查系统中。
  • SVM(matlab).rar
    支持向量机(SVM)实现的分类算法源码[matlab]
  • svm.zip
    用MATLAB编写的svm源程序,可以实现支持向量机,用于特征分类或提取
  • Classification-MatLab-Toolbox.rar
    模式识别matlab工具箱,包括SVM,ICA,PCA,NN等等模式识别算法,很有参考价值
  • VC++人脸定位实例.rar
    一个经典的人脸识别算法实例,提供人脸五官定位具体算法及两种实现流程.
  • QPSK_Simulink.rar
    QPSK的Matlab/Simulink的调制解调仿真系统,给出接收信号眼图及系统仿真误码率,包含载波恢复,匹配滤波,定时恢复等重要模块,帮助理解QPSK的系统
  • LPRBPDemo2009KV.rar
    车牌识别,神经网络算法,识别率高达95%,识别时间低于80ms。
  • MODULATION.RAR
    这个源程序代码包提供了通信系统中BPSK,QPSK,OQPSK,MSK,MSK2,GMSK,QAM,QAM16等调制解调方式 用matlab的实现,以及它们在AWGN和Rayleigh信道下的通信系统实现及误码率性能