nens/timeseries — Issue #2: write_to_pi_file is classmethod of TimeSeries, please use it.
Author: mfrasca
Created: 2011-11-04 10:31:27+00:00
State: open

in TimeSeries we have a classmethod named write_to_pi_file.
this function takes care of writing a set, list or dict containing TimeSeries to a PI file.

to participate to this classmethod, a class derived from TimeSeries needs either reimplementing `_as_element` or, preferably, implementing a couple of functions and to hold some fields or properties:

type, location_id, parameter_id, get_end_date(), get_start_date(), sorted_event_items().

if you do the above, you do not need reimplementing/rewriting your own write_to_pi_file function.

in the `_as_element` method you find back all solutions to actually silly problems caused by the FEWS implementation of the PI reader.