Temporal Difference Plot

Install pontiPy from TestPyPi Server through pip

In [1]:
# !pip install -i https://test.pypi.org/simple/ pontiPy==2.4

Import pontiPy

In [2]:
from pontiPy import *

Dependencies

In [3]:
import pandas as pd
import plotly.express as px

pontiPy + MapBiomass

Confusion Matrix (1985-1986)

In [5]:
display(df)
Forest Natural Agriculture NonVegetated Water NotObserved
Forest 595909521 202111 1123311 24087 254515 108
Natural 338378 57102895 171374 21774 180725 128
Agriculture 1090229 400869 175958382 116476 38080 74
NonVegetated 10149 12805 111343 2789543 7650 209
Water 66613 20937 11085 2131 15216393 65
NotObserved 126 78 86 147 603 22370

pontiPy + MapBiomass

Create a pontiPy Change Object

In [6]:
matrix_85_86 = pontiPy_Change(df)

Generate Change Matrix

In [7]:
matrix_85_86.matrix()
Out[7]:
Forest Natural Agriculture NonVegetated Water NotObserved Sum Loss
Forest 595909521 202111 1123311 24087 254515 108 597513653 1604132
Natural 338378 57102895 171374 21774 180725 128 57815274 712379
Agriculture 1090229 400869 175958382 116476 38080 74 177604110 1645728
NonVegetated 10149 12805 111343 2789543 7650 209 2931699 142156
Water 66613 20937 11085 2131 15216393 65 15317224 100831
NotObserved 126 78 86 147 603 22370 23410 1040
Sum 597415016 57739695 177375581 2954158 15697966 22954 851205370 4206266
Gain 1505495 636800 1417199 164615 481573 584 4206266

Workflow

Matrix Extraction

Matrices retrieved from MapBioMas Website for 1985-2019


Calculate Metrics

Calculate metrics for each yearly interval


Plot

Compile everything into a stacked bar chart


Matrix Extraction

Extracted from MapBiomas Platfrom

Calculate Metrics

Quantity

In [8]:
matrix_85_86.quantity()
Out[8]:
403201

Exchange

In [9]:
matrix_85_86.exchange()
Out[9]:
3398498

Shift

In [10]:
matrix_85_86.shift()
Out[10]:
2103816.0

Yearly Temporal Difference
(1985-2019)

Five-Year Temporal Differencee
(1985-2019)

Documentation

Thank You
Questions?