This is a Python script for use in the field of land change science. It performs Markov and Flow calculations on a given transition matrix.
MarkovAndFlowScript.py is a python script file which takes as an input a “TransitionMatrix.csv” file containing a land cover transition matrix between two time points (this file must be formatted correctly – see the TransitionMatrix.csv read me file.) The script file outputs a “MatrixOutput.csv” file with information related to Markov and Flow matrices for this land cover change.
IMPORTANT!!
- You must change the folderpath variable (in line 16) near the top of the script to point to the file directory containing your python script and the TransitionMatrix.csv file.
Other important points:
-
Keep the TransitionMatrix.csv file in the same directory as your python script.
-
If necessary, uncomment and change the folderpath variable at the top of the script to the file path where your “TransitionMatrix.csv” file is located.
-
You must have certain Python libraries installed for this script to work, notably sys, string, csv, and numpy. If necessary, uncomment the “sys.path.append…” line at the top of the script to point to where your downloaded libraries are. Numpy library available here: http://www.numpy.org/
-
Youtube video available here: http://www.youtube.com/watch?v=UD9ZTW7rFE0
-
Download link for related files: https://drive.google.com/file/d/1INu3xGDxrnsqnbH5bOMbDws1eqQRnfJD/view?usp=sharing This includes a chart template, other sample input transition matrix files, and read-me files for the script itself, the input TransitionMatrix.csv file, and the output MatrixOutput.csv file.