Classification with machine learning in GRASS GIS

To illustrate how to run machine learning methods in a GRASS GIS session we perform a climatic characterisation of Europe using the ECA&D data. The scope is to approximate a Koeppen-Geiger climate classification (screenshot of global map) using ECA&D data. The Koeppen-Geiger climate classification is one of the most widely used climate classification systems.

Method overview

  1. extract 1200 random Koeppen-Geiger points in Europe (from Chen et al. 2013) describing the climate class at that point
  2. sample further ECA&D variables at point positions and save to table
  3. convert Koeppen-Geiger class names to numeric IDs
  4. rasterize these sampling points
  5. install and run, with RandomForestClassifier
  6. generate Koeppen-Geiger climatic raster map based on ECAD
  7. verify the result


  • Chen, D. and H. W. Chen, 2013: Using the Köppen classification to quantify climate variation and change: An example for 1901-2010. Environmental Development, 6, 69-79, DOI: 10.1016/j.envdev.2013.03.007,
  • Kottek, M., J. Grieser, C. Beck, B. Rudolf, and F. Rubel, 2006: World Map of the Köppen-Geiger climate classification updated. Meteorol. Z., 15, 259-263, DOI: 10.1127/0941-2948/2006/0130,,

Data download

  • CSV files for download
    • --> 3 files:
      • koeppen_geiger_colors.csv
      • koeppen_geiger_legend_2017.csv
      • koppen_1901-2010.tsv

Processing steps

GRASS GIS logo For the steps, read on in


The result obtained with RandomForest Classifier may look as follows:

Koeppen-Geiger classification based on ECA&D data (1981-2010)
Fig: Koeppen-Geiger classification based on ECA&D data (1981-2010)

Compare your result to the map published in Kottek, M. et al., 2006.

Please read on in