pytesmo.io package

Submodules

pytesmo.io.dataset_base module

Created on Mar 19, 2014

@author: Christoph Paulik christoph.paulik@geo.tuwien.ac.at

class pytesmo.io.dataset_base.DatasetImgBase(path, grid=None, img_offsets=array([datetime.timedelta(0)], dtype=object))[source]

Bases: object

Dateset base class that implements basic functions and also abstract methods that have to be implemented by child classes.

Parameters:

path : string

Path to dataset.

grid : pytesmo.grid.grids.BasicGrid of CellGrid instance, optional

Grid on which all the images of the dataset are stored. This is not relevant for datasets that are stored e.g. in orbit geometry

img_offsets : numpy array of timedeltas, optional

Gives the time offsets in a day that the images of one day have. e.g.: a model data with 6 hourly data with images at 0, 6, 12 and 18 o’clock would have img_offsets=np.array([timedelta(hours=0),

timedelta(hours=6), timedelta(hours=12), timedelta(hours=18)])

Default is set to np.array([timedelta(hours=0)]) for daily images with timestamp 0

Methods

daily_images(day, **kwargs)[source]

Yield all images for a day.

Parameters:

day : datetime.date or datetime.datetime

Specific day.

Returns:

data : dict

dictionary of numpy arrays that hold the image data for each variable of the dataset

metadata : dict

dictionary of numpy arrays that hold the metadata

timestamp : datetime.datetime

exact timestamp of the image

lon : numpy.array or None

array of longitudes, if None self.grid will be assumed

lat : numpy.array or None

array of latitudes, if None self.grid will be assumed

time_var : string or None

variable name of observation times in the data dict, if None all observations have the same timestamp

read_img(timestamp, **kwargs)[source]

Return an image if a specific datetime is given.

Parameters:

timestamp : datetime.datetime

Time stamp.

Returns:

data : dict

dictionary of numpy arrays that hold the image data for each variable of the dataset

metadata : dict

dictionary of numpy arrays that hold the metadata

timestamp : datetime.datetime

exact timestamp of the image

lon : numpy.array or None

array of longitudes, if None self.grid will be assumed

lat : numpy.array or None

array of latitudes, if None self.grid will be assumed

time_var : string or None

variable name of observation times in the data dict, if None all observations have the same timestamp

class pytesmo.io.dataset_base.DatasetTSBase(path, grid)[source]

Bases: object

Dateset base class that implements basic functions and also abstract methods that have to be implemented by child classes.

Parameters:

path : string

Path to dataset.

grid : pytesmo.grid.grids.BasicGrid of CellGrid instance

Grid on which the time series data is stored.

Methods

iter_ts(ll_bbox=None)[source]

Yield all time series for a grid or for grid points in a given lon/lat bound box (ll_bbox).

Parameters:

ll_bbox : tuple of floats (latmin, latmax, lonmin, lonmax)

Set to lon/lat bounding box to yield only points in that area.

Returns:

data : pandas.DataFrame

pandas.DateFrame with DateTimeIndex

read_gp(gpi, **kwargs)[source]

Reads time series for a given grid point index(gpi)

Parameters:

gpi : int

grid point index

Returns:

data : pandas.DataFrame

pandas.DateFrame with DateTimeIndex

read_ts(*args, **kwargs)[source]

Takes either 1 or 2 arguments and calls the correct function which is either reading the gpi directly or finding the nearest gpi from given lat,lon coordinates and then reading it

Module contents

Table Of Contents

Previous topic

pytesmo.grid package

Next topic

pytesmo.io.bufr package

This Page