Skip to content

DataFetcher

Bases: Protocol

Protocol for data fetchers

Data fetchers are callables that fetch data from a source given a minimum x and y coordinate. These coordinates correspond to the bottom left corner of a tile. The data fetcher is used by the dataset to fetch data for each tile.

Currently implemented data fetchers
  • CompositeFetcher: Composes multiple data fetchers
  • VRTFetcher: Fetches data from a virtual raster
  • WMSFetcher: Fetches data from a web map service
Notes
  • Implementations must support concurrency (the data fetcher is called concurrently by the data loader)

__call__

Fetches data from the source.

PARAMETER DESCRIPTION
x_min

minimum x coordinate

TYPE: Coordinate

y_min

minimum y coordinate

TYPE: Coordinate

RETURNS DESCRIPTION
npt.NDArray

data


CompositeFetcher

Bases: FromConfigMixin

Data fetcher that composes multiple data fetchers

Implements the DataFetcher protocol.

PARAMETER DESCRIPTION
data_fetchers

data fetchers

TYPE: list[DataFetcher]

num_workers

number of workers

TYPE: int DEFAULT: 1

from_config classmethod

Creates a composite fetcher from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: CompositeFetcherConfig

RETURNS DESCRIPTION
CompositeFetcher

composite fetcher

__call__

Fetches data from the sources.

PARAMETER DESCRIPTION
x_min

minimum x coordinate

TYPE: Coordinate

y_min

minimum y coordinate

TYPE: Coordinate

RETURNS DESCRIPTION
npt.NDArray

data


CompositeFetcherConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of CompositeFetcher

ATTRIBUTE DESCRIPTION
data_fetchers_configs

configurations of the data fetchers

TYPE: list[DataFetcherConfig]

num_workers

number of workers

TYPE: int


DataFetcherConfig

Bases: pydantic.BaseModel

Configuration for data fetchers

ATTRIBUTE DESCRIPTION
name

name of the data fetcher

TYPE: str

config

configuration of the data fetcher

TYPE: VRTFetcherConfig | WMSFetcherConfig


VRTFetcher

Bases: FromConfigMixin

Data fetcher for virtual rasters

Implements the DataFetcher protocol.

PARAMETER DESCRIPTION
path

path to the virtual raster (.vrt file)

TYPE: Path

tile_size

tile size in meters

TYPE: TileSize

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

interpolation_mode

interpolation mode (BILINEAR or NEAREST)

TYPE: InterpolationMode DEFAULT: InterpolationMode.BILINEAR

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

drop_channels

channel indices to drop (supports negative indexing)

TYPE: list[int] | None DEFAULT: None

from_config classmethod

Creates a vrt fetcher from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: VRTFetcherConfig

RETURNS DESCRIPTION
VRTFetcher

vrt fetcher

__call__

Fetches data from the virtual raster.

PARAMETER DESCRIPTION
x_min

minimum x coordinate

TYPE: Coordinate

y_min

minimum y coordinate

TYPE: Coordinate

RETURNS DESCRIPTION
npt.NDArray

data


VRTFetcherConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of VRTFetcher

ATTRIBUTE DESCRIPTION
path

path to the virtual raster (.vrt file)

TYPE: Path

tile_size

tile size in meters

TYPE: TileSize

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

interpolation_mode

interpolation mode ('bilinear' or 'nearest')

TYPE: InterpolationMode

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize

drop_channels

channel indices to drop (supports negative indexing)

TYPE: list[int] | None


WMSFetcher

Bases: FromConfigMixin

Data fetcher for web map services

Implements the DataFetcher protocol.

PARAMETER DESCRIPTION
url

url of the web map service

TYPE: str

version

version of the web map service (V1_1_1 or V1_3_0)

TYPE: WMSVersion

layer

name of the layer

TYPE: str

epsg_code

EPSG code

TYPE: EPSGCode

response_format

format of the response (MIME type, e.g., 'image/png')

TYPE: str

tile_size

tile size in meters

TYPE: TileSize

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

style

name of the style

TYPE: str | None DEFAULT: None

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

drop_channels

channel indices to drop (supports negative indexing)

TYPE: list[int] | None DEFAULT: None

from_config classmethod

Creates a wms fetcher from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: WMSFetcherConfig

RETURNS DESCRIPTION
WMSFetcher

wms fetcher

__call__

Fetches data from the web map service.

PARAMETER DESCRIPTION
x_min

minimum x coordinate

TYPE: Coordinate

y_min

minimum y coordinate

TYPE: Coordinate

RETURNS DESCRIPTION
npt.NDArray

data


WMSFetcherConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of WMSFetcher

ATTRIBUTE DESCRIPTION
url

url of the web map service

TYPE: str

version

version of the web map service ('1.1.1' or '1.3.0')

TYPE: WMSVersion

layer

name of the layer

TYPE: str

epsg_code

EPSG code

TYPE: EPSGCode

response_format

format of the response (MIME type, e.g., 'image/png')

TYPE: str

tile_size

tile size in meters

TYPE: TileSize

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

style

name of the style

TYPE: str | None

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize

drop_channels

channel indices to drop (supports negative indexing)

TYPE: list[int] | None