Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Hourly data using Split


rick Sep 12, 2009 12:52 AM

I have a data file of 1 minute data and I am trying to use Split to output a value for the top of the hour, that is output a temperature for each hour. From the Loggernet manual I use "4[60]" in the "Copy" line of Split but do not get any results. What is the best method to go about this.

Sample of data:
01,2008,153,0,-0.00690,-3.75441,0.00090,0.00016,0.00651,27.03,2.705,106.4,3.724,24.74,26.85,.......

Thanks in advance,
Rick.


Dana Sep 15, 2009 05:56 PM

Hi Rick,

It is a bit tricky in Split -- there are a couple of things that you need to do to keep the file sync'd up with time.

First, you will want to specify a Start condition, if your file does not already start on a "top of the hour" interval (for instance, if it starts at 12:13 rather than 12:00)

Start condition: ::4[1]:

The colons keep everything sync'd up timewise and indicate that the 4[1] is the hour/minute (first colon = year placeholder, second colon = julian day placeholder, then you have 4[1], and last colon = seconds placeholder).

4[1] = Start processing when element #4 (hour/minute) is equal to 1.


For the copy condition, you will want to specify the array ID that will be read from, and also indicate the interval of the file.

Copy Condition: 1[01] and 4[1]

The 1[01] indicates to Split it should read the data from array "01".

The 4[1] indicates that the original file is on a 1 minute interval. (the "and" connects the two conditions).


Finally, the Select line should have all the elements that you want to include in the report, with the sample being taken every "X" lines (in your case, every 60 lines). You'll need to do this for every element that you output in the report:

Select line: Smpl(1..15;60)

1..15 = include elements 1 through 15 in the report

60 = take the sample every 60 records

you could also use:

Smpl(1;60),Smpl(2;60),Smpl(3;60), etc.

or, if you wanted to omit some elements from the report:

Smpl(2;60),Smpl(3;60),Smpl(5;60),Smpl(9;60) etc.


Note that Split is very literal when it comes to the "60". It is going to count 60 LINES, not every 60 minutes. The colons in the Start condition and the Interval specified in the copy condition ensure that if you have missing records, that you don't get off your original interval (for instance, end up with output at 100, 200, 300,400, 501, 601, 701... if there is a missing record between 4 AM & 5 AM).

I know this is all very cryptic. Split can be difficult to get your head around, and I always have to test it to make sure I have the syntax correct (and I usually don't, so it takes me three or four tries!). I believe the Split manual still has some text that reads, "Split lends itself to experimentation." And while I cringe every time I read that, it is true :) It is a very powerful tool, but it does take some monkeying around sometimes to get the output you are expecting. A good way to test a file is to make one change at a time (set up the Start condition and just output all values, if it works as you expect, proceed to the copy and see how the changes you made affect the file, and so on...).

I hope this helps & good luck,

Dana


rick Sep 15, 2009 10:02 PM

Thanks Dana, it worked! I did it in steps as you suggested and I found it worked with or without the Copy Condition.
One more task from my list completed!
Thank you again for the help,
Rick.


Dana Sep 15, 2009 10:33 PM

Hi Rick,

Glad it is working. Just be aware that the output will get "off track" if you are missing a record and the "and 4[1]" is not in the copy condition. For instance, I had missing records in the data file I am using (several days worth of missing records). If I run without the 4[1] in the copy condition, the timestamp for my output is:


101,2009,245,700
101,2009,245,800
101,2009,245,900
101,2009,245,1000
101,2009,245,1100
101,2009,245,1200
101,2009,253,1104
101,2009,253,1204
101,2009,253,1304

If I put that copy condition in, my output is:

101,2009,245,700
101,2009,245,800
101,2009,245,900
101,2009,245,1000
101,2009,245,1100
101,2009,245,1200
101,2009,253,1300
101,2009,253,1400
101,2009,253,1500

The copy condition, in conjunction with the colons in the start condition, are what keeps it sync'd.

Regards,

Dana W.

Log in or register to post/reply in the forum.