pygeobase package

Submodules

pygeobase.io_base module

class pygeobase.io_base.GriddedStaticBase(path, grid, ioclass, mode='r', fn_format='{:04d}')[source]

Bases: object

The GriddedStaticBase class uses another IO class together with a grid object to read/write a dataset under the given path.

Methods

close() Close file.
flush() Flush data.
iter_gp() Yield all values for all grid points.
read(*args, **kwargs) Takes either 1 or 2 arguments and calls the correct function
read_gp(gpi) Read data for given grid point.
write(data) Write data.
write_gp(gpi, data) Write data for given grid point.
close()[source]

Close file.

flush()[source]

Flush data.

iter_gp()[source]

Yield all values for all grid points.

read(*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

read_gp(gpi)[source]

Read data for given grid point.

Parameters:

gpi : int

Grid point index.

Returns:

data : numpy.ndarray

Time series data.

write(data)[source]

Write data.

Parameters:

data : numpy.ndarray

Data records. A field ‘gpi’, indicating the grid point index has to be included.

write_gp(gpi, data)[source]

Write data for given grid point.

Parameters:

gpi : int

Grid point index.

data : numpy.ndarray

Data

class pygeobase.io_base.GriddedTsBase(path, grid, ioclass, mode='r', fn_format='{:04d}')[source]

Bases: object

The GriddedTsBase class uses another IO class together with a grid object to read/write a time series dataset under the given path.

Parameters:

path : string

Path to dataset.

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

Grid on which the time series data is stored.

ioclass : class

IO class

mode : str, optional

File mode and can be read ‘r’, write ‘w’ or append ‘a’. Default: ‘r’

cell_format : str, optional

The string format of the cell files. Default: ‘{:04d}’

Methods

close() Close file.
flush() Flush data.
get_nearest_gp_info(lon, lat) get info for nearest grid point
iter_ts() Yield time series for all grid points.
read_gp(gpi, **kwargs) Reads time series for a given grid point index.
read_ts(*args, **kwargs) Takes either 1 or 2 arguments and calls the correct function
write_gp(gpi, data, **kwargs) Write data for given grid point.
write_ts(*args, **kwargs) Takes either 2 or 3 arguments (the last one always needs to be the data to be written) and calls the correct function which is either writing the gpi directly or finding the nearest gpi from given lon, lat coordinates and then reading it.
close()[source]

Close file.

flush()[source]

Flush data.

get_nearest_gp_info(lon, lat)[source]

get info for nearest grid point

Parameters:

lon : float

Longitude coordinate.

lat : float

Latitude coordinate.

Returns:

gpi : int

Grid point index of nearest grid point.

gp_lon : float

Lontitude coordinate of nearest grid point.

gp_lat : float

Latitude coordinate of nearest grid point.

gp_dist : float

Geodetic distance to nearest grid point.

iter_ts()[source]

Yield time series for all grid points.

read_gp(gpi, **kwargs)[source]

Reads time series for a given grid point index.

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

write_gp(gpi, data, **kwargs)[source]

Write data for given grid point.

Parameters:

gpi : int

Grid point index.

data : numpy.ndarray

Data records.

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

Takes either 2 or 3 arguments (the last one always needs to be the data to be written) and calls the correct function which is either writing the gpi directly or finding the nearest gpi from given lon, lat coordinates and then reading it.

class pygeobase.io_base.ImageBase[source]

Bases: object

class pygeobase.io_base.StaticBase[source]

Bases: object

class pygeobase.io_base.TsBase[source]

Bases: object

Module contents