pyresample.image module

Handles resampling of images with assigned geometry definitions.

class pyresample.image.ImageContainer(image_data, geo_def, fill_value=0, nprocs=1)

Bases: object

Holds image with geometry definition. Allows indexing with linesample arrays.

Parameters:
  • image_data (numpy array) – Image data

  • geo_def (object) – Geometry definition

  • fill_value (int or None, optional) – Set undetermined pixels to this value. If fill_value is None a masked array is returned with undetermined pixels masked

  • nprocs (int, optional) – Number of processor cores to be used

image_data

Image data

Type:

numpy array

geo_def

Geometry definition

Type:

object

fill_value

Resample result fill value

Type:

int or None

nprocs

Number of processor cores to be used for geometry operations

Type:

int

Initialize ImageContainer.

__init__(image_data, geo_def, fill_value=0, nprocs=1)

Initialize ImageContainer.

get_array_from_linesample(row_indices, col_indices)

Get array sampled from image based on index arrays.

Parameters:
  • row_indices (numpy array) – Row indices. Dimensions must match col_indices

  • col_indices (numpy array) – Col indices. Dimensions must match row_indices

Returns:

image_data – Resampled image data

Return type:

numpy_array

get_array_from_neighbour_info(*args, **kwargs)

Resample from preprocessed data.

resample(target_geo_def)

Resample data to target definition.

class pyresample.image.ImageContainerBilinear(image_data, geo_def, radius_of_influence, epsilon=0, fill_value=0, reduce_data=False, nprocs=1, segments=None, neighbours=32)

Bases: ImageContainer

Holds image with geometry definition. Allows bilinear to new geometry definition.

Parameters:
  • image_data (numpy array) – Image data

  • geo_def (object) – Geometry definition

  • radius_of_influence (float) – Cut off distance in meters

  • epsilon (float, optional) – Allowed uncertainty in meters. Increasing uncertainty reduces execution time

  • fill_value (int or None, optional) – Set undetermined pixels to this value. If fill_value is None a masked array is returned with undetermined pixels masked

  • reduce_data (bool, optional) – Perform coarse data reduction before resampling in order to reduce execution time

  • nprocs (int, optional) – Number of processor cores to be used for geometry operations

  • segments (int or None) – Number of segments to use when resampling. If set to None an estimate will be calculated

image_data

Image data

Type:

numpy array

geo_def

Geometry definition

Type:

object

radius_of_influence

Cut off distance in meters

Type:

float

epsilon

Allowed uncertainty in meters

Type:

float

fill_value

Resample result fill value

Type:

int or None

reduce_data

Perform coarse data reduction before resampling

Type:

bool

nprocs

Number of processor cores to be used

Type:

int

segments

Number of segments to use when resampling

Type:

int or None

Initialize ImageContainer.

__init__(image_data, geo_def, radius_of_influence, epsilon=0, fill_value=0, reduce_data=False, nprocs=1, segments=None, neighbours=32)

Initialize ImageContainer.

resample(target_geo_def)

Resamples image to area definition using bilinear approach.

Parameters:

target_geo_def (object) – Target geometry definition

Returns:

image_container – ImageContainerBilinear object of resampled geometry

Return type:

object

class pyresample.image.ImageContainerNearest(image_data, geo_def, radius_of_influence, epsilon=0, fill_value=0, reduce_data=True, nprocs=1, segments=None)

Bases: ImageContainer

Holds image with geometry definition. Allows nearest neighbour to new geometry definition.

Parameters:
  • image_data (numpy array) – Image data

  • geo_def (object) – Geometry definition

  • radius_of_influence (float) – Cut off distance in meters

  • epsilon (float, optional) – Allowed uncertainty in meters. Increasing uncertainty reduces execution time

  • fill_value (int or None, optional) – Set undetermined pixels to this value. If fill_value is None a masked array is returned with undetermined pixels masked

  • reduce_data (bool, optional) – Perform coarse data reduction before resampling in order to reduce execution time

  • nprocs (int, optional) – Number of processor cores to be used for geometry operations

  • segments (int or None) – Number of segments to use when resampling. If set to None an estimate will be calculated

image_data

Image data

Type:

numpy array

geo_def

Geometry definition

Type:

object

radius_of_influence

Cut off distance in meters

Type:

float

epsilon

Allowed uncertainty in meters

Type:

float

fill_value

Resample result fill value

Type:

int or None

reduce_data

Perform coarse data reduction before resampling

Type:

bool

nprocs

Number of processor cores to be used

Type:

int

segments

Number of segments to use when resampling

Type:

int or None

Initialize ImageContainer.

__init__(image_data, geo_def, radius_of_influence, epsilon=0, fill_value=0, reduce_data=True, nprocs=1, segments=None)

Initialize ImageContainer.

resample(target_geo_def)

Resample image to area definition using nearest neighbour approach.

Parameters:

target_geo_def (object) – Target geometry definition

Returns:

image_container – ImageContainerNearest object of resampled geometry

Return type:

object

class pyresample.image.ImageContainerQuick(image_data, geo_def, fill_value=0, nprocs=1, segments=None)

Bases: ImageContainer

Holds image with area definition and allows quick resampling within area.

Parameters:
  • image_data (numpy array) – Image data

  • geo_def (object) – Area definition as AreaDefinition object

  • fill_value (int or None, optional) – Set undetermined pixels to this value. If fill_value is None a masked array is returned with undetermined pixels masked

  • nprocs (int, optional) – Number of processor cores to be used for geometry operations

  • segments (int or None) – Number of segments to use when resampling. If set to None an estimate will be calculated

image_data

Image data

Type:

numpy array

geo_def

Area definition as AreaDefinition object

Type:

object

fill_value

Resample result fill value If fill_value is None a masked array is returned with undetermined pixels masked

Type:

int or None

nprocs

Number of processor cores to be used

Type:

int

segments

Number of segments to use when resampling

Type:

int or None

Initialize ImageContainer.

__init__(image_data, geo_def, fill_value=0, nprocs=1, segments=None)

Initialize ImageContainer.

resample(target_area_def)

Resample image to area definition using nearest neighbour approach in projection coordinates.

Parameters:

target_area_def (object) – Target area definition as AreaDefinition object

Returns:

image_container – ImageContainerQuick object of resampled area

Return type:

object