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

Home » Public Forums » archive » comparing and concatenating arrays...please help!!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
comparing and concatenating arrays...please help!! [message #37605] Thu, 08 January 2004 02:27 Go to previous message
m.doyle is currently offline  m.doyle
Messages: 6
Registered: January 2004
Junior Member
Hello all,

I really hope someone out there can help me with this....I am tearing
my hair out as my code is so slow!

I have 2 files of data (hourly met data) with one file containing one
set of parameters, and the other file containing another set of
parameters. What I am trying to do, is to match the data based on the
YY, MM, DD and HH values and then write BOTH sets of parameters to a
seperate file. For example;

file1:
1954 12 31 23 90 11 4 366 0.00

file2:
1954 12 31 23 2.80 2.10 2.20 95.21

intended result:
1954 12 31 23 90 11 4 366 0.00 2.80 2.10 2.20
95.21

NOTE: Both files have no order to them, so a simple concatenation
won't work

I have written some code, but it is wrist slashing-ly slow!;

I read in each variable as a seperate array...

b=0L
REPEAT BEGIN
c=0L
REPEAT BEGIN
If (year(b) EQ year2(c)) AND (month(b) EQ month2(c)) AND (day(b) EQ
day2(c)) AND (hour(b) EQ hour2(c)) THEN BEGIN

printf, 3, year(b), month(b), day(b), hour(b), winddir(b), windsp(b),$
present(b),visib(b), mslpres(b), airt(c), dewt(c), wett(c), relh(c),$
format = finalformat
endif

c=c+1

ENDREP UNTIL c EQ lines2-1

b=b+1

ENDREP UNTIL b EQ lines1-1

I'm sure there must be a better way than this.

Please help me!

Many thanks in advance, Martin..
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: working with colours
Next Topic: Re: cron jobs, calling IDL, X windows

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

Current Time: Wed Oct 15 01:33:30 PDT 2025

Total time taken to generate the page: 0.19177 seconds