FUNCTION Extract_UCARdry, input_file, $ data_this_profile, $ version=version return_code=0B ; 1 is good ; 0 is bad if keyword_set(version) then begin mission=version endif else begin path=strsplit(file_dirname(input_file),'/',/extract) mission=path[-4] endelse agency='UCARdry' ;print, input_file cmd='ncfileid = NCDF_OPEN(input_file)' res=execute(cmd) if res eq 0 then begin error_string=input_file+' cannot be openned' goto, jump_end endif NCDF_attget, ncfileid, 'year',year, /global if year lt 1000 then begin ncdf_close, ncfileid error_string='Global attribute "year" is invalid in: '+input_file+'\njump to the next file' goto, jump_end endif ncdf_attget, ncfileid, 'rfict', rfict, /global Impact_id1 = NCDF_VARID(ncfileid, 'Impact_height') ;Impact_id1 = NCDF_VARID(ncfileid, 'Impact_parm') if Impact_id1 ge 0 then begin NCDF_VARGET, ncfileid, Impact_id1,Impact_height endif else begin Impact_id2 = NCDF_VARID(ncfileid, 'Impact_parm') NCDF_VARGET, ncfileid, Impact_id2,Impact_parm Impact_height = Impact_parm - rfict endelse NCDF_VARGET, ncfileid, 'MSL_alt', MSL_alt NCDF_VARGET, ncfileid, 'Lat', lat_profile NCDF_VARGET, ncfileid, 'Lon', lon_profile NCDF_VARGET, ncfileid, 'Bend_ang', Bend_ang ; ba/ba1/ba2 are double, others are float NCDF_VARGET, ncfileid, 'Bend_ang1', Bend_ang1 NCDF_VARGET, ncfileid, 'Bend_ang2', Bend_ang2 NCDF_VARGET, ncfileid, 'Bend_ang_stdv', Bend_ang_stdv NCDF_VARGET, ncfileid, 'Ref', Ref NCDF_VARGET, ncfileid, 'Temp', Temp NCDF_VARGET, ncfileid, 'Pres', Pres NCDF_attget, ncfileid, 'lat',lat, /global NCDF_attget, ncfileid, 'lon',lon, /global NCDF_attget, ncfileid, 'zbot',zbot, /global NCDF_attget, ncfileid, 'month',month, /global NCDF_attget, ncfileid, 'day',day, /global NCDF_attget, ncfileid, 'hour',hour, /global NCDF_attget, ncfileid, 'minute',minute, /global NCDF_attget, ncfileid, 'second',second, /global & second=floor(second) bad_id=execute("NCDF_attget, ncfileid, 'bad',is_bad, /global") if bad_id eq 1 then is_bad=fix(string(is_bad)) else is_bad = 1 freq1_id=execute("NCDF_attget, ncfileid, 'freq1',freq1, /global") if freq1_id eq 1 then freq1=string(freq1) else freq1 = '' freq2_id=execute("NCDF_attget, ncfileid, 'freq2',freq2, /global") if freq2_id eq 1 then freq2=string(freq2) else freq2 = '' ncdf_attget, ncfileid, 'irs', irs, /global ncdf_attget, ncfileid, 'snr1avg', snr1avg, /global ncdf_attget, ncfileid, 'snr2avg', snr2avg, /global ncdf_attget, ncfileid, 'stdv', stdv, /global ncdf_attget, ncfileid, 'azim', azim, /global NCDF_attget, ncfileid, 'fileStamp',fileStamp, /global NCDF_attget, ncfileid, 'balmax' ,balmax, /global NCDF_attget, ncfileid, 'zbalmax' ,zbalmax, /global result = NCDF_ATTINQ(ncfileid, /GLOBAL, 'errstr') if result.datatype eq 'UNKNOWN' then errstr='UNKNOWN' else NCDF_attget, ncfileid, 'errstr',errstr, /global ncdf_close, ncfileid errstr = string(errstr) fileStamp_array=strsplit(string(fileStamp),'.',/extract) leo=fileStamp_array[0] gps=strlowcase(fileStamp_array[-1]) if leo eq 'C001' then leo_full = 'COSMIC-1' $ else if leo eq 'C002' then leo_full = 'COSMIC-2' $ else if leo eq 'C003' then leo_full = 'COSMIC-3' $ else if leo eq 'C004' then leo_full = 'COSMIC-4' $ else if leo eq 'C005' then leo_full = 'COSMIC-5' $ else if leo eq 'C006' then leo_full = 'COSMIC-6' $ else if leo eq 'KOM5' then leo_full = 'KOMPSAT5' $ else if leo eq 'MTPA' then leo_full = 'MetopA' $ else if leo eq 'MTPB' then leo_full = 'MetopB' $ else if leo eq 'MTPC' then leo_full = 'MetopC' $ else if leo eq 'TSRX' then leo_full = 'TerraSAR-X' $ else if leo eq 'TDMX' then leo_full = 'TanDem-X' $ else if leo eq 'GRC1' then leo_full = 'GRACE-A' $ else if leo eq 'GRC2' then leo_full = 'GRACE-B' $ else if leo eq 'CNFS' then leo_full = 'C-NOFS' $ else if leo eq 'GPSM' then leo_full = 'GPSMET' $ else if leo eq 'PAZ1' then leo_full = 'PAZ' $ else if mission eq 'spire' then leo_full = strmid(leo, 1) $ else leo_full = leo ;print, leo_full ;print, mission if mission eq 'gpsmetas' and leo_full eq 'GPSMET' then leo_full = 'GPSMETAS' ;cic085_2018-12-17T00:07:08_r21_GeoOptics_CICERO title= leo_full+'_'+$ string(year,format='(i4)') +'-'+$ string(month,format='(i2.2)') +'-'+$ string(day,format='(i2.2)') +'T'+$ string(hour,format='(i2.2)') +':'+$ string(minute,format='(i2.2)')+':'+$ string(second,format='(i2.2)')+'_'+$ gps+'_'+$ agency+'_'+mission ; print, title ; --- if !false then begin valid_id = where(ref gt -990 and $ temp gt -990 and $ bend_ang gt -990 and $ pres gt -990, valid_num) if valid_num eq 0 then begin ;cmd=string('echo -e "All data are bad in: '+input_file+'" | mail -s "Alert: something is wrong in Extract_UCARdry.pro " xinjia.zhou@noaa.gov') ;spawn,cmd print,cmd endif endif ; --- height_ba_structure={data: Impact_height, $ name: 'Impact Height, km'} height_structure={data: MSL_alt, $ name: 'Height, km'} lat_structure={data: lat_profile, $ name: 'Latitude, degree', $ vertical: 'Height'} lon_structure={data: lon_profile, $ name: 'Longitude, degree', $ vertical: 'Height'} ; --- bending_angle_structure={data: bend_ang, $ name: 'Bending Angle, rad', $ vertical: 'Height_ba'} bending_angle_L1_structure={data: bend_ang1, $ name: 'L1 Bending Angle, rad', $ vertical: 'Height_ba'} bending_angle_L2_structure={data: bend_ang2, $ name: 'L2 Bending Angle, rad', $ vertical: 'Height_ba'} bending_angle_stdv_structure={data: bend_ang_stdv, $ name: 'Bending Angle uncertainty, rad', $ vertical: 'Height_ba'} temperature_structure={data: temp+273.15, $ name: 'Dry Temperature, K', $ vertical: 'Height'} pressure_structure={data: pres, $ name: 'Pressure, hPa', $ vertical: 'Height'} refractivity_structure={data: ref, $ name: 'Refractivity, N-units', $ vertical: 'Height'} ;if is_bad eq 1 and irs lt 1 and strpos(errstr, 'Failed: abs(rising azimuth)') eq 0 and strlen(errstr) lt 80 then begin ; is_bad = 0 ; ;endif time = julday(month, day, year, hour, minute, second) ini_att = fltarr(3)+!values.f_nan ; --- data_this_profile = {title: title, $ is_bad: is_bad, $ errstr: errstr, $ irs: irs, $ ELRC: float(rfict),$ lat: float(lat), $ ; from global attributes lon: float(lon), $ time: time, $ leo: leo_full, $ gnss: gps, $ zbot: zbot, $ freq1: freq1, $ freq2: freq2, $ snr1avg: float(snr1avg), $ snr2avg: float(snr2avg), $ stdv: float(stdv), $ balmax: float(balmax), $ zbalmax: float(zbalmax), $ azim: float(azim), $ ; ------------ ; 8 parameters from UCAR atmPhs view: ini_att, $ distance: ini_att, $ hLeo: ini_att, $ latLeo: ini_att, $ lonLeo: ini_att, $ hGnss: ini_att, $ latGnss: ini_att, $ lonGnss: ini_att, $ ; --- Height_ba: ptr_new(height_ba_structure), $ Height: ptr_new(height_structure), $ lat_profile: ptr_new(lat_structure), $ lon_profile: ptr_new(lon_structure), $ ; --- Temperature: ptr_new(temperature_structure), $ Pressure: ptr_new(pressure_structure), $ Refractivity: ptr_new(refractivity_structure), $ BendingAngle: ptr_new(bending_angle_structure),$ BendingAngle_L1: ptr_new(bending_angle_L1_structure),$ BendingAngle_L2: ptr_new(bending_angle_L2_structure),$ BendingAngle_stdv: ptr_new(bending_angle_stdv_structure) $ } ;print,'read end at: ', systime() return_code = 1B ; good profile jump_end: if return_code ne 1B then begin cmd=string('echo -e "'+error_string+'" | mail -s "Alert: something is wrong in Extract_UCARdry.pro " xinjia.zhou@noaa.gov') spawn, cmd endif RETURN, return_code END