pro read_cdf, filepath, FromSecond, ToSecond, sample_rate, yyyy, mm, dd file_found = file_test(filepath) if file_found eq 0 then return, FILE_NOT_FOUND num_chan = 2 ;find the start of the day in tt2000 day_start = cdf_parse_tt2000(dd + '-' + 'Jan' + '-' + yyyy + ' 00:00:00.000') cdf_id = cdf_open(filepath) cdf_control, cdf_id, var = 'dbdt_x', get_var_info = rsurvey nrec_in = rsurvey.maxrec+1 datacount = nrec_in cdf_varget, cdf_id, 'Epoch', epoch, $ rec_start = 0L, rec_count = nrec_in epoch = reform(epoch) cdf_varget, cdf_id, 'dbdt_x', dbdt_x, $ rec_start = 0L, rec_count = nrec_in dbdt_x = reform(dbdt_x) cdf_varget, cdf_id, 'dbdt_y', dbdt_y, $ rec_start = 0L, rec_count = nrec_in dbdt_y = reform(dbdt_y) w_range = where(epoch ge day_start + FromSecond * 1000000000LL and $ epoch lt day_start + ToSecond * 1000000000LL, count) Data_Array = fltarr(num_chan, count) Data_Array[0, *] = dbdt_x(w_range) Data_Array[1, *] = dbdt_y(w_range) cdf_close, cdf_id end