pro get_hk_value_vs2,data_file,time,hk_value,status

; Added status keyword to place information in the .gif image if
; somehow the data was not read correctly. -PRJ returns status
status=0

	; including some error handling -PRJ
	catch,Error_status
 	if (Error_status NE 0) then begin
	 message,'Error in get_hk_value_vs2',/continue
	 return
	endif


                                ;testing the .txt files to make sure
                                ;only to readcol files that are not
                                ;empty and that don't begin with the
                                ;dumb ==> character set.  -PRJ
        result=rd_ascii(data_file)
        res1=strcmp(result[0],'=',1)
        res2=strcmp(result[0],'',20)
        if (res1 eq 1) || (res2 eq 1) then begin
                                ; need to add a statement that handles
                                ; when the first of the times accessed
                                ; does not have data in it. -PRJ
            message,'Empty file: '+data_file,/continue
            status=1
            return
        endif

	readcol, data_file, time, hk_value,format=('A,F'),/silent,skip=1

        ; Need to check the out_time to make sure they are valid. -PRJ
        ; This may not be needed. Delete at own discresion. -PRJ
         tim_match=stregex(time,'[^(0,1,2,3,4,5,6,7,8,9,:,.,/,_)]',/boolean)
	 index=where(tim_match eq 0,count)
         if (count ne 0) then time=time[index]
end
	
