stella.sensor
Class Meteorology

java.lang.Object
  extended by stella.sensor.Meteorology
All Implemented Interfaces:
Comparable<Meteorology>

public class Meteorology
extends Object
implements Comparable<Meteorology>

Class that reads weather ascii files in the format:

   dd.MM.yy HH:mm:ss[*] val[*] ...val...
   
The first two colums are the date, followed by an asterisk, if overall weather was bad. Then, individual sensor averages follow, again marked with an asterisk, if currently bad or in retardation. A exclamation mark signals sensor stalled, the bad/good flag is than taken from the prior reading.


Nested Class Summary
static class Meteorology.Robotel
          Reads the robotel weather data and does some statistic.
static class Meteorology.Stella
          Reads the Tenerife weather data and does some statistic.
 
Field Summary
private  boolean[] bad
           
private  Date date
           
static DateFormat DF
           
private  double[] reading
           
private  boolean totbad
           
private  boolean[] valid
           
 
Constructor Summary
Meteorology(Date d, boolean ov, double[] val, boolean[] b, boolean[] v)
           
 
Method Summary
 int compareTo(Meteorology after)
          For sorting: sort to date.
static int count(List<Meteorology> data, int month, int hour)
          Count the data points with calendar
static List<Meteorology> db(List<String> names, List<Double> badtoggles, List<Double> goodtoggles, List<Long> retards, Date from, Date to)
          Parses a db entry and tries to reconstruct the filters retard time.
static List<Meteorology> filter(List<Meteorology> data, int sensor, double trigg, boolean below)
           
static int[] getBadTriggers(List<Meteorology> data)
          Count the instances, when the sensor on a specific index was the first to report bad.
static int getBadWeather(List<Meteorology> data, int month, int hour)
          Count the data points with good weather.
 Date getDate()
          Returns the date of the sensor average.
static int getSensorBelow(List<Meteorology> data, int month, int hour, int i0, double below, Boolean bad)
          Count data points where the sensor at the given index is lower than the stated value and the weather is bad like the Boolean
 int getSensorCount()
          Number of sensor reading.
 boolean isBad(int i0)
          Returns true, if the sensor on the given index reported bad.
 boolean isValid(int i0)
          Returns true, if the sensor on the given index is valid.
 boolean overallBad()
          Returns true, if the overall reading is bad.
static List<Meteorology> parse(List<String> ascii, Date from, Date to)
          Parses a list of lines into a list of meterology object, file should be in correct time order to assure proper assignment of invalid readings
static Meteorology parseLine(Meteorology last, String line)
           
 double reading(int i0)
          Returns the sensor reading on the given index.
 String toString()
          String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DF

public static final DateFormat DF

date

private Date date

totbad

private boolean totbad

reading

private double[] reading

bad

private boolean[] bad

valid

private boolean[] valid
Constructor Detail

Meteorology

public Meteorology(Date d,
                   boolean ov,
                   double[] val,
                   boolean[] b,
                   boolean[] v)
Method Detail

parseLine

public static Meteorology parseLine(Meteorology last,
                                    String line)
                             throws ParseException
Throws:
ParseException

overallBad

public boolean overallBad()
Returns true, if the overall reading is bad.


isBad

public boolean isBad(int i0)
Returns true, if the sensor on the given index reported bad.


isValid

public boolean isValid(int i0)
Returns true, if the sensor on the given index is valid.


reading

public double reading(int i0)
Returns the sensor reading on the given index.


getDate

public Date getDate()
Returns the date of the sensor average.


getSensorCount

public int getSensorCount()
Number of sensor reading.


compareTo

public int compareTo(Meteorology after)
For sorting: sort to date.

Specified by:
compareTo in interface Comparable<Meteorology>

toString

public String toString()
String.

Overrides:
toString in class Object

parse

public static List<Meteorology> parse(List<String> ascii,
                                      Date from,
                                      Date to)
                               throws ParseException
Parses a list of lines into a list of meterology object, file should be in correct time order to assure proper assignment of invalid readings

Throws:
ParseException

db

public static List<Meteorology> db(List<String> names,
                                   List<Double> badtoggles,
                                   List<Double> goodtoggles,
                                   List<Long> retards,
                                   Date from,
                                   Date to)
Parses a db entry and tries to reconstruct the filters retard time.


count

public static int count(List<Meteorology> data,
                        int month,
                        int hour)
Count the data points with calendar


getBadWeather

public static int getBadWeather(List<Meteorology> data,
                                int month,
                                int hour)
Count the data points with good weather.


filter

public static List<Meteorology> filter(List<Meteorology> data,
                                       int sensor,
                                       double trigg,
                                       boolean below)

getSensorBelow

public static int getSensorBelow(List<Meteorology> data,
                                 int month,
                                 int hour,
                                 int i0,
                                 double below,
                                 Boolean bad)
Count data points where the sensor at the given index is lower than the stated value and the weather is bad like the Boolean


getBadTriggers

public static int[] getBadTriggers(List<Meteorology> data)
Count the instances, when the sensor on a specific index was the first to report bad. The returned arra has one index more than the meteorology array, the last index is the event with multiple triggers.