Class EventContainer
In: RainEvents.rb
Parent: Object

Synopsis

Parse rainfall events from hourly rain data files from the NCDC, and provide useful general and event-based statistics.

EventContainer, as the name implies, contains Event objects to form a rainfall record. EventContainer is responsible for knowing the inter-event time definition (IETD) for the series. The IETD is what determines how many hours without rain are considered to seperate 2 consecutive events.

Usage

If you are not using the supplied RainDataParser class, then you will need to write your own parsing routines to extract meaningful data from your input source.

Please note that this class is not meant to be a stand-alone solution, therefore, I will not describe in detail how to parse your records into events.

See the Rdoc documentation for more information.

Author

Travis Lee Branham, Undergraduate, Computer Science Dept., The University of the District of Columbia

Advisor: Pradeep K. Behera, Ph.D, P.E., Associate Professor, Civil Engineering Dept., The University of the District of Columbia

Copyright

Copyright (c) 2007 by Travis Lee Branham Licensed under the same terms as Ruby.

Change Log

Version 0.1.1 Date: August 14, 2007

Methods

append   avg   beta   each   empty?   ex_pdf   ex_vars   first   ga_pdf   lambda   last   new   psi   rho   sd   tau   total   total_events   zeta  

Included Modules

Enumerable

Attributes

ietd  [R]  ietd must be set using new.
inter_events  [R]  ietd must be set using new.

Public Class methods

Public Instance methods

append adds an event to the events array.

avg has 2 jobs:

     *1. Calculate the average for each of the 4 parameters:
         * Duration
         * Volume
         * Intensity
         * Inter-event time
     *2. Return the average for the desired parameter.

Calling avg with recalc = true will force a re-calculation of the averages for all of the 4 parameters.

Alias for ex_vars(:intensity)

each yields each event stored in the events array.

_empty?_ used to determine whether or not the events array contains any Event objects.

ex_pdf gives the exponential PDF of x for the desired parameter.

ex_vars has 2 jobs:

     *1. Calculate the variables used in the exponential PDF for each of the 4 parameters:
         * Duration (Lambda)
         * Volume (Zeta)
         * Intensity (Beta)
         * Inter-event time (Psi)
     *2. Return the proper exponential PDF variable for the desired parameter.

Calling ex_vars with recalc = true will force a re-calculation of the exponential PDF variables for all of the 4 parameters.

first returns the Event object at _events[0]_.

ga_pdf gives the Gamma PDF of x for the desired parameter.

Alias for ex_vars(:duration)

last returns the Event object at _events[events.length - 1]_

Alias for ex_vars(:inter_time)

rho has 2 jobs:

     *1. Calculate Rho (used in the Gamma PDF) for each of the 4 parameters:
         * Duration
         * Volume
         * Intensity
         * Inter-event time
     *2. Return Rho for the desired parameter.

Calling rho with recalc = true will force a re-calculation of Rho for all of the 4 parameters.

sd has 2 jobs:

     *1. Calculate the standard deviation for each of the 4 parameters:
         * Duration
         * Volume
         * Intensity
         * Inter-event time
     *2. Return the standard deviation for the desired parameter.

Calling sd with recalc = true will force a re-calculation of the standard deviations for all of the 4 parameters.

tau has 2 jobs:

     *1. Calculate Tau (used in the Gamma PDF) for each of the 4 parameters:
         * Duration
         * Volume
         * Intensity
         * Inter-event time
     *2. Return Tau for the desired parameter.

Calling tau with recalc = true will force a re-calculation of Tau for all of the 4 parameters.

total returns the total number of elements in the events array.

total_events()

Alias for total

Alias for ex_vars(:volume)

[Validate]