
pywws.Process
*************

Generate hourly, daily & monthly summaries of raw weather station data

   usage: python RunModule.py Process [options] data_dir
   options are:
    -h or --help     display this help
   data_dir is the root directory of the weather data

This module takes raw weather station data (typically sampled every
five or ten minutes) and generates hourly, daily and monthly summary
data, which is useful when creating tables and graphs.

Before computing the data summaries, raw data is "calibrated" using a
user-programmable function. See *pywws.calib* for details.

The hourly data is derived from all the records in one hour, e.g. from
18:00:00 to 18:59:59, and is given the index of the last complete
record in that hour.

The daily data summarises the weather over a 24 hour period typically
ending at 2100 or 0900 hours, local (non DST) time, though midnight is
another popular convention. It is also indexed by the last complete
record in the period. Daytime and nightime, as used when computing
maximum and minimum temperatures, are assumed to start at 0900 and
2100 local time, or 1000 and 2200 when DST is in effect, regardless of
the meteorological day.

To adjust the meteorological day to your preference, or that used by
your local official weather station, edit the "day end hour" line in
your "weather.ini" file, then run Reprocess.py to regenerate the
summaries.

Monthly summary data is computed from the daily summary data. If the
meteorological day does not end at midnight, then each month may begin
and end up to 12 hours before or after midnight.

Wind speed data is averaged over the hour (or day) and the maximum
gust speed during the hour (or day) is recorded. The predominant wind
direction is calculated using vector arithmetic.

Rainfall is converted from the raw "total since last reset" figure to
a more useful total in the last hour, day or month.

-[ Functions ]-

+------------+--------------------------------------------------------------------------------------------+
| "Process"( | Generate summaries from raw weather station data.                                          |
+------------+--------------------------------------------------------------------------------------------+
| "calibrate | 'Calibrate' raw data, using a user-supplied function.                                      |
+------------+--------------------------------------------------------------------------------------------+
| "generate_ | Generate hourly summaries from calibrated data.                                            |
+------------+--------------------------------------------------------------------------------------------+
| "generate_ | Generate daily summaries from calibrated and hourly data.                                  |
+------------+--------------------------------------------------------------------------------------------+
| "generate_ | Generate monthly summaries from daily data.                                                |
+------------+--------------------------------------------------------------------------------------------+

-[ Classes ]-

+------------+--------------------------------------------------------------------------------------------+
| "Average"( | Compute average of multiple data values.                                                   |
+------------+--------------------------------------------------------------------------------------------+
| "Maximum"( | Compute maximum value and timestamp of multiple data values.                               |
+------------+--------------------------------------------------------------------------------------------+
| "Minimum"( | Compute minimum value and timestamp of multiple data values.                               |
+------------+--------------------------------------------------------------------------------------------+
| "HourAcc"( | 'Accumulate' raw weather data to produce hourly summary.                                   |
+------------+--------------------------------------------------------------------------------------------+
| "DayAcc"(d | 'Accumulate' weather data to produce daily summary.                                        |
+------------+--------------------------------------------------------------------------------------------+
| "MonthAcc" | 'Accumulate' daily weather data to produce monthly summary.                                |
+------------+--------------------------------------------------------------------------------------------+

class class pywws.Process.Average

   Compute average of multiple data values.

   add(value)

   result()

class class pywws.Process.Minimum

   Compute minimum value and timestamp of multiple data values.

   add(value, time)

   result()

class class pywws.Process.Maximum

   Compute maximum value and timestamp of multiple data values.

   add(value, time)

   result()

class class pywws.Process.HourAcc(last_rain)

   'Accumulate' raw weather data to produce hourly summary.

   Compute average wind speed and maximum wind gust, find dominant
   wind direction and compute total rainfall.

   reset()

   add_raw(data)

   result()

class class pywws.Process.DayAcc(daytime)

   'Accumulate' weather data to produce daily summary.

   Compute average wind speed, maximum wind gust and daytime max &
   nighttime min temperatures, find dominant wind direction and
   compute total rainfall.

   Daytime is assumed to be 0900-2100 and nighttime to be 2100-0900,
   local time (1000-2200 and 2200-1000 during DST), regardless of the
   "day end hour" setting.

   reset()

   add_raw(data)

   add_hourly(data)

   result()

class class pywws.Process.MonthAcc

   'Accumulate' daily weather data to produce monthly summary.

   Compute daytime max & nighttime min temperatures.

   reset()

   add_daily(data)

   result()

pywws.Process.calibrate_data(logger, params, raw_data, calib_data)

   'Calibrate' raw data, using a user-supplied function.

pywws.Process.generate_hourly(logger, calib_data, hourly_data, process_from)

   Generate hourly summaries from calibrated data.

pywws.Process.generate_daily(logger, day_end_hour, daytime, calib_data, hourly_data, daily_data, process_from)

   Generate daily summaries from calibrated and hourly data.

pywws.Process.generate_monthly(logger, day_end_hour, time_offset, daily_data, monthly_data, process_from)

   Generate monthly summaries from daily data.

pywws.Process.Process(params, raw_data, calib_data, hourly_data, daily_data, monthly_data)

   Generate summaries from raw weather station data.

   The meteorological day end (typically 2100 or 0900 local time) is
   set in the preferences file "weather.ini". The default value is
   2100 (2200 during DST), following the historical convention for
   weather station readings.

pywws.Process.main(argv=None)
