dealing with piecewise arrays

Discussion in 'Ruby' started by Yaj Bhattacharya, Mar 17, 2009.

  1. I want to perform the following in Ruby, could someone please help
    translate this pseudocode?

    1. Read in a time series in a columnar format from an external file
    (covered elsewhere in this forum, including for completeness)
    given data triplets: time, value, error

    2. Check for discontinuities in data:
    if [time(i+1) - time(i)] > some_value, then
    store this piece of triplet array and give
    it a address (say piece_1)
    continue reading until another discontinuity is
    encountered
    store the new piece of triplet array with
    new address (piece_2)
    until end of file

    3. Write out each piece as a separate file with meaningful filenames
    based on the time of the array above, so the file written for piece_1
    would be called "time(i)_time(i+n).dat" where the time array is a
    continuous array without gaps (no gaps greater than some_value deduced
    in step 2).

    Thanks in advance
    Yaj
     
    Yaj Bhattacharya, Mar 17, 2009
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman
    Replies:
    5
    Views:
    32,232
    Chris Smith
    Jun 17, 2004
  2. Bill Reyn
    Replies:
    3
    Views:
    2,784
    Bob Hairgrove
    Jun 22, 2004
  3. dilou

    piecewise function

    dilou, May 21, 2006, in forum: VHDL
    Replies:
    4
    Views:
    1,273
    Mark Norton
    May 30, 2006
  4. Will Ware
    Replies:
    0
    Views:
    510
    Will Ware
    Nov 21, 2005
  5. jitasi
    Replies:
    1
    Views:
    919
    Terry Reedy
    Mar 4, 2007
  6. Slain
    Replies:
    2
    Views:
    363
    Alf P. Steinbach
    Jul 12, 2007
  7. Philipp
    Replies:
    21
    Views:
    1,557
    Philipp
    Jan 20, 2009
  8. JonL

    Piecewise fetching using perl dbi

    JonL, Feb 11, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    414
Loading...