Skip to main content

time series feature extraction from raster data

Project description


ts-raster is a python package for extracting and analyzing of time-series characteristics from raster data. The feature extraction follows the footsteps of approaches developed in the python package tsfresh.

  • input : historical raster data (e.g. Monthly temperature data (2000-2018)
  • Extracted Feature: Mean, minimum, maximum, standard deviation... characteristics for all the data
  • output: data frame(CSV) or (array)Raster file

For analysis, several machine learning models as well as an ensemble modeling technique are incorporated.


stable version:

pip install tsraster

from github:

git clone
cd ts-raster
pip install e .

Input Data Structure

The input raster files from which features will be extracted are organized to allow extraction from files contained multiple folders.

Example data:

        tmx-200503.tif ...

temprature: the variable

  • 2005, 2006, 2007: the years
    • tmx-200501.tif: the image
      • tmx : unique identifier of each image
      • 200501: year and month

ts-raster will consider the value '200501' as a unique time identifier.


from tsraster.prep import sRead as tr
from tsraster.calculate import calculateFeatures

path = "../docs/img/temperature/"

image_name = tr.image_names(path)
['tmx-200601', 'tmx-200603', 'tmx-200602', 'tmx-200703', 'tmx-200702', 'tmx-200701', 'tmx-200501', 'tmx-200502', 'tmx-200503']

Convert each image to array and stack them as bands

rasters = tr.image2array(path)
(1120, 872, 9)

Calculate features

ts_features = calculateFeatures(path)
Feature Extraction: 100%|██████████| 80/80 [01:18<00:00,  1.02it/s]

output: dataframe

variable  value__maximum  value__mean  value__median  value__minimum
1.0                  0.0          0.0            0.0             0.0
2.0                  0.0          0.0            0.0             0.0
3.0                  0.0          0.0            0.0             0.0
4.0                  0.0          0.0            0.0             0.0
5.0                  0.0          0.0            0.0             0.0

output: image


ts-raster also supports:

  • creation of tiff file as an output containing each feature
  • random sampling from raster images using a vector file (GeoJson or Shapefile) for masking is required.
  • training and testing machine learning models (random forest, xgboost, elasticnet)


The current version of ts-raster extracts only 4 features but can be customized by the user. Read up the list of features that can be extracted by follow this link and customize the CalculateFeatures function under Modify the list under fc_parameters as needed.

Project details

Release history Release notifications

This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
tsraster-0.14-py3-none-any.whl (8.8 kB) Copy SHA256 hash SHA256 Wheel py3 Sep 16, 2018
tsraster-0.14.tar.gz (8.6 kB) Copy SHA256 hash SHA256 Source None Sep 16, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page