### Navigation

- index
- modules |
- next |
- previous |
- pywws 14.03.dev1177 documentation »
- Python programs and modules »

# pywws.Process

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

    usage: python -m pywws.Process [options] data_dir
    options are:
     -h or --help     display this help
     -v or --verbose  increase number of informative messages
    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

`ApplicationLogger`(verbose[, logfile]) |
`Process`(params, raw_data, calib_data, ...) | Generate summaries from raw weather station data.
`calibrate_data`(logger, params, raw_data, ...) | ‘Calibrate’ raw data, using a user-supplied function.
`generate_daily`(logger, day_end_hour, ...) | Generate daily summaries from calibrated and hourly data.
`generate_hourly`(logger, calib_data, ...) | Generate hourly summaries from calibrated data.
`generate_monthly`(logger, rain_day_threshold, ...) | Generate monthly summaries from daily data.
`main`([argv]) |

Classes

`Average`() | Compute average of multiple data values.
`Calib`(params, stored_data) | Calibration class that implements default or user calibration.
`DayAcc`() | ‘Accumulate’ weather data to produce daily summary.
`HourAcc`(last_rain) | ‘Accumulate’ raw weather data to produce hourly summary.
`Maximum`() | Compute maximum value and timestamp of multiple data values.
`Minimum`() | Compute minimum value and timestamp of multiple data values.
`MonthAcc`(rain_day_threshold) | ‘Accumulate’ daily weather data to produce monthly summary.
`date` | date(year, month, day) –> date object
`datetime` | datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
`deque` | deque([iterable[, maxlen]]) –> deque object
`timedelta` | Difference between two datetime values.

class `pywws.Process.``Average`

  Compute average of multiple data values.

  `add`(value)
  `result`()

class `pywws.Process.``Minimum`

  Compute minimum value and timestamp of multiple data values.

  `add`(value, time)
  `result`()

class `pywws.Process.``Maximum`

  Compute maximum value and timestamp of multiple data values.

  `add`(value, time)
  `result`()

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 `pywws.Process.``DayAcc`

  ‘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 `pywws.Process.``MonthAcc`(rain_day_threshold)

  ‘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, calib_data, hourly_data, daily_data, process_from)

  Generate daily summaries from calibrated and hourly data.

`pywws.Process.``generate_monthly`(logger, rain_day_threshold, day_end_hour, 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)

### Navigation

- index
- modules |
- next |
- previous |
- pywws 14.03.dev1177 documentation »
- Python programs and modules »