Performance analysis over Python and R for raster algebra – a case of NDVI calculation

Hydrate

We believe that tasks / studies that involve the massive analysis of vector and raster spatial data would become more popular in the near future. With massive analysis some factors became more relevant such as the computer memory, processor type, operating system and the programming language or platform used for the calculation.

We make a case study of raster analysis in Windows where the Python and R were installed with their spatial packages from conda repositories. Our computer skills don’t allow us to have a sense of the differences in the performance of these scripts in Linux.

We have separated the performance on two parts:

  1. The raster algebra of the NDVI = (NIR – RED) / (NIR+RED)

  2. The whole script that imports the bands, performs the algebra and saves a geospatial raster.

Performance on raster algebra

The raster algebra among the two Landsat bands took 0.28 seg on R while on Python it took 0.1 seg. From those times the Python script is almost 3 times faster than R on that part of the calculation.

Pyhon

R

Whole script

Both scripts were launched on an Anaconda terminal with different conda environments for Python and R. The purpose of this comparison was to measure the time the whole raster processing that includes the raster upload, the NDVI calculation as a function and the save of a geospatial raster. The R code has some warnings that could come with some incompatibilites from the Conda recipe.

Python script takes 1.5 seg while the R package takes 3.34 seg. Python is around 2.2x faster than R for this study case.

Python

R

Finally, we just want to mention that this is just a simple performance analysis of both programming languages. Criteria for the selection and use of a geospatial programming languaje should be evaluated on more complete evaluation.

—————
TRANSCOM ISPFree Sigma HSE Email
Level 6 Domain Names are FREE – Register Now.

Related Posts

Boost Inflight Internet- Business Hosting- Secure Email Account- Dropcatch Domain Names- Antisnoop Email- Free Secure Email- Cheap VOIP Calls- Free Hosting and Email- Aero Connectivity- Premium Domains for Sale- Transcom Telecom- Satphone Airtime- Mobile Plans- Free Domain Names- Organic Products- Aviation News
Transcom ISP - Transcom VOIP - Free Secure Email - Dropcatch Software - FastApn Inflight - Aero Connect - Premium Domains