Skip to content

RasterChannel

Bases: Channel, Iterable[npt.NDArray]

Channel that contains batched raster data

Notes
  • The data items are assumed to be in shape (n, n), where n is the spatial extent in x and y direction
  • The data property returns a reference to the data
  • The dunder methods __getitem__ and __iter__ return or yield a reference to a data item
PARAMETER DESCRIPTION
data

Data

TYPE: npt.NDArray | list[npt.NDArray]

name

Name

TYPE: ChannelName | str

buffer_size

Buffer size as a fraction of the spatial extent of the data

TYPE: FractionalBufferSize DEFAULT: 0.0

time_step

Time step

TYPE: TimeStep | None DEFAULT: None

copy

If True, the data is copied during initialization

TYPE: bool DEFAULT: False

name property writable

RETURNS DESCRIPTION
ChannelName | str

Name

buffer_size property

RETURNS DESCRIPTION
FractionalBufferSize

Buffer size as a fraction of the spatial extent of the data

time_step property writable

RETURNS DESCRIPTION
TimeStep | None

Time step

is_copied property

RETURNS DESCRIPTION
bool

If True, the data is copied during initialization

batch_size property

RETURNS DESCRIPTION
int

Batch size

is_in_tiles property

RETURNS DESCRIPTION
bool

True if the channel is inside tiles, False otherwise

key property

RETURNS DESCRIPTION
ChannelKey

Name and time step combination

data property

RETURNS DESCRIPTION
list[npt.NDArray]

Data

__len__

Computes the batch size.

RETURNS DESCRIPTION
int

Batch size

from_channels classmethod

Creates a raster channel from raster channels.

PARAMETER DESCRIPTION
channels

Raster channels

TYPE: list[RasterChannel]

copy

If True, the data is copied during initialization

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
RasterChannel

Raster channel

__eq__

Compares the raster channels.

PARAMETER DESCRIPTION
other

Other raster channel

TYPE: object

RETURNS DESCRIPTION
bool

True if the raster channels are equal, False otherwise

__getitem__

Returns the data item.

PARAMETER DESCRIPTION
index

Index or slice of the data item

TYPE: int | slice

RETURNS DESCRIPTION
npt.NDArray | list[npt.NDArray]

Data item or sliced data

__iter__

Iterates over the data.

YIELDS DESCRIPTION
npt.NDArray

Data item

__add__

Adds the raster channels.

PARAMETER DESCRIPTION
other

Other raster channel

TYPE: RasterChannel

RETURNS DESCRIPTION
RasterChannel

Raster channel

append

Appends the data.

PARAMETER DESCRIPTION
data

Data

TYPE: npt.NDArray | list[npt.NDArray]

inplace

If True, the data is appended inplace

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
RasterChannel

Raster channel

copy

Copies the raster channel.

RETURNS DESCRIPTION
RasterChannel

Raster channel

remove_buffer

Removes the buffer.

PARAMETER DESCRIPTION
inplace

If True, the buffer is removed inplace

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
RasterChannel

Raster channel