pro read_nchead, infile, hd, platform, instrument, experiment ;==================================================== ; Check arguments ;==================================================== if n_elements(infile) eq 0 then begin print, 'Provide input file name' progexit endif dummy = findfile(infile, count=count) if (count eq 0) then begin print,'Input file: '+infile+' cannot be found' progexit endif ;make return header array hd = fltarr(6) ;open the netcdf file ncid = ncdf_open(infile) ;get the number of data records vid = ncdf_dimid( ncid, 'record') ncdf_diminq, ncid, vid, dn, ds hd[0] = ds ;get the number of pretrig and data levels ;if this dimension is not set, make value -1 vid = ncdf_dimid( ncid, 'ptlevel') if( vid ge 0 ) then begin ncdf_diminq, ncid, vid, dn, ds hd[1] = ds endif else begin hd[1] = -1 endelse ;get the number of levels vid = ncdf_dimid( ncid, 'level') if( vid ge 0 ) then begin ncdf_diminq, ncid, vid, dn, ds hd[2] = ds endif else begin hd[2] = -1 endelse ;get the raw range to first gate, that is ;from the pretrig bin number ;if this variable is not defined, make value -1 vid = ncdf_varid( ncid, 'RawRangeToFirstGate') if( vid ge 0 ) then begin ncdf_varget, ncid, vid, val hd[3] = val endif else begin hd[3] = -1 endelse ;get the range to first gate vid = ncdf_varid( ncid, 'RangeToFirstGate') if( vid ge 0 ) then begin ncdf_varget, ncid, vid, val hd[4] = val endif else begin hd[4] = -1 endelse ;get the delta gate spacing vid = ncdf_varid( ncid, 'DeltaGate') if( vid ge 0 ) then begin ncdf_varget, ncid, vid, val hd[5] = val endif else begin hd[5] = -1 endelse ;get the site name ncdf_attget,ncid,/global,'site_name',val platform = string( val ) ;get the instrument name ncdf_attget,ncid,/global,'instrument_name',val instrument = string( val ) ;get the experiment name ncdf_attget,ncid,/global,'experiment_name',val experiment = string( val ) ;close the netcdf file ncdf_close, ncid ;======================================== return end