; missing data=8.e-8 nocloud=9.e-9' pro append_5minfiles_write_abbrev, fname ; this routine writes the radiative properties at only 0.5 microns and 11 microns. common cldmicro_output, iwc_out, re_ice_out, icemicro_error, iwc_source, ice_size_source, ice_tau_solar, $ ice_omega_solar, ice_g_solar,ice_tau_ir, ice_omega_ir,ice_g_ir,ice_rad_param_source, lwc_out, re_liq_out, liqmicro_error, $ lwc_source, liq_size_source, liq_tau_solar, liq_omega_solar, liq_g_solar, liq_tau_ir, liq_omega_ir, $ liq_g_ir,liq_rad_param_source, ice_fraction, rap_solar_wl, rap_ir_wl ; Check arrays for nans and infinities varname=['iwc_out','re_ice_out',$ 'icemicro_error','iwc_source',$ 'ice_size_source','ice_tau_solar',$ 'ice_omega_solar','ice_g_solar','ice_tau_ir',$ 'ice_omega_ir','ice_g_ir',$ 'ice_rad_param_source',$ 'lwc_out','re_liq_out',$ 'liqmicro_error','lwc_source',$ 'liq_size_source','liq_tau_solar',$ 'liq_omega_solar','liq_g_solar','liq_tau_IR',$ 'liq_omega_ir','liq_g_ir',$ 'liq_rad_param_source',$ 'ice_fraction'] for i=0,n_elements(varname)-1 do begin xstr='retvar='+varname[i] xresult=execute(xstr) ; Fill in blank spaces with the missing flag result=where(finite(retvar) eq 0,count) if count gt 0 then begin print,'found some infinities in the rettrieval vars' stop retvar[result]=-8888 endif xstr=varname[i]+'=retvar' xresult=execute(xstr) endfor ;******************************************************* ; Convert missing and nocloud values ;******************************************************* ; Old way this was done ;if n_elements(where(iwc_out eq -9999.)) gt 1 then iwc_out[where(iwc_out eq -9999.)]=9.e-9 ;if n_elements(where(iwc_out eq -8888.)) gt 1 then iwc_out[where(iwc_out eq -8888.)]=8.e-8 ;if n_elements(where(iwc_out le 0.)) gt 1 then iwc_out[where(iwc_out le 0.)]=9.e-9 result=where(iwc_out eq -9999.,count) & if count gt 0 then iwc_out[result]=9.e-9 result=where(iwc_out eq -8888.,count) & if count gt 0 then iwc_out[result]=8.e-8 result=where(iwc_out le 0.,count) & if count gt 0 then iwc_out[result]=9.e-9 result=where(re_ice_out eq -9999.,count) & if count gt 0 then re_ice_out[result]=9.e-9 result=where(re_ice_out eq -8888.,count) & if count gt 0 then re_ice_out[result]=8.e-8 result=where(re_ice_out le 0.,count) & if count gt 0 then re_ice_out[result]=9.e-9 result=where(icemicro_error eq -9999.,count) & if count gt 0 then icemicro_error[result]=9.e-9 result=where(icemicro_error eq -8888.,count) & if count gt 0 then icemicro_error[result]=8.e-8 result=where(icemicro_error le 0.,count) & if count gt 0 then icemicro_error[result]=9.e-9 result=where(ice_tau_solar eq -9999.,count) & if count gt 0 then ice_tau_solar[result]=9.e-9 result=where(ice_tau_solar eq -8888.,count) & if count gt 0 then ice_tau_solar[result]=8.e-8 result=where(ice_tau_solar le 0.,count) & if count gt 0 then ice_tau_solar[result]=9.e-9 result=where(ice_omega_solar eq -9999.,count) & if count gt 0 then ice_omega_solar[result]=9.e-9 result=where(ice_omega_solar eq -8888.,count) & if count gt 0 then ice_omega_solar[result]=8.e-8 result=where(ice_omega_solar le 0.,count) & if count gt 0 then ice_omega_solar[result]=9.e-9 result=where(ice_g_solar eq -9999.,count) & if count gt 0 then ice_g_solar[result]=9.e-9 result=where(ice_g_solar eq -8888.,count) & if count gt 0 then ice_g_solar[result]=8.e-8 result=where(ice_g_solar le 0.,count) & if count gt 0 then ice_g_solar[result]=9.e-9 result=where(ice_tau_ir eq -9999.,count) & if count gt 0 then ice_tau_ir[result]=9.e-9 result=where(ice_tau_ir eq -8888.,count) & if count gt 0 then ice_tau_ir[result]=8.e-8 result=where(ice_tau_ir le 0.,count) & if count gt 0 then ice_tau_ir[result]=9.e-9 result=where(ice_omega_ir eq -9999.,count) & if count gt 0 then ice_omega_ir[result]=9.e-9 result=where(ice_omega_ir eq -8888.,count) & if count gt 0 then ice_omega_ir[result]=8.e-8 result=where(ice_omega_ir le 0.,count) & if count gt 0 then ice_omega_ir[result]=9.e-9 result=where(ice_g_ir eq -9999.,count) & if count gt 0 then ice_g_ir[result]=9.e-9 result=where(ice_g_ir eq -8888.,count) & if count gt 0 then ice_g_ir[result]=8.e-8 result=where(ice_g_ir le 0.,count) & if count gt 0 then ice_g_ir[result]=9.e-9 result=where(lwc_out eq -9999.,count) & if count gt 0 then lwc_out[result]=9.e-9 result=where(lwc_out eq -8888.,count) & if count gt 0 then lwc_out[result]=8.e-8 result=where(lwc_out le 0.,count) & if count gt 0 then lwc_out[result]=9.e-9 result=where(re_liq_out eq -9999.,count) & if count gt 0 then re_liq_out[result]=9.e-9 result=where(re_liq_out eq -8888.,count) & if count gt 0 then re_liq_out[result]=8.e-8 result=where(re_liq_out le 0.,count) & if count gt 0 then re_liq_out[result]=9.e-9 result=where(liqmicro_error eq -9999.,count) & if count gt 0 then liqmicro_error[result]=9.e-9 result=where(liqmicro_error eq -8888.,count) & if count gt 0 then liqmicro_error[result]=8.e-8 result=where(liqmicro_error le 0.,count) & if count gt 0 then liqmicro_error[result]=9.e-9 result=where(liq_tau_solar eq -9999.,count) & if count gt 0 then liq_tau_solar[result]=9.e-9 result=where(liq_tau_solar eq -8888.,count) & if count gt 0 then liq_tau_solar[result]=8.e-8 result=where(liq_tau_solar le 0.,count) & if count gt 0 then liq_tau_solar[result]=9.e-9 result=where(liq_omega_solar eq -9999.,count) & if count gt 0 then liq_omega_solar[result]=9.e-9 result=where(liq_omega_solar eq -8888.,count) & if count gt 0 then liq_omega_solar[result]=8.e-8 result=where(liq_omega_solar le 0.,count) & if count gt 0 then liq_omega_solar[result]=9.e-9 result=where(liq_g_solar eq -9999.,count) & if count gt 0 then liq_g_solar[result]=9.e-9 result=where(liq_g_solar eq -8888.,count) & if count gt 0 then liq_g_solar[result]=8.e-8 result=where(liq_g_solar le 0.,count) & if count gt 0 then liq_g_solar[result]=9.e-9 result=where(liq_tau_ir eq -9999.,count) & if count gt 0 then liq_tau_ir[result]=9.e-9 result=where(liq_tau_ir eq -8888.,count) & if count gt 0 then liq_tau_ir[result]=8.e-8 result=where(liq_tau_ir le 0.,count) & if count gt 0 then liq_tau_ir[result]=9.e-9 result=where(liq_omega_ir eq -9999.,count) & if count gt 0 then liq_omega_ir[result]=9.e-9 result=where(liq_omega_ir eq -8888.,count) & if count gt 0 then liq_omega_ir[result]=8.e-8 result=where(liq_omega_ir le 0.,count) & if count gt 0 then liq_omega_ir[result]=9.e-9 result=where(liq_g_ir eq -9999.,count) & if count gt 0 then liq_g_ir[result]=9.e-9 result=where(liq_g_ir eq -8888.,count) & if count gt 0 then liq_g_ir[result]=8.e-8 result=where(liq_g_ir le 0.,count) & if count gt 0 then liq_g_ir[result]=9.e-9 result=where(ice_fraction eq -9999.,count) & if count gt 0 then ice_fraction[result]=9.e-9 result=where(ice_fraction eq -8888.,count) & if count gt 0 then ice_fraction[result]=8.e-8 result=where(ice_fraction le 0.,count) & if count gt 0 then ice_fraction[result]=9.e-9 ;************************************** ; Open the file and get the dimensions ;************************************** cdfid=ncdf_open(fname,/write) time_index_id=ncdf_dimid(cdfid,'time') height_index_id=ncdf_dimid(cdfid,'height') ncdf_diminq,cdfid,height_index_id,char_strng,num_heights ncdf_diminq,cdfid,time_index_id,char_strng,num_times dim_indices1=[height_index_id,time_index_id] ; Check for a cloud retrieval variable iwc_id=ncdf_varid(cdfid,'IWC_best_estimate') ; If variable does not exist, then define them if iwc_id lt 0 then begin ncdf_control,cdfid,/verbose ncdf_control,cdfid,/redef dim_indices2=[height_index_id,time_index_id] dim_indices3=[height_index_id,time_index_id] ; IWC_best_estimate iwc_id=ncdf_vardef(cdfid,'IWC_best_estimate',dim_indices1,/short) ncdf_attput,cdfid,iwc_id,'long_name','Best_Estimate_IWC' ncdf_attput,cdfid,iwc_id,'units','iwc (g/m^3)->10.^(float((*)/1000.))' ncdf_attput,cdfid,iwc_id,'valid_range',$ '>1.e-6 g/m^3, missing data: 8.e-8, no cloud: 9.e-9' ncdf_attput,cdfid,iwc_id,'Comment1',$ 'See IWC_source variable for information on how this quantity was computed' ; re_ice_best_estimate re_ice_id=ncdf_vardef(cdfid,'re_ice_best_estimate',dim_indices1,/short) ncdf_attput,cdfid,re_ice_id,'long_name','Best_Estimate_ice_effective_radius' ncdf_attput,cdfid,re_ice_id,'units','effective_radius (m)->10.^(float((*)/1000.))' ncdf_attput,cdfid,re_ice_id,'valid_range','>1.e-6 m, missing data: 8.e-8, no cloud: 9.e-9' ncdf_attput,cdfid,re_ice_id,'Comment1',$ 'See re_ice_source variable for information on how this quantity was computed' ; ice_micro_error_estimate ice_error_id=ncdf_vardef(cdfid,'ice_micro_error_estimate',dim_indices1,/short) ncdf_attput,cdfid,ice_error_id,'long_name','estimated fractional error in the ice microphysical quantities' ncdf_attput,cdfid,ice_error_id,'units','ice_error (unitless fraction)->10.^(float((*)/1000.))' a_string='>0., missing data: 8.e-8, no cloud: 9.e-9' ncdf_attput,cdfid,ice_error_id,'valid_range',a_string ; iwc_source iwc_source_id=ncdf_vardef(cdfid,'iwc_source',dim_indices1,/short) ncdf_attput,cdfid,iwc_source_id,'long_name','Source index of the ice water content algorithm' ncdf_attput,cdfid,iwc_source_id,'units','none' a_string='1: mace et al 1998, 2: mace et al 2001, 3: ccm3 Parameterization (Kiehl et al 1998)' ncdf_attput,cdfid,iwc_source_id,'Comment1',a_string a_string='4: Liu and Illingworth, 2000, 5: Dong et al 1998 parameterization ncdf_attput,cdfid,iwc_source_id,'Comment2',a_string a_string='6: Dong and Mace 2001 retrieval, 7: frisch et al 1998 lwc retrieval ncdf_attput,cdfid,iwc_source_id,'Comment3',a_string ; ice_effective_radius_source ice_re_source_id=ncdf_vardef(cdfid,'ice_effective_radius_source',dim_indices1,/short) a_string='Source index of the effective radius algorithm' ncdf_attput,cdfid,ice_re_source_id,'long_name',a_string ncdf_attput,cdfid,ice_re_source_id,'units','none' a_string='1: mace et al 1998, 2: mace et al 2001, 3: ccm3 Parameterization (Kiehl et al 1998)' ncdf_attput, cdfid, ice_re_source_id, 'Comment1', a_string a_string='4: Liu and Illingworth, 2000, 5: Dong et al 1998 parameterization ncdf_attput, cdfid, ice_re_source_id, 'Comment2', a_string a_string='6: Dong and Mace 2001 retrieval, 7: frisch et al 1998 lwc retrieval ncdf_attput, cdfid, ice_re_source_id, 'Comment3', a_string ; ice_tau_solar ice_tau_solar_id=ncdf_vardef(cdfid,'ice_tau_solar',dim_indices1,/short) a_string='Spectral solar optical depth at 0.5 microns of the ice phase in this vertical bin' ncdf_attput, cdfid, ice_tau_solar_id, 'long_name', a_string a_string='optical depth (unitless)->10.^(float((*)/1000.))' ncdf_attput, cdfid, ice_tau_solar_id, 'units', a_string a_string='>0.0, missing data: 8.e-8, no cloud: 9.e-9' ncdf_attput, cdfid, ice_tau_solar_id, 'valid_range', a_string a_string='See ice_rad_param_source variable for information on how this quantity was computed' ncdf_attput, cdfid, ice_tau_solar_id, 'Comment1', a_string ; ice_omega_solar ice_omega_solar_id=ncdf_vardef(cdfid,'ice_omega_solar',dim_indices1,/short) ncdf_attput,cdfid,ice_omega_solar_id,'long_name',$ 'Spectral solar single scattering albedo at 0.5 microns of the ice phase in this vertical bin' ncdf_attput,cdfid,ice_omega_solar_id,'units','omega (unitless)->10.^(float((*)/1000.))' ncdf_attput,cdfid,ice_omega_solar_id,'valid_range','0.0