function freq_write_cdf, master_cdf,output_cdf, $ time_mark, freq_mark, freq_data, debug=debug ;modified by G. Burgess 11/6/2001 for 'freq' and 'freq_mark' ;1st make a copy of the master into the requested output cdf cmd = strarr(3) cmd(0) = "cp" cmd(1) = master_cdf cmd(2) = output_cdf spawn, cmd, /noshell ; ; now change the protection so that updates can be made to the new cdf ; HAL 8/1/2000 ; cmd(0) = "chmod" cmd(1) = "+w" cmd(2) = output_cdf spawn, cmd, /noshell ;set the quiet flag so that various non relevant CDF warning messages are ;not displayed. !quiet = 1 ;now work on the output_cdf cdf_id = cdf_open(output_cdf) ;need to determine the logical_file_id which is just the filename ;not including any directory/pathname and not including the .cdf extension. logical_file_id = output_cdf period = rstrpos(logical_file_id, '.') ;find position of last '.' if (period gt -1) then logical_file_id = strmid(output_cdf,0,period) slash = rstrpos(logical_file_id, '/') ;find position of last '/' if (slash gt -1) then logical_file_id = strmid(logical_file_id,slash+1) if (cdf_id gt 0) then begin if keyword_set(debug) then print, 'Successfully opened CDF ',output_cdf attid = cdf_attnum(cdf_id, 'Logical_file_id') ; need to change the logical_file_id global attribute here... if (attid ge 0) then cdf_attput, cdf_id, attid, 0L, logical_file_id if keyword_set(debug) then $ print, 'Changed logical_file_id attribute to ',logical_file_id cdf_var='Time_mark' x = time_mark * 1000.0 rcnt = n_elements(x) cdf_varput, cdf_id, cdf_var, x, /zvariable,rec_start=0 cdf_var='freq_mark' x = freq_mark rcnt = n_elements(x) cdf_varput, cdf_id, cdf_var, x, /zvariable,rec_start=0 cdf_var='freq' x = freq_data rcnt = n_elements(x) for i=0,rcnt-1 do begin cdf_varput, cdf_id, cdf_var, x[i], /zvariable,rec_start=i endfor endif cdf_close, cdf_id !quiet = 0; turn messages back on return, 1 end