comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Read ASCII time format question!!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Read ASCII time format question!! [message #89439] Thu, 16 October 2014 10:48 Go to previous message
zolile mtumela is currently offline  zolile mtumela
Messages: 50
Registered: September 2011
Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: cgimage - two images on the same window ?
Next Topic: Converting days since 0-01-01 to Julian/Gregorian days - how can IDL recognise 0 AD?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:50:05 PDT 2025

Total time taken to generate the page: 0.00445 seconds