pro get_5min_avg, cdf_file, file_flag common five_min_data_input2, hrfrac,jday,height,reflectivity,reflectp,reflectc,cbase,ctop, $ velocity, spectrum, temp, pressure, n_layers,bzl1,tzl1,btl1,ttl1,bzl2,tzl2,btl2,ttl2, $ bzl3,tzl3,btl3,ttl3,bzl4,tzl4,btl4,ttl4,fluxclear,solarratio,lwp,vceil,vap ;cdf_file='/uufs/chpc.utah.edu/common/home/mace_grp/data/arm/sgp/sgp.average.5min/2001/sgp.average.5min.20010103.000000.cdf' ;cdf_file='/uufs/chpc.utah.edu/common/home/mace_grp/data/arm/sgp/sgp.average.5min/2003/sgp.average.5min.20030128.000000.cdf' common mxrat_common_block, mxrat cdf_id=ncdf_open(cdf_file) ; ; Get the dimension id's ; time_did=ncdf_dimid(cdf_id, 'time') height_did=ncdf_dimid(cdf_id, 'height') ; ; Get the dimensions ; ncdf_diminq, cdf_id, time_did, char_string, num_times ncdf_diminq, cdf_id, height_did, char_string, num_heights ; ; Get the variable id's ; baset_id=ncdf_varid(cdf_id, 'base_time') timeo_id=ncdf_varid(cdf_id, 'time_offset') height_id=ncdf_varid(cdf_id, 'height') mxrat_id = ncdf_varid(cdf_id, 'mxrat') if baset_id ne -1 then ncdf_varget, cdf_id, baset_id, base_time if timeo_id ne -1 then ncdf_varget, cdf_id, timeo_id, time_offset if height_id ne -1 then ncdf_varget, cdf_id, height_id, height if mxrat_id ne -1 then ncdf_varget, cdf_id, mxrat_id, mxrat reflect_id=ncdf_varid(cdf_id, 'ReflectivityBestEstimate') if reflect_id ge 0 then begin file_flag=1 reflectp_id=ncdf_varid(cdf_id, 'ReflectivityPossiblePoints') reflectc_id=ncdf_varid(cdf_id, 'ReflectivityCloudyPoints') if reflectc_id eq -1 then reflectc_id=ncdf_varid(cdf_id, 'ReflectivityUseablePoints') ;ReflectivityCloudyPoints ;if reflectc_id eq -1 then reflectc_id=ncdf_varid(cdf_id, 'ReflectanceAverage') if reflect_id ne -1 then ncdf_varget, cdf_id, reflect_id, reflectivity if reflectp_id ne -1 then ncdf_varget, cdf_id, reflectp_id, reflectp if reflectc_id ne -1 then ncdf_varget, cdf_id, reflectc_id, reflectc clutter_id=ncdf_varid(cdf_id, 'qc_ReflectivityClutterFlagMode') cbase_id=ncdf_varid(cdf_id, 'CloudBaseBestEstimate') ctop_id=ncdf_varid(cdf_id, 'RadarFirstTop') velocit_id=ncdf_varid(cdf_id, 'MeanDopplerVelocity') spectr_id=ncdf_varid(cdf_id, 'SpectralWidth') if cbase_id ne -1 then ncdf_varget, cdf_id, cbase_id, cbase if ctop_id ne -1 then ncdf_varget, cdf_id, ctop_id, ctop if velocit_id ne -1 then ncdf_varget, cdf_id, velocit_id, velocity if spectr_id ne -1 then ncdf_varget, cdf_id, spectr_id, spectrum if clutter_id ne -1 then ncdf_varget, cdf_id, clutter_id,clutter temp_id=ncdf_varid(cdf_id, 'temp') press_id=ncdf_varid(cdf_id, 'pressure') nlayers_id=ncdf_varid(cdf_id, 'number_of_layers') if temp_id ne -1 then ncdf_varget, cdf_id, temp_id, temp if press_id ne -1 then ncdf_varget, cdf_id, press_id, pressure if nlayers_id ne -1 then ncdf_varget, cdf_id, nlayers_id, n_layers bzl1_id=ncdf_varid(cdf_id, 'base_height_layer_1') if bzl1_id eq -1 then bzl1_id=ncdf_varid(cdf_id, 'base_height_layer1') if bzl1_id eq -1 then bzl1_id=ncdf_varid(cdf_id, 'first_cbh'); We should only use first_cbh as a last resort. tzl1_id=ncdf_varid(cdf_id, 'top_height_layer_1') if tzl1_id eq -1 then tzl1_id=ncdf_varid(cdf_id, 'top_height_layer1') btl1_id=ncdf_varid(cdf_id, 'base_temp_layer_1') if btl1_id eq -1 then btl1_id=ncdf_varid(cdf_id, 'base_temp_layer1') ttl1_id=ncdf_varid(cdf_id, 'top_temp_layer_1') if ttl1_id eq -1 then ttl1_id=ncdf_varid(cdf_id, 'top_temp_layer1') if bzl1_id ne -1 then ncdf_varget, cdf_id, bzl1_id, bzl1 if tzl1_id ne -1 then ncdf_varget, cdf_id, tzl1_id, tzl1 if btl1_id ne -1 then ncdf_varget, cdf_id, btl1_id, btl1 if ttl1_id ne -1 then ncdf_varget, cdf_id, ttl1_id, ttl1 bzl2_id=ncdf_varid(cdf_id, 'base_height_layer_2') if bzl2_id eq -1 then bzl2_id=ncdf_varid(cdf_id, 'base_height_layer2') tzl2_id=ncdf_varid(cdf_id, 'top_height_layer_2') if tzl2_id eq -1 then tzl2_id=ncdf_varid(cdf_id, 'top_height_layer2') btl2_id=ncdf_varid(cdf_id, 'base_temp_layer_2') if btl2_id eq -1 then btl2_id=ncdf_varid(cdf_id, 'base_temp_layer2') ttl2_id=ncdf_varid(cdf_id, 'top_temp_layer_2') if ttl2_id eq -1 then ttl2_id=ncdf_varid(cdf_id, 'top_temp_layer2') if bzl2_id ne -1 then ncdf_varget, cdf_id, bzl2_id, bzl2 if tzl2_id ne -1 then ncdf_varget, cdf_id, tzl2_id, tzl2 if btl2_id ne -1 then ncdf_varget, cdf_id, btl2_id, btl2 if ttl2_id ne -1 then ncdf_varget, cdf_id, ttl2_id, ttl2 bzl3_id=ncdf_varid(cdf_id, 'base_height_layer_3') if bzl3_id eq -1 then bzl3_id=ncdf_varid(cdf_id, 'base_height_layer3') tzl3_id=ncdf_varid(cdf_id, 'top_height_layer_3') if tzl3_id eq -1 then tzl3_id=ncdf_varid(cdf_id, 'top_height_layer3') btl3_id=ncdf_varid(cdf_id, 'base_temp_layer_3') if btl3_id eq -1 then btl3_id=ncdf_varid(cdf_id, 'base_temp_layer3') ttl3_id=ncdf_varid(cdf_id, 'top_temp_layer_3') if ttl3_id eq -1 then ttl3_id=ncdf_varid(cdf_id, 'top_temp_layer3') if bzl3_id ne -1 then ncdf_varget, cdf_id, bzl3_id, bzl3 if tzl3_id ne -1 then ncdf_varget, cdf_id, tzl3_id, tzl3 if btl3_id ne -1 then ncdf_varget, cdf_id, btl3_id, btl3 if ttl3_id ne -1 then ncdf_varget, cdf_id, ttl3_id, ttl3 bzl4_id=ncdf_varid(cdf_id, 'base_height_layer_4') if bzl4_id eq -1 then bzl4_id=ncdf_varid(cdf_id, 'base_height_layer4') tzl4_id=ncdf_varid(cdf_id, 'top_height_layer_4') if tzl4_id eq -1 then tzl4_id=ncdf_varid(cdf_id, 'top_height_layer4') btl4_id=ncdf_varid(cdf_id, 'base_temp_layer_4') if btl4_id eq -1 then btl4_id=ncdf_varid(cdf_id, 'base_temp_layer4') ttl4_id=ncdf_varid(cdf_id, 'top_temp_layer_4') if ttl4_id eq -1 then ttl4_id=ncdf_varid(cdf_id, 'top_temp_layer4') if bzl4_id ne -1 then ncdf_varget, cdf_id, bzl4_id, bzl4 if tzl4_id ne -1 then ncdf_varget, cdf_id, tzl4_id, tzl4 if btl4_id ne -1 then ncdf_varget, cdf_id, btl4_id, btl4 if ttl4_id ne -1 then ncdf_varget, cdf_id, ttl4_id, ttl4 down_short_id=ncdf_varid(cdf_id,'down_short') down_long_id=ncdf_varid(cdf_id,'down_long') up_short_id=ncdf_varid(cdf_id,'up_short') up_long_id=ncdf_varid(cdf_id,'up_long') liq_id=ncdf_varid(cdf_id,'liq') fluxcl_id=ncdf_varid(cdf_id, 'twsflux_clearskyfit') if fluxcl_id lt 0 then fluxcl_id=ncdf_varid(cdf_id, 'gswfluxdn_clearskyfit') solarra_id=ncdf_varid(cdf_id, 'SolarRatio') lwp_id=ncdf_varid(cdf_id, 'liq') if lwp_id eq -1 then lwp_id=ncdf_varid(cdf_id, 'liq2') ;vceil_id=ncdf_varid(cdf_id,'first_cbh') ;stop vceil_id=-1 if vceil_id eq -1 then vceil_id=ncdf_varid(cdf_id,'cloud1') if vceil_id eq -1 then vceil_id=ncdf_varid(cdf_id,'CloudBaseBestEstimateMode') if vceil_id eq -1 then vceil = bzl1 vap_id=ncdf_varid(cdf_id, 'vap') if vap_id eq -1 then vap_id=ncdf_varid(cdf_id, 'vap2') if down_long_id ne -1 then ncdf_varget, cdf_id, down_long_id,down_long if down_short_id ne -1 then ncdf_varget, cdf_id, down_short_id,down_short if up_long_id ne -1 then ncdf_varget, cdf_id, up_long_id, up_long if up_short_id ne -1 then ncdf_varget, cdf_id, up_short_id, up_short if fluxcl_id ne -1 then ncdf_varget, cdf_id, fluxcl_id, fluxclear if solarra_id ne -1 then ncdf_varget, cdf_id, solarra_id, solarratio if lwp_id ne -1 then ncdf_varget, cdf_id, lwp_id, lwp if vceil_id ne -1 then ncdf_varget, cdf_id, vceil_id, vceil if vap_id ne -1 then ncdf_varget, cdf_id, vap_id, vap ;common five_min_data_input, hrfrac,jday,height,reflectivity,reflectp,reflectc,cbase,ctop, $ ; velocity, spectrum, temp, pressure, n_layers,bzl1,tzl1,btl1,ttl1,bzl2,tzl2,btl2,ttl2, $ ; bzl3,tzl3,btl3,ttl3,bzl4,tzl4,btl4,ttl4,fluxclear,solarratio,lwp,vceil ; ; Close the netcdf file ; ncdf_close,cdf_id ; ; Calculate Julian Date (jday) and Fractional Hour (hrfrac) ; ijday_ihrfrac_fm_numsec,base_time,time_offset,hrfrac,jday,yy,mm,dd,hh,mi,ss ; ; Change height to km ; ;height=height/1000.0 ; ; Get and filter clutter ; if clutter_id ne -1 then begin result=where(clutter eq 0,count) if count gt 0 then reflectivity[result]=-9999 endif if reflectp_id lt 0 or reflectc_id lt 0 or reflectc_id lt 0 or $ clutter_id lt 0 or cbase_id lt 0 or ctop_id lt 0 or temp_id lt $ 0 or press_id lt 0 or nlayers_id lt 0 or down_short_id lt 0 or $ down_long_id lt 0 or up_short_id lt 0 or up_long_id lt 0 or $ liq_id lt 0 or lwp_id lt 0 or vap_id lt 0 then begin ;or fluxcl_id lt 0 file_flag=-1 print, reflectp_id, ' is reflectp_id' print, reflectc_id, ' is reflectc_id' print, clutter_id, ' is clutter_id' print, cbase_id, ' is cbase_id' print, ctop_id, ' is ctop_id' print, temp_id, ' is temp_id' print, press_id, ' is press_id' print, nlayers_id, ' is nlayers_id' print, down_short_id, ' is down_short_id' print, down_long_id, ' is down_long_id' print, up_short_id, ' is up_short_id' print, up_long_id, ' is up_long_id' print, liq_id, ' is liq_id' ;print, fluxcl_id, ' is fluxcl_id' print, lwp_id, ' is lwp_id' print, vap_id, ' is vap_id' endif endif else begin file_flag=-1 ncdf_close, cdf_id print, reflect_id , ' is reflect_id' stop endelse return end