%=============================================== % % PLMR processing software (plotting) % % This program takes the data file from RASP % and the RT3000 and creates various data plots. % This program is not a stand alone program for distribution!!! % It is to be used after processing the data with RASP. % % Author Date version % C. R�diger 04-Jan-09 1.0 % C. R�diger 04-Jan-09 2.0 now reads in preprocessed % data from RT and RASP output files % C. R�diger 14-Sep-09 2.1 reads in new RASP format % C. R�diger 12-Nov-09 3.0 changed to function % %=============================================== function f_graph_rasp close all clearvars %-except RASP_* var3_h %----------------------------------- % set parameters %----------------------------------- [linux,preproc,ussr,p2sp,rasp,calib,anci,kml,plmr_pro,graphs,experi,geb,pol,res,chk,sve,plt,tpause]=c_input_arg; [fpath,file_date,file_name_PLMR,file_name_RASP,file_name_RT,file_name_counts, ... prosensing,experi,pol,calib, ... plt] ... =c_file_defs; [high_res_start,high_res_end,low_res_start,low_res_end, ... minE,maxE,minN,maxN,UTM,datum,s_bin, ... temp_corr, ... RTstart,RTend,GPS_offset, ... step,range_h,bins_h,range_v,bins_v,range_TIR] ... =c_flight_params; file_path=fullfile(fpath,'Data',experi,'field',file_date,'CUBE'); if (strcmp(res,'lo')==1) res2='low'; else res2='high'; end %----------------------------------- % open data files %----------------------------------- for j=1:size(pol,1) close all fname=fullfile(file_path,[file_name_RASP,'_',pol(j),'.dat']); fRASP=fopen(fname,'r'); fgetl(fRASP); RASP=fscanf(fRASP,'%i,%f,%f,%f,%i,%f,%f,%i,%i,%i,%f,%f,%f,%f,%f\n',inf); RASP=reshape(RASP,15,size(RASP,1)/15)'; fclose(fRASP); %----------------------------------- % temperature correction %----------------------------------- RASP(:,6)=RASP(:,6)./(temp_corr(1).*(RASP(:,1)./86400./1000).^5 + ... temp_corr(2).*(RASP(:,1)./86400./1000).^4 + ... temp_corr(3).*(RASP(:,1)./86400./1000).^3 + ... temp_corr(4).*(RASP(:,1)./86400./1000).^2 + ... temp_corr(5).*(RASP(:,1)./86400./1000).^1 + ... temp_corr(6)); %----------------------------------- % save temperature corrected data %----------------------------------- if(sve) fname=fullfile(file_path,['Rt_',file_name_RASP,'_',pol(j),'_',geb,'.dat']); fRASP=fopen(fname,'w'); fprintf(fRASP,'%i,%f,%f,%f,%i,%f,%f,%i,%i,%i,%f,%f,%f,%f,%f\n',RASP'); fclose(fRASP); end %----------------------------------- % resample data according to beams and also geographic extend % also filter all data from turns with more than a 2.5� roll %----------------------------------- L3=RASP(RASP(:,5)==1,:); L2=RASP(RASP(:,5)==2,:); L1=RASP(RASP(:,5)==3,:); R1=RASP(RASP(:,5)==4,:); R2=RASP(RASP(:,5)==5,:); R3=RASP(RASP(:,5)==6,:); roll_f=2.5; if (strcmp(geb,'WH08')==1 || strcmp(geb,'WH09')==1) f_L3=find(L3(:,1)>low_res_start & L3(:,1)low_res_start & L2(:,1)low_res_start & L1(:,1)low_res_start & R1(:,1)low_res_start & R2(:,1)low_res_start & R3(:,1)low_res_start & L3(:,1)low_res_start & L2(:,1)low_res_start & L1(:,1)low_res_start & R1(:,1)low_res_start & R2(:,1)low_res_start & R3(:,1)45 & abs(L3_ref(i+1,13)-L3_ref(i,13))<270) %disp([num2str(L3_ref(i+1,13)),' ',num2str(L3_ref(i,13))]); fturn=fturn+1; tstamp(fturn)=i; end end sz_L3=1; sz_L2=1; sz_L1=1; sz_R1=1; sz_R2=1; sz_R3=1; clear Tb_L* Tb_R* %----------------------------------- % process individual transects %----------------------------------- for i=1:size(tstamp,2)+1 if (i==1) filt_start=low_res_start; filt_end=L3_ref(tstamp(i),1); elseif (1filt_start & L3_ref(:,1)filt_start & L2_ref(:,1)filt_start & L1_ref(:,1)filt_start & R1_ref(:,1)filt_start & R2_ref(:,1)filt_start & R3_ref(:,1)sm1); hist(var_2(f,6),[sm1:4:lg1]) xlim([sm1+5 lg1-5]); mu=mean(var_2(f,6)); sig=std(var_2(f,6),1); title(['mu=',num2str(mu),', sigma=',num2str(sig)],'fontsize',8) subplot(2,2,4) f=find(var_2(:,6)>=sm2 & var_2(:,6)=E_center-s_bin/2 & var_2(:,2)<=E_center+s_bin/2 ... & var_2(:,3)>=N_center-s_bin/2 & var_2(:,3)<=N_center+s_bin/2); if (size(num,1)>0) Tb(N,E,1)=mean(var_2(num,6)); end Tb(N,E,2)=E_center; Tb(N,E,3)=N_center; end end r_Tb(:,1)=reshape(Tb(:,:,1),N_diff/s_bin*E_diff/s_bin,1); r_Tb(:,2)=reshape(Tb(:,:,2),N_diff/s_bin*E_diff/s_bin,1); r_Tb(:,3)=reshape(Tb(:,:,3),N_diff/s_bin*E_diff/s_bin,1); f=find(~isnan(r_Tb(:,1))); Tb_mean=mean(r_Tb(f,1)); SD_Tb=std(r_Tb(f,1),1); %----------------------------------- % save gridded data to output file %----------------------------------- if(sve) fiz=fopen(fullfile(file_path,['Tbgrid_',file_name_PLMR,'_',pol(j),'_',geb,'.dat']),'w'); fprintf(fiz,'Tb,X_UTM,Y_UTM\n'); fprintf(fiz,'%10.6f, %10.6f, %10.6f \n',r_Tb'); fclose('all'); end %----------------------------------- % plot spatial plot at 1km resolution %----------------------------------- figure(1) clf pcolor(Tb(:,:,2),Tb(:,:,3),Tb(:,:,1)) title([res2,' resolution Tb',pol(j),' [K] at ',geb]) axis equal shading flat xlim([minE maxE]);%ylim([minN maxN]); colorbar; caxis(eval(genvarname(['range_' pol(j)]))) xlabel('Easting [m]');ylabel('Northing [m]'); if(plt) print('-djpeg','-r300',fullfile(fpath,'Data',experi,'field',file_date,'plots',[geb,'_Tb',pol(j),'_gridded_corr'])) end %----------------------------------- % plot spatial anomalies plot at 1km resolution %----------------------------------- figure(2) clf pcolor(Tb(:,:,2),Tb(:,:,3),Tb(:,:,1)-Tb_mean) title([res2,' resolution Tb',pol(j),' anomalies [K] at ',geb]) axis equal shading flat xlim([minE maxE]);%ylim([minN maxN]); xlabel('Easting [m]');ylabel('Northing [m]'); colorbar; caxis([-15*step 15*step]) if(plt) print('-djpeg','-r300',fullfile(fpath,'Data',experi,'field',file_date,'plots',[geb,'_Tb',pol(j),'_gridded_anom'])) end %----------------------------------- % plot histogram of 1km resolution data %----------------------------------- figure(3) clf hist(r_Tb(f),[ceil(Tb_mean)-15*step:step:ceil(Tb_mean)+15*step]) title([res2,' resolution Tb',pol(j),' at ',geb,' (mu=',num2str(Tb_mean), ... ', sigma=',num2str(SD_Tb),')'],'fontsize',12) %title(['mu=',num2str(Tb_mean),', sigma=',num2str(SD_Tb)],'fontsize',20,'color','r','fontweight','b') xlim([ceil(Tb_mean)-15*step ceil(Tb_mean)+15*step]) set(gca,'fontsize',8) xlabel('Tb (Kelvin)');ylabel('# of occurences') if(plt) print('-djpeg','-r300',fullfile(fpath,'Data',experi,'field',file_date,'plots',[geb,'_Tb',pol(j),'_gridded_PDF'])) end if (strcmp(geb,'SD08')==1 || strcmp(geb,'LE08')==1 || strcmp(geb,'LE09')==1) if (strcmp(geb,'LE08')==1) sm1=45; lg1=130; sm2=220; lg2=311; elseif (strcmp(geb,'SD08')==1) sm1=175; lg1=230; sm2=230; lg2=285; elseif (strcmp(geb,'LE09')==1) sm1=45; lg1=130; sm2=220; lg2=311; end figure(103) subplot(2,2,[1 2]) hist(r_Tb(f),[sm1:4:lg2]) xlim([sm1+5 lg2-5]); mu=mean(r_Tb(f)); sig=std(r_Tb(f),1); set(gca,'fontsize',8) ylabel('# of occurences','fontsize',8) % title(['Lowres all-beams ',geb,', mu=',num2str(mu),', sigma=',num2str(sig)],'fontsize',20) title(['mu=',num2str(mu),', sigma=',num2str(sig)],'fontsize',8,'color','r','fontweight','b') subplot(2,2,3) f=find(r_Tbsm1); hist(r_Tb(f),[sm1:4:lg1]) xlim([sm1 lg1]); mu=mean(r_Tb(f)); sig=std(r_Tb(f),1); set(gca,'xtick',[sm1:20:lg1],'fontsize',8) xlabel('Tb [Kelvin]','fontsize',8);ylabel('# of occurences','fontsize',8) title(['mu=',num2str(mu),', sigma=',num2str(sig)],'fontsize',9,'color','k','fontweight','b') subplot(2,2,4) f=find(r_Tb>=sm2 & r_Tblow_res_start & vpol(:,1)low_res_start & hpol(:,1)low_res_start & vpol(:,1)low_res_start & hpol(:,1)low_res_start & vpol(:,1)low_res_start & hpol(:,1)low_res_start & vpol(:,1)low_res_start & hpol(:,1)low_res_start & T_out(:,1) only for low-res area %----------------------------------- figure(5) set(gcf, 'PaperType','uslegal'); set(gcf, 'PaperUnits','normalized'); set(gcf, 'PaperOrientation','portrait'); %set(gcf, 'PaperSize', [1 2.5]); subplot(3,1,1) plot(T_out(f,1)./1000,T_out(f,2:6)) xlabel(' ','fontsize',8);ylabel('Temperature (Celsius)','fontsize',8); legend('Butler','Hot Load','Elec.BR','Elec.BL','Feed', ... 'Location','SouthOutside','Orientation','horizontal') ylim([32 42]);%([minT1 maxT1]) subplot(3,1,2) plot(T_out(f,1)./1000,T_out(f,8:13)) xlabel(' ','fontsize',8);ylabel('Temperature (Celsius)','fontsize',8); legend('FL','BL','Mid','FR','Back','BR', ... 'Location','SouthOutside','Orientation','horizontal') ylim([20 35]);%ylim([minT2 maxT2]) subplot(3,1,3) plot(T_out(f,1),T_out(f,14:19)) xlabel('Time','fontsize',8);ylabel('Temperature (Celsius)','fontsize',8); legend('3L','2L','1L','1R','2R','3R', ... 'Location','SouthOutside','Orientation','horizontal') ylim([35 45]);%ylim([minT3 maxT3]) if(plt) print('-djpeg','-r300',fullfile(fpath,'Data',experi,'field',file_date,'plots',['physical_temperatures_',geb])) end %----------------------------------- % plot electronics temperatures --> all %----------------------------------- figure(6) set(gcf, 'PaperType','uslegal'); set(gcf, 'PaperUnits','normalized'); set(gcf, 'PaperOrientation','portrait'); %set(gcf, 'PaperSize', [1 2.5]); subplot(3,1,1) plot(T_out(:,1)./1000,T_out(:,2:6)) xlabel(' ','fontsize',8);ylabel('Temperature (Celsius)','fontsize',8); legend('Butler','Hot Load','Elec.BR','Elec.BL','Feed', ... 'Location','SouthOutside','Orientation','horizontal') ylim([minT1 maxT1]) subplot(3,1,2) plot(T_out(:,1)./1000,T_out(:,8:13)) xlabel(' ','fontsize',8);ylabel('Temperature (Celsius)','fontsize',8); legend('FL','BL','Mid','FR','Back','BR', ... 'Location','SouthOutside','Orientation','horizontal') ylim([minT2 maxT2]) subplot(3,1,3) plot(T_out(:,1),T_out(:,14:19)) xlabel('Time','fontsize',8);ylabel('Temperature (Celsius)','fontsize',8); legend('3L','2L','1L','1R','2R','3R', ... 'Location','SouthOutside','Orientation','horizontal') ylim([minT3 maxT3]) if(plt) print('-djpeg','-r300',fullfile(fpath,'Data',experi,'field',file_date,'plots',['physical_temperatures_fulltime_',geb])) end %=================================== %----------------------------------- % quit script %----------------------------------- %=================================== return