Class Event
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.

There are 4 main parameters when dealing with rain events:

Inter-event time is going to be set explicitly by the parsing routines; all other parameters are going to be calculated with method calls.

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   duration   each   intensity   new   push   sum   volume  

Included Modules

Enumerable

Attributes

date  [R]  date returns a Date object, time returns a String object, inter_time returns a Fixnum object.
inter_time  [R]  date returns a Date object, time returns a String object, inter_time returns a Fixnum object.
inter_time  [W]  inter_time should be set explicitly by the parsing routines.
time  [R]  date returns a Date object, time returns a String object, inter_time returns a Fixnum object.

Public Class methods

new requires the initial date and time that the Event occured. new is responsible for creating the values array which stores the rainfall volumes for every hour that the rainfall event continues.

Public Instance methods

append adds another value to the values array.

avg()

Alias for intensity

duration returns the number of hours this Event lasted.

each yields the values from this Event‘s values array.

avg gives the average intensity of this Event.

push(value)

Alias for append

sum()

Alias for volume

volume gives the total amount of rain for this Event.

[Validate]