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

Home » Public Forums » archive » Re: reading ascii in array merging with strsplit
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: reading ascii in array merging with strsplit [message #52475] Thu, 08 February 2007 01:39 Go to previous message
Andrea Pitacco is currently offline  Andrea Pitacco
Messages: 3
Registered: March 2004
Junior Member
On 6 Feb 2007 05:46:39 -0800, "leatherback"
<jelle.ferwerda@rmit.edu.au> wrote:

> Hi All,
>
> I use a template to read_ascii data of the following format:
>
> D9 6-2-1998 17:00 37,59 0,59 36,5
>
> Which returns a structure of arrays.
>
> However, the date (6-2-1998) and time (17:00) I need to convert to
> julian time, which takes
>
> JULDAY(Month, Day, Year, Hour, Minute, Second)
>
> I -could- for each entry in the list do a strsplit:
>
> daysarr = STRTRIM(strsplit(data.date[ThisLine], '-', /extract), 2)
> timearr = STRTRIM(strsplit(data.time[ThisLine], ':', /extract), 2)

Dear Jelle,
if you are heading to Julian time and your date&time timestamp is a
single string tag of an array of structures, you may conveniently read
and transform the whole vector using just using the native ReadS
instruction and an appropriate FORMAT.

As the online help "synthetically" writes, ReadS can act on a vector.
What is essential, is to provide it with a properly dimensioned
double-precision destination array:

jtime = DblArr(N_Elements(data))
ReadS, data.timestamp, jtime, FORMAT =
'(C(CYI,X,CMOI,X,CDI,X,CHI,X,CMI,X,CSI))'

Regards, Andrea


Andrea Pitacco
Dept. of Environmental Agronomy, University of Padova, Italy
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL programmer wanted
Next Topic: Re: Strange IDL Help probelm 6.3

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

Current Time: Fri Oct 10 12:49:50 PDT 2025

Total time taken to generate the page: 0.72260 seconds