repurpose package¶
Submodules¶
repurpose.img2ts module¶
repurpose.ts2img module¶
module for conversion of time series data to image data Created on Mon Apr 20 11:08:58 2015
@author: christoph.paulik@geo.tuwien.ac.at

class
repurpose.ts2img.
Ts2Img
(tsreader, imgwriter, agg_func=None, ts_buffer=1000)[source]¶ Bases:
object
Takes a time series dataset and converts it into an image dataset. A custom aggregate function should be given otherwise a daily mean will be used
Parameters:  tsreader (object) – object that implements a iter_ts method which iterates over pandas time series and has a grid attribute that is a pytesmo BasicGrid or CellGrid
 imgwriter (object) – writer object that implements a write_ts method that takes a list of grid point indices and a 2D array containing the time series data
 agg_func (function) – function that takes a pandas DataFrame and returns an aggregated pandas DataFrame
 ts_buffer (int) – how many time series to read before writing to disk, constrained by the working memory the process should use.

tsbulk
(gpis=None, **tsaggkw)[source]¶ iterator over gpi and time series arrays of size self.ts_buffer
Parameters:  gpis (iterable, optional) – if given these gpis will be used, can be practical if the gpis are managed by an external class e.g. for parallel processing
 tsaggkw (dict) – Keywords to give to the time series aggregation function
Returns:  gpi_array (numpy.array) – numpy array of gpis in this batch
 ts_bulk (dict of numpy arrays) – for each variable one numpy array of shape (len(gpi_array), len(ts_aggregated))

repurpose.ts2img.
agg_tsmonthly
(ts, **kwargs)[source]¶ Parameters:  ts (pandas.DataFrame) – time series of a point
 kwargs (dict) – any additional keyword arguments that are given to the ts2img object during initialization
Returns: ts_agg – aggregated time series, they all must have the same length otherwise it can not work each column of this DataFrame will be a layer in the image
Return type: