On Thursday, October 16, 2014 7:48:07 PM UTC+2, zolile...@gmail.com wrote:
> Hi all,
>
> I have a problem with the time format, I can plot but When I am print the time I got a float values. I would like to get time like 16:10 (hh:mm).
>
> I tried to use strsplit for time but I am not winning. My problem is to be able to do time right.
>
> Any suggestion will be appreciated! thanks in advance.
>
>
>
> File = Dialog_PickFile(Filter='*.txt')
>
>
>
> nrows =file_lines(file)
>
>
>
> Date_array = 0
>
> time_array = 0
>
> Bx_array = 0
>
> By_array = 0
>
> Bz_array = 0
>
>
>
> str = ''
>
>
>
> openR, Lun, File,/Get_Lun
>
> readf, Lun, str
>
> while~eof(lun) do begin
>
>
>
> readf,lun,str
>
> readf,lun,date,time,Bx,By,Bz;
>
> time_str =strsplit(str,'',/extract)
>
> time =strsplit(time_str(1),':',/extract)
>
> hour=FIX(time(0)) & minutes=FIX(time(1)) & seconds=FIX(time(2))
>
>
>
> print,hour
>
> stop
>
>
>
>
>
> ;,FORMAT='(A10,1X,A12,3(16X,d0))'
>
>
>
> ;thabo
>
> ;time_str=strsplit(time,':',/extract)
>
>
>
>
>
> ;plittime = STRSPLIT(time[1], ':', /EXTRACT)
>
>
>
> ;print, splitime
>
> ;stop
>
> ;str1=strsplit(str,'',/extract)
>
> ;time_str =strsplit(str1[1],':',/extract)
>
> ;time =float(time_str[0])+float(time_str[1])/60.+float(time_str[2] )/360.
>
> ;print,time
>
>
>
> ;print,date,time,Bx,By,Bz
>
> ;time_array =[time_array,time]
>
>
>
> Bx_array = [Bx_array, Bx]
>
> By_array = [By_array, By]
>
> Bz_array = [Bz_array, Bz]
>
> endwhile
>
> free_lun,lun
>
>
>
> ;time_array=time_array[1:*]
>
>
>
> Bx_array=Bx_array[1:*]
>
> By_array=By_array[1:*]
>
> Bz_array=Bz_array[1:*]
>
>
>
> ;print,time_array,Bx_array
>
> ;plot,time_array,Bx_array
>
> stop
>
>
>
>
>
> stop
>
> ;Nx = n_elements(Bx_array)
>
> ;time = findgen(Nx)
>
> ;time = time/(Nx/2)
>
>
>
> ;Ny = n_elements(By_array)
>
> ;time = findgen(Ny)
>
> ;time = time/(Ny/2)
>
>
>
> ;Nz = n_elements(Bz_array)
>
> ;time = findgen(Nz)
>
> ;time = time/(Nz/2)
>
>
>
> Smoothed1 = smooth(Bx_array,3)
>
> Smoothed2 = smooth(By_array,3)
>
> Smoothed3 = smooth(Bz_array,3)
>
>
>
> NN1=n_elements(smoothed1)
>
> NN2=n_elements(smoothed2)
>
> NN3=n_elements(smoothed3)
>
> print, smoothed1
>
> print, NN1,NN2,NN3
>
>
>
>
>
>
>
> Data example
>
> 23-03-2002 16:11:33.000 1.57100 -8.41400 -4.89800
>
> 23-03-2002 16:11:49.000 1.57200 -8.60200 -4.59500
>
> 23-03-2002 16:12:05.000 1.00100 -8.48400 -5.06300
>
> 23-03-2002 16:12:21.000 0.806000 -8.38700 -5.26600
>
>
>
> I would like to print it to file
>
> Time Bx By Bz
>
> 16.10 1.57 ... ...
>
> Thankx
Thank you so much, It works, thanks again!!
|