### Navigation

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

# pywws.LogData

Save weather station history to file

    usage: python -m pywws.LogData [options] data_dir
    options are:
     -h   | --help     display this help
     -c   | --clear    clear weather station's memory full indicator
     -s n | --sync n   set quality of synchronisation to weather station (0 or 1)
     -v   | --verbose  increase number of informative messages
    data_dir is the root directory of the weather data

This module gets data from the weather station’s memory and stores it to file. Each time it is run it fetches all data that is newer than the last stored data, so it only needs to be run every hour or so. As the weather station typically stores two weeks’ readings (depending on the logging interval), `pywws.LogData` could be run quite infrequently if you don’t need up-to-date data.

There is no date or time information in the raw weather station data, so `pywws.LogData` creates a time stamp for each reading. It uses the computer’s clock, rather than the weather station clock which can not be read accurately by the computer. A networked computer should have its clock set accurately by ntp.

Synchronisation with the weather station is achieved by waiting for a change in the current data. There are two levels of synchronisation, set by the config file or a command line option. Level 0 is quicker, but is only accurate to around twelve seconds. Level 1 waits until the weather station stores a new logged record, and gets time stamps accurate to a couple of seconds. Note that this could take a long time, if the logging interval is greater than the recommended five minutes.

## Detailed API

Functions

`ApplicationLogger`(verbose[, logfile]) |
`main`([argv]) |

Classes

`DataLogger`(params, status, raw_data) |
`datetime` | datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
`timedelta` | Difference between two datetime values.

class `pywws.LogData.``DataLogger`(params, status, raw_data)
  `check_fixed_block`()
  `catchup`(last_date, last_ptr)
  `log_data`(sync=None, clear=False)
  `live_data`(logged_only=False)

`pywws.LogData.``main`(argv=None)

### Navigation

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