; Function: ; Read the GSICS correction coefficients from NETCDF file and write in ASCII format. ; ; example: netcdf2ascii, W_US-NESDIS-STAR,SATCAL+RAC,GOES11+Sounder-MetopA+IASI_C_KNES_20091227000000_demo_02.nc, fout=fout ; ; Programmer: Fangfang.Yu@noaa.gov pro netcdf2ascii, fname, fout=fout print, ' ' print, 'netcdf2ascii, fname, fout=fout' print, ' ' if n_params() ne 1 then return id = NCDF_OPEN(fname) ncdf_attget, id, /global, 'monitored_instrument', mon_name ncdf_attget, id, /global, 'reference_instrument', ref_name NCDF_VARGET, id, 'offset', offset NCDF_VARGET, id, 'slope', slope ncdf_varget, id, 'time', time ncdf_varget, id, 'channel_name', chan_name NCDF_CLOSE, id chan_name = string(chan_name) n_chan = n_elements(chan_name) ; >> convert time in second after 1/1/1970 to yyyymmdd format <<< julian_1970 = julday(1, 1, 1970, 0,0,0) julian_day = julian_1970 + time/(24. * 60. * 60.) caldat, julian_day, month, mday, year date = year * 10000 + month * 100 + mday ; >>> output file name <<< if n_elements(fout) eq 0 then begin mon_instr_name = strcompress(string(mon_name), /remove_all) ref_instr_name = strcompress(string(ref_name), /remove_all) fout = mon_instr_name+'.vs.'+ref_instr_name+'.txt' endif print, 'Input: ', fname print, 'Output : ', fout openw, wlun, fout, /get_lun printf, wlun, '#Record# time(yyyymmdd) Slope' + string(chan_name, format='(4a12)') printf, wlun, '#Record# time(yyyymmdd) Offset' + string(chan_name, format='(4a12)') for irec =0, n_elements(time)-1 do begin print, irec+1, date[irec], offset[*, irec] printf, wlun, irec+1, date[irec], slope[*, irec], format='(i4, i12, 4f9.4)' printf, wlun, irec+1, date[irec], offset[*, irec], format='(i4, i12, 4f9.4)' endfor free_lun, wlun, /force end