FUNCTION Extract_PlanetIQdry, 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='PlanetIQdry' ;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 NCDF_VARGET, ncfileid, 'Impact_height',Impact_height 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 ; it's double, others are float NCDF_VARGET, ncfileid, 'Bend_ang_stdv', Bend_ang_stdv ; it's double, others are float 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 ncdf_close, ncfileid fileStamp_array=strsplit(string(fileStamp),'.',/extract) gps=strlowcase(fileStamp_array[-1]) leo=fileStamp_array[0] leo_full = leo ;print, leo_full ;print, mission ;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_PlanetIQdry.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_angle_structure={data: float(lat_profile), $ name: 'Latitude, degree', $ vertical: 'Height_ba'} lon_angle_structure={data: float(lon_profile), $ name: 'Longitude, degree', $ vertical: 'Height_ba'} bending_angle_structure={data: float(bend_ang), $ name: 'Bending Angle, rad', $ vertical: 'Height_ba'} bending_angle_stdv_structure={data: float(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) ; --- data_this_profile = {title: title, $ is_bad: is_bad, $ 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), $ azim: float(azim), $ balmax: float(balmax), $ zbalmax: float(zbalmax), $ ; --- 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_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_PlanetIQdry.pro " xinjia.zhou@noaa.gov') spawn, cmd endif RETURN, return_code END