Tile#

class datacube.api.Tile(sources, geobox)[source]#

The Tile object holds a lightweight representation of a datacube result.

It is produced by GridWorkflow.list_cells() or GridWorkflow.list_tiles().

The Tile object can be passed to GridWorkflow.load() to be loaded into memory as an xarray.Dataset.

A portion of a tile can be created by using index notation. eg:

tile[0:1, 0:1000, 0:1000]

This can be used to load small portions of data into memory, instead of having to access the entire Tile at once.

Create a Tile representing a dataset that can be loaded.

Parameters
  • sources (xarray.DataArray) – An array of non-spatial dimensions of the request, holding lists of datacube.storage.DatasetSource objects.

  • geobox (model.GeoBox) – The spatial footprint of the Tile

Attributes:

dims

Names of the dimensions, eg ('time', 'y', 'x') :return: tuple(str)

product

datacube.model.DatasetType

shape

Lengths of each dimension, eg (285, 4000, 4000) :return: tuple(int)

Methods:

split(dim[, step])

Splits along a non-spatial dimension into Tile objects with a length of 1 or more in the dim dimension.

split_by_time([freq, time_dim])

Splits along the time dimension, into periods, using pandas offsets, such as:

property dims#

Names of the dimensions, eg ('time', 'y', 'x') :return: tuple(str)

property product#

datacube.model.DatasetType

Type

rtype

property shape#

Lengths of each dimension, eg (285, 4000, 4000) :return: tuple(int)

split(dim, step=1)[source]#

Splits along a non-spatial dimension into Tile objects with a length of 1 or more in the dim dimension.

Parameters
  • dim – Name of the non-spatial dimension to split

  • step – step size to split

Returns

tuple(key, Tile)

split_by_time(freq='A', time_dim='time', **kwargs)[source]#

Splits along the time dimension, into periods, using pandas offsets, such as: :

‘A’: Annual ‘Q’: Quarter ‘M’: Month

See: http://pandas.pydata.org/pandas-docs/stable/timeseries.html?highlight=rollback#timeseries-offset-aliases

Parameters
  • freq – time series frequency

  • time_dim – name of the time dimension

  • kwargs – other keyword arguments passed to pandas.period_range

Returns

Generator[tuple(str, Tile)] generator of the key string (eg ‘1994’) and the slice of Tile