pro read_nav_olympex,path_prefix,date,julian_day,temp,tas,theta,pres,ppmvw,lat,lon,$ alt,wwind,uwind,vwind,cwc_kng,twc_nev,lwc_nev,iwc_nev,tot_s,cwc_s,rh,cwc_csi,tot_c,tot_p ; Passed in through command line ;date='20151124' ; Strings of the date syear2=strmid(date,2,2) syear='20'+syear2 smonth=strmid(date,4,2) sday=strmid(date,6,2) ; date in idl julian_day julian_day1=julday(smonth,sday,syear,0,0,0) ;**************************************************************** ; 2ds file ;**************************************************************** ;filedir='/uufs/chpc.utah.edu/common/home/mace-group3/field_programs/olympex/nav' filedir=path_prefix+'mace-group6/field_programs/olympex/nav/' filename=syear2+'_'+smonth+'_'+sday+'*.olympex' ;filename='15_11_12_18_49_13.olympex' ;**************************************************************** ; Information to set up the fssp data structure ;**************************************************************** ;x=ascii_template(filedir+'/'+filename) ;{ 1.00000 71 32 NaN 54 4 4 4 4 4 4 4 4 ;4 4 4 4 4 4 3 3 4 4 4 4 4 ;4 4 4 4 4 4 4 4 4 4 4 4 4 ;4 4 7 4 4 4 4 4 4 4 4 4 4 ;4 4 4 4 4 4 4 ;FIELD01 FIELD02 FIELD03 FIELD04 FIELD05 FIELD06 FIELD07 FIELD08 FIELD09 FIELD10 FIELD11 FIELD12 FIELD13 FIELD14 FIELD15 FIELD16 FIELD17 FIELD18 FIELD19 FIELD20 ;FIELD21 FIELD22 FIELD23 FIELD24 FIELD25 FIELD26 FIELD27 FIELD28 FIELD29 FIELD30 FIELD31 FIELD32 FIELD33 FIELD34 FIELD35 FIELD36 FIELD37 FIELD38 FIELD39 FIELD40 ;FIELD41 FIELD42 FIELD43 FIELD44 FIELD45 FIELD46 FIELD47 FIELD48 FIELD49 FIELD50 FIELD51 FIELD52 FIELD53 FIELD54 ;2 18 25 41 49 64 76 87 97 109 123 137 149 ;161 175 186 193 205 217 229 241 253 265 277 289 301 ;318 325 337 349 361 373 385 397 409 421 436 450 457 ;472 484 493 505 517 532 541 553 565 578 590 602 614 ;627 639 ;0 1 2 3 4 5 6 7 8 9 10 11 12 ;13 14 15 16 17 18 19 20 21 22 23 24 25 ;26 27 28 29 30 31 32 33 34 35 36 37 38 ;39 40 41 42 43 44 45 46 47 48 49 50 51 ;52 53 ;} ;IDL> help,/struct,x ;** Structure <11273a08>, 10 tags, length=1552, data length=1545, refs=1: ; VERSION FLOAT 1.00000 ; DATASTART LONG 71 ; DELIMITER BYTE 32 ; MISSINGVALUE FLOAT NaN ; COMMENTSYMBOL STRING '' ; FIELDCOUNT LONG 54 ; FIELDTYPES LONG Array[54] ; FIELDNAMES STRING Array[54] ; FIELDLOCATIONS LONG Array[54] ; FIELDGROUPS LONG Array[54] ;************************************************* ; Define the structure ;************************************************* ; Structure field names field_names=['FIELD01','FIELD02','FIELD03','FIELD04','FIELD05','FIELD06','FIELD07',$ 'FIELD08','FIELD09','FIELD10','FIELD11','FIELD12','FIELD13','FIELD14',$ 'FIELD15','FIELD16','FIELD17','FIELD18','FIELD19','FIELD20','FIELD21',$ 'FIELD22','FIELD23','FIELD24','FIELD25','FIELD26','FIELD27','FIELD28',$ 'FIELD29','FIELD30','FIELD31','FIELD32','FIELD33','FIELD34','FIELD35',$ 'FIELD36','FIELD37','FIELD38','FIELD39','FIELD40','FIELD41','FIELD42',$ 'FIELD43','FIELD44','FIELD45','FIELD46','FIELD47','FIELD48','FIELD49',$ 'FIELD50','FIELD51','FIELD52','FIELD53','FIELD54'] ; Structure field locations field_locations=[2,18,25,41,49,64,76,87,97,109,123,137,149,$ 161,175,186,193,205,217,229,241,253,265,277,289,301,$ 318,325,337,349,361,373,385,397,409,421,436,450,457,$ 472,484,493,505,517,532,541,553,565,578,590,602,614,$ 627,639] ; Structure field types field_types=make_array(54,value=4) ; Structure field groups field_groups=indgen(54) ; Structure field count field_count=[54] ; Ascii template structure h={htemplate,$ VERSION:1.0,$ DATASTART:71,$ DELIMITER:32b,$ MISSINGVALUE:-9999.0,$ COMMENTSYMBOL:'',$ FIELDCOUNT:field_count,$ FIELDTYPES:field_types,$ FIELDNAMES:field_names,$ FIELDLOCATIONS:field_locations,$ FIELDGROUPS:field_groups} ;****************************************************** ; Read the file ;****************************************************** files=file_search(filedir+'/'+filename,count=num_files) print,files print,'num_files',num_files for k=0,num_files-1 do begin dbase=read_ascii(files[k], template=h) start_time=dbase.field01 ; Time [second]; UT seconds from midnight on day aircraft flight started temp=dbase.field02 ; Air Temperature Corrected for Dynamic Heating (Based first on the main temperatue/pitot instrument and secondarly based on the backup temperature/pitot instrument) [degC] ; Mach Number (Based first on the main temperatue/pitot instrument and secondarly based on the backup temperature/pitot instrument) ; Indicated Air Speed (Based first on the main pitot instrument and secondarly based on the backup pitot instrument) [m/s] tas=dbase.field05 ; True Air Speed (Based first on the main temperatue/pitot instrument and secondarly based on the backup temperature/pitot instrument) [m/s] ; Pressure Altitude [m] theta=dbase.field07 ; Potential Temperature (Based first on the main temperatue/pitot instrument and secondarly based on the backup temperature/pitot instrument) [degK] pres=dbase.field08 ; Static Pressure [hPa] {Calibration: slope = 207.08000 offset = -0.71000000} ; Dewpoint Temperature from EG&G Probe [degC] {Calibration: slope = 20.000000 offset = -70.000000} rh=dbase.field10; Relative Humidity from the EG&G probe [%] ppmvw=dbase.field11 ; Mixing Ratio by weight from the Laser Hygrometer [ppmw] ; Dew Point Temperature from the Laser Hygrometer [degrees Celsius] ; Frost Point Temperature from the Laser Hygrometer [degrees Celsius] rh2=dbase.field14; Relative Humidity from the Laser Hygrometer [percent]; With Respect to water T>=0 Respect to Ice T<0 ; The current Sensor (MSO) frequency from the Icing Detector [Hz] ; Date Stamp based on data file name (Example: 941119 is 19 November 1994) [stamp] ; Aircraft roll angle from the Applanix Position and Orientation System (POS); -180 to 180 range with 0 being level and positive angles in the clockwise (right) direction [degrees]. ; Aircraft pitch angle from the Applanix Position and Orientation System (POS); -180 to 180 range with 0 being level and positive angles in the clockwise (upward) direction away from center of the Earth [degrees]. ; Aircraft heading angle from the Applanix Position and Orientation System (POS); 0 to 360 range with 0 being North and angles increasing in a clockwise (right) direction [degrees]. ; Aircraft z-direction (Vertical) acceleration for the Applanix Position and Orientation System (POS) [m/s^2]. lat=dbase.field21; Aircraft latitude from the Applanix Position and Orientation System (POS); -90 to 90 range with positive values in Northern Hemisphere and negative values in Southern Hemisphere [degrees]. lon=dbase.field22; Aircraft longitude from the Applanix Position and Orientation System (POS); -180 to 180 range with positive values in Eastern Hemisphere and negative values in Western Hemisphere [degrees]. alt=dbase.field23; Aircraft altitude from the Applanix Position and Orientation System (POS) [m]. ; Aircraft ground speed from the Applanix Position and Orientation System (POS) [m/s]. ; Aircraft track angle from the Applanix Position and Orientation System (POS); 0 to 360 range with 0 being North.and angles increasing in a clockwise (right) direction [degrees]. ; Alpha (Attack) Angle [degrees] {Calibration: slope = 0.066317100 offset = 0.40082229} ; Beta (Sideslip) Angle [degrees] {Calibration: slope = 0.085875130 offset = 0.16014451} ; Vertical Velocity of the aircraft based on the change in position over a 2 seceond interval [m/s] wwind=dbase.field29; Z (Vertical) Component of the Wind Speed (postivie value is upward, away from the Earth's surface) [m/s] wind_speed=dbase.field30; Horizontal Wind Speed [m/s] wind_dir=dbase.field31; Horizontal Wind Direction [degrees]; True Direction From Which it Blows ; Turbulence parameter (Eddy Dissipation Rate) based on Wing Pitot pressure [cm^2/3*s^-1] cwc_kng=dbase.field33; Liquid Water Content based on King Probe measurement adjusted (cloud threshold = 5.1 [#/cm^3], cloud interval = 30.0 [s] and adjustment slope = 0.500) for the baseline offset [g/m^3] twc_nev=dbase.field34; Total Water Content based on the Nevzorov Probe measurement lwc_nev=dbase.field35; Liquid Water Content based on the Nevzorov Probe measurement with correction for residual ice (beta = 0.110000) [g/m^3] iwc_nev=dbase.field36; Ice Water Content based on the Nevzorov Probe measurement (beta = 0.110000) [g/m^3] cwc_csi2=dbase.field37; CSI measured total water content [mg/m^3] mxrat=dbase.field38; CSI Mixing Ratio [g/m^3] cwc_csi=dbase.field39; Cloud Water Content from the CSI probe with Correction [g/m^3] {Calibration: TDL slope = 1.5070000 TDL offset = 0.025000000 Out-of-Cloud slope = 1.0000000 Out-of-Cloud offset = 0.0000000} tot_s=dbase.field40; Number Concentration of Droplets Based on the Cloud Droplet Probe [#/cc] cwc_s=dbase.field41; Liquid Water Content Based on the Cloud Droplet Probe [g/m^3] ; Cloud Droplet Probe's Mean Droplet Diameter [um] ; Cloud Droplet Probe's Mean Droplet Volume Diameter [um] ; Cloud Droplet Probe's Effective Droplet Radius [um] ; Number concentration of droplets based on the 2-DC Probe measurements [#/cm^3] ; Mean droplet diameter based on the 2-DC Probe measurements [um] ; Mean droplet volume diameter based on the 2-DC Probe measurements [um] ; Effective droplet radius based on the 2-DC Probe measurements [um] ; TwoDS (SN: 012) Horizontal Total Normalize Particle Concentration of Particles Greater than 105 microns [#/m^3] tot_c=dbase.field50; TwoDS (SN: 012) Horizontal Total Normalize Particle Concentration for All Bin Sizes [#/m^3] ; TwoDS (SN: 012) Vertical Total Normalize Particle Concentration of Particles Greater than 105 microns [#/m^3] ; TwoDS (SN: 012) Vertical Total Normalize Particle Concentration for All Bin Sizes [#/m^3] tot_p=dbase.field53; HVPS3 (SN: 04) Horizontal Total Normalize Particle Concentration for All Bin Sizes [#/m^3] ; HVPS3 (SN: 07) Vertical Total Normalize Particle Concentration for All Bin Sizes [#/m^3] ; Change missing value to -9999 result=where(alt gt 99999.,count) if count gt 0 then alt[result]=-9999 result=where(pres gt 99999.,count) if count gt 0 then pres[result]=-9999 result=where(temp gt 99999.,count) if count gt 0 then temp[result]=-9999 result=where(ppmvw gt 999999.,count) if count gt 0 then ppmvw[result]=-9999 result=where(rh gt 999999.,count) if count gt 0 then rh[result]=-9999 result=where(rh2 gt 999999.,count) if count gt 0 then rh2[result]=-9999 result=where(lat gt 999.,count) if count gt 0 then lat[result]=-9999 result=where(lon gt 9999.,count) if count gt 0 then lon[result]=-9999 result=where(wwind gt 999999.,count) if count gt 0 then wwind[result]=-9999 result=where(wind_speed gt 999999.,count) if count gt 0 then wind_speed[result]=-9999 result=where(wind_dir gt 999999.,count) if count gt 0 then wind_dir[result]=-9999 result=where(cwc_kng gt 999999.,count) if count gt 0 then cwc_kng[result]=-9999 result=where(twc_nev gt 999999.,count) if count gt 0 then twc_nev[result]=-9999 result=where(lwc_nev gt 999999.,count) if count gt 0 then lwc_nev[result]=-9999 result=where(iwc_nev gt 999999.,count) if count gt 0 then iwc_nev[result]=-9999 result=where(mxrat gt 999999.,count) if count gt 0 then mxrat[result]=-9999 result=where(cwc_csi gt 999999.,count) if count gt 0 then cwc_csi[result]=-9999 result=where(cwc_csi2 gt 999999.,count) if count gt 0 then cwc_csi2[result]=-9999 result=where(tot_c gt 999999.,count) if count gt 0 then tot_c[result]=-9999 result=where(tot_p gt 999999.,count) if count gt 0 then tot_p[result]=-9999 ; Convert sec_from_midnight to julian_day julian_day=julian_day1+start_time/(60.0*60.0*24.0) ; Calculate uwind and vwind uwind=make_array(/float,n_elements(wind_speed),value=-9999) vwind=make_array(/float,n_elements(wind_speed),value=-9999) result=where(wind_speed ne -9999 and wind_dir ne -9999,count) if count gt 0 then begin uwind[result]=wind_speed[result]*cos(wind_dir[result]) vwind[result]=wind_speed[result]*sin(wind_dir[result]) endif ; RH is included in the file ; Saturation vapor pressure (Vaisala eqn 6) mb ; Temp in celcius ; A=6.116441 ; m=7.591386 ; Tn=240.7263 ; pws=make_array(/float,n_elements(temp),value=-9999) ; result=where(temp ne -9999,count) ; if count gt 0 then begin ; pws[result]=A*exp((m*temp[result])/(temp[result]+Tn)) ; endif ; Vapor pressure (Viasala eqn 20) mb ; pw=make_array(/float,n_elements(temp),value=-9999) ; result=where(pres ne -9999 and ppmvw ne -9999,count) ; if count gt 0 then begin ; pw[result]=(pres[result]*ppmvw[result]*1e-6) ; ;pwd=pres*ppmvw/(ppmvw+1e6) ;eqn 18 ; endif ; Relative Humidity=pw/pws ; pw=vapor pressure ; pws=saturation vapor presure ; rh=make_array(/float,n_elements(temp),value=-9999) ; result=where(pw ne -9999 and pws ne -9999,count) ; if count gt 0 then begin ; rh[result]=100.*(pw[result]/pws[result]) ; endif ; Convert celcius to kelvin result=where(temp ne -9999,count) if count gt 0 then begin temp[result]=temp[result]+273.15 endif if n_elements(com_start_time) eq 0 then begin com_julian_day=julian_day com_start_time=start_time com_temp=temp com_tas=tas com_theta=theta com_pres=pres com_ppmvw=ppmvw com_lat=lat com_lon=lon com_alt=alt com_wwind=wwind com_uwind=uwind com_vwind=vwind com_cwc_kng=cwc_kng com_twc_nev=twc_nev com_lwc_nev=lwc_nev com_iwc_nev=iwc_nev com_tot_s=tot_s com_cwc_s=cwc_s com_rh=rh com_rh2=rh2 com_cwc_csi=cwc_csi com_cwc_csi2=cwc_csi2 com_tot_c=tot_c com_tot_p=tot_p com_mxrat=mxrat endif else begin com_julian_day=[com_julian_day,julian_day] com_start_time=[com_start_time,start_time] com_temp=[com_temp,temp] com_tas=[com_tas,tas] com_theta=[com_theta,theta] com_pres=[com_pres,pres] com_ppmvw=[com_ppmvw,ppmvw] com_lat=[com_lat,lat] com_lon=[com_lon,lon] com_alt=[com_alt,alt] com_wwind=[com_wwind,wwind] com_uwind=[com_uwind,uwind] com_vwind=[com_vwind,vwind] com_cwc_kng=[com_cwc_kng,cwc_kng] com_twc_nev=[com_twc_nev,twc_nev] com_lwc_nev=[com_lwc_nev,lwc_nev] com_iwc_nev=[com_iwc_nev,iwc_nev] com_tot_s=[com_tot_s,tot_s] com_cwc_s=[com_cwc_s,cwc_s] com_rh=[com_rh,rh] com_rh2=[com_rh2,rh2] com_cwc_csi=[com_cwc_csi,cwc_csi] com_cwc_csi2=[com_cwc_csi2,cwc_csi2] com_tot_c=[com_tot_c,tot_c] com_tot_p=[com_tot_p,tot_p] com_mxrat=[com_mxrat,mxrat] endelse endfor if com_julian_day ne !NULL then begin julian_day=com_julian_day start_time=com_start_time temp=com_temp tas=com_tas theta=com_theta pres=com_pres ppmvw=com_ppmvw lat=com_lat lon=com_lon alt=com_alt wwind=com_wwind uwind=com_uwind vwind=com_vwind cwc_kng=com_cwc_kng twc_nev=com_twc_nev lwc_nev=com_lwc_nev iwc_nev=com_iwc_nev tot_s=com_tot_s cwc_s=com_cwc_s rh=com_rh rh2=com_rh2 cwc_csi=com_cwc_csi cwc_csi2=com_cwc_csi2 tot_c=com_tot_c tot_p=com_tot_p mxrat=com_mxrat endif ;*************************************************************** ; Plot to check data ;*************************************************************** do_plot='no' if do_plot eq 'yes' then begin ;*** ; Set up the device ;*** ; Size of the plot window xwin=900 & ywin=900 ; Set up the plotting device set_plot,'z' device,set_resolution=[xwin,ywin] ;*** ; Set up the colors ;*** ; ; Color common common colors,r_orig,g_orig,b_orig,r_curr,g_curr,b_curr ; Load the color table loadct,39 ; Top is the last color to scale 256 colors, 0-255 top_color=252 ; make hot pink for mplflag data in color 253 r_curr[253]=255 g_curr[253]=20 b_curr[253]=147 ; make gray for missing data in color 254 r_curr[254]=200 g_curr[254]=200 b_curr[254]=200 red=250 yellow=200 green=150 white=255 gray=254 pink=253 black=0 ; Set the background to white !p.background=!d.n_colors-1 dummy=label_date(date_format=['%H:%I!C%N/%D']) ;************************************* ; Set up the plot ;************************************* ; Position the plots xr=0.071 & xl=0.98 yb=0.06 & yt=0.99 sx=0.08 sy=0.04 numplots_x=1 numplots_y=6 position_plots,xr,xl,yb,yt,sx,sy,$ numplots_x,numplots_y,pos ; Colorbar position ;cbpos=pos ;cbpos[*,0]=pos[*,2]+0.084 ;cbpos[*,2]=pos[*,2]+0.092 ;cbsz=0.9 erase dmax=max(alt[where(alt ne -9999)]) dmin=min(alt[where(alt ne -9999)]) plot,julian_day,alt,color=0,position=pos[0,*],ytitle='altitude (m)',$ xtickformat='label_date',yrange=[dmin-100.0,dmax+100.0],/ystyle,/xstyle dmax=max(temp[where(temp ne -9999)]) dmin=min(temp[where(temp ne -9999)]) plot,julian_day,temp,color=0,position=pos[1,*],/noerase,ytitle='temp (K)',$ xtickformat='label_date',yrange=[dmin-5.,dmax+5.],/ystyle,/xstyle dmax=max(rh) dmin=min(rh) if dmax ne dmin then begin dmax=max(rh[where(rh ne -9999)]) dmin=min(rh[where(rh ne -9999)]) plot,julian_day,rh,color=0,position=pos[2,*],/noerase,ytitle='rh (%)',$ xtickformat='label_date',yrange=[dmin-5.,dmax+5.],/ystyle,/xstyle oplot,julian_day,rh2,color=250 endif dmax=max(pres[where(pres ne -9999)]) dmin=min(pres[where(pres ne -9999)]) plot,julian_day,pres,color=0,position=pos[3,*],/noerase,ytitle='pres (mb)',$ xtickformat='label_date',yrange=[dmin-5.,dmax+5.],/ystyle,/xstyle ;dmax=max(lat[where(lat ne -9999)]) ;dmin=min(lat[where(lat ne -9999)]) ;plot,julian_day,lat,color=0,position=pos[4,*],/noerase,ytitle='latitude',$ ; xtickformat='label_date',yrange=[dmin-5.,dmax+5.],/ystyle,/xstyle alldata=[twc_nev,lwc_nev,iwc_nev] dmax=max(alldata[where(alldata ne -9999)]) dmin=min(alldata[where(alldata ne -9999)]) plot,julian_day,twc_nev,color=0,position=pos[4,*],/noerase,ytitle='twc_nev',$ xtickformat='label_date',yrange=[dmin,dmax],/ystyle,/xstyle oplot,julian_day,lwc_nev,color=250 oplot,julian_day,iwc_nev,color=70 dmax=max(cwc_csi[where(cwc_csi ne -9999)]) dmin=min(cwc_csi[where(cwc_csi ne -9999)]) plot,julian_day,cwc_csi,color=0,position=pos[5,*],/noerase,ytitle='cwc_csi',$ xtickformat='label_date',yrange=[dmin,dmax],/ystyle,/xstyle oplot,julian_day,cwc_csi2,color=250 write_gif,'nav.olympex.'+date+'.gif',tvrd() ; Position the plots xr=0.071 & xl=0.98 yb=0.06 & yt=0.99 sx=0.08 sy=0.04 numplots_x=1 numplots_y=3;6 erase sidx=1200 eidx=1300 sub_twc_nev=twc_nev[sidx:eidx] sub_lwc_nev=lwc_nev[sidx:eidx] sub_iwc_nev=iwc_nev[sidx:eidx] sub_julian_day=julian_day[sidx:eidx] position_plots,xr,xl,yb,yt,sx,sy,numplots_x,numplots_y,pos dmax=max(sub_twc_nev[where(sub_twc_nev ne -9999)]) dmin=min(sub_twc_nev[where(sub_twc_nev ne -9999)]) plot,sub_julian_day,sub_twc_nev,color=0,position=pos[0,*],/noerase,ytitle='twc_nev black, iwc_nev blue',$ xtickformat='label_date',yrange=[dmin,dmax],/ystyle,/xstyle oplot,sub_julian_day,sub_lwc_nev,color=250 oplot,sub_julian_day,sub_iwc_nev,color=70 plot,sub_julian_day,sub_twc_nev-sub_lwc_nev,color=0,position=pos[1,*],/noerase,ytitle='twc_nev-lwc_nev black, iwc_nev blue',$ xtickformat='label_date',yrange=[dmin,dmax],/ystyle,/xstyle oplot,sub_julian_day,sub_iwc_nev,color=70,linestyle=2 alldata=[sub_twc_nev,sub_lwc_nev,sub_iwc_nev] dmax=max(alldata[where(alldata ne -9999)]) dmin=min(alldata[where(alldata ne -9999)]) plot,sub_julian_day,sub_twc_nev,color=0,position=pos[2,*],/noerase,ytitle='twc_nev black, iwc_nev blue, lwc_nev red',$ xtickformat='label_date',yrange=[dmin,dmax],/ystyle,/xstyle oplot,sub_julian_day,sub_lwc_nev,color=250 oplot,sub_julian_day,sub_iwc_nev,color=70 write_gif,'nav.olympex.'+date+'.nev.gif',tvrd() endif end