terrasensetk.dataset package

Subpackages

Submodules

terrasensetk.dataset.Dataset module

class terrasensetk.dataset.Dataset.Dataset(eopatches_folder)[source]

Bases: object

add_index(index_name, index_formula)[source]

Adds a specific index to the dataset in question

NOTE:To make the index persist save_indices_to_patches must be called

Parameters
  • index_name (str) – The name of the index

  • index_formula (str) – The formula for the specified index

Example

>>> dataset.add_index("NDVI","(B07-B04)/(B07+B04)")
>>> dataset.add_index("IRECI","(B07-B04)/(B05/B06)")
>>> dataset.save_indices_to_patches()
property eopatches

List of EOPATCHES present in the given folder

get_eopatch(index)[source]
get_eopatches()[source]
get_eopatches_dataframe()[source]

Returns the DATASET information

Returns

Return type

DataFrame

save_indices_to_eopatches()[source]

Saves the previously indicated indices into the dataset.

Example

>>> dataset.add_index("NDVI","(B07-B04)/(B07+B04)")
>>> dataset.add_index("IRECI","(B07-B04)/(B05/B06)")
>>> dataset.save_indices_to_patches()

terrasensetk.dataset.Downloader module

terrasensetk.dataset.TSPatch module

class terrasensetk.dataset.TSPatch.TSPatch(*args: Any, **kwargs: Any)[source]

Bases: eolearn.core.

Extends the functionality of the original eo-patch implementation with methods to include extra functionality

Parameters

EOPatch (EOPatch) – eo-learn abstraction to represent a single region

property bbox

The bbox feature of the eopatch.

property data

The data feature of the eopatch.

property data_timeless

The data_timeless feature of the eopatch.

get_dataset_entry_value(nutrient, is_pixelized=False)[source]

Returns the value of column in the dataset

Parameters
  • nutrient (string) – Entry of the table (N,P,K, or other)

  • is_pixelized (bool, optional) – If true returns the value in the shape of the mask, if not, returns a scalar(int). Defaults to False.

Returns

If is_pixelized is true returns the value in the shape of the mask, if not, returns a scalar(int).

Return type

value|array

Example:

>>> patch.get_dataset_entry_value("N",True)
    [1.9,1.9,1.9,...,1.9,]
>>> patch.get_dataset_entry_value("N",False)
    1.9
get_eopatch_mask(include_indices=True)[source]

Can’t remember what this does

Parameters

include_indices (bool, optional) – Defaults to True.

Returns

??

Return type

array

get_masked_region()[source]
get_values_of_masked_region(indices=None, band_names=None, as_array=True)[source]

Returns the pixels in the masked region for the selected indices and band_names for each of the patch

Parameters
  • indices (str) – The list of indices in which we want to get the values of

  • band_names (str) – The list of indices in which we want to get the values of

  • as_array (bool, optional) – If true returns in 1D array form(only the values with data), else returns in 2D array. Defaults to True.

Returns

If as_array is true returns in 1D array form(only the values with data), else returns in 2D array.

Return type

ndarray

property label

The label feature of the eopatch.

property label_timeless

The label_timeless feature of the eopatch.

classmethod load(path, lazy_loading=True)[source]
property mask

The mask feature of the eopatch.

property mask_timeless

The mask_timeless feature of the eopatch.

property meta_info

The meta_info feature of the eopatch.

represent_image(estimation)[source]

Draws an image with the values estimated

Parameters

estimation (array) – Array with the size of the masked region(1D)

Returns

2D image

Return type

array

property scalar

The scalar feature of the eopatch.

property scalar_timeless

The scalar_timeless feature of the eopatch.

property timestamp

The timestamp feature of the eopatch.

property vector

The vector feature of the eopatch.

property vector_timeless

The vector_timeless feature of the eopatch.

Module contents