Re: reading ascii in array merging with strsplit [message #52520 is a reply to message #52519] |
Tue, 06 February 2007 06:46  |
Brian Larsen
Messages: 270 Registered: June 2006
|
Senior Member |
|
|
I just did this yesterday. Depending on what idl libraries you have
installed this becomes trivial. Using the solarsoft library (http://
www.lmsal.com/solarsoft/ssw_install.html) there is a function that
makes this really easy. Unless you do solar physics, you should only
need the binaries check box (any maybe not ever that) making it
relatively small to download and install.
print, anytim2jd('6-2-1998 17:00')
{ 2455765 0.20833333}
I have gotten so used to solarsoft that I can no longer remember what
is solarsoft and what is standard idl as there are a heck of a lot of
routines for all sorts of things sin solarsoft.
Brian
------------------------------------------------------------ ---------------
Brian A. Larsen
Dept. of Physics
Space Science and Engineering Lab (SSEL)
Montana State University - Bozeman
Bozeman, MT 59717
On Feb 6, 6:46 am, "leatherback" <jelle.ferwe...@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)
>
> and create the julian day:
>
> Jul_Day = julday(daysarr[1],daysarr[0],daysarr[0],timearr[0],
> timearr[1], 0)
>
> This seems very elaborate if you repeat this hundreds of thousands of
> times. Is there a better solution to this? Can I somehow specify a
> template with multiple field separators?
>
> Thanks,
>
> Jelle.
|
|
|