0% found this document useful (0 votes)
2 views13 pages

Raster Data Processing for NDVI Analysis

Uploaded by

Moore Mangezi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views13 pages

Raster Data Processing for NDVI Analysis

Uploaded by

Moore Mangezi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

GWANDA STATE UNIVERSITY

Department of Geomatics and Survey

Rater Data Processing

Instructor: Mr. N.S. Maphosa


3. Raster Data Processing

Learning Points :
1. Understand the need for algorithms
2. Case studies of raster data processing
3. Writing Pseudocode / Algorithms

• Given a problem that can be solved by a computer program, the first step is to
write steps that needs to be followed to solve the problem using a computer
program
• This can be done by writing an algorithm or pseudocode that will be converted
later into a computer program, say in the python programming language.
3. Writing Pseudocode / Algorithms

• Given a problem that can be solved by a computer program, the first step is to
write steps that needs to be followed to solve the problem using a computer
program
• This can be done by writing an algorithm or pseudocode that will be converted
later into a computer program, say in the python programming language.
3. Challenge : - to calculate and plot average normalized
difference vegetation index (NDVI) for Landsat Imagery

• In this challenge we wish to write an algorithm that plots NDVI for some Landsat
imagery.
• Thus it is important that we create a workflow from start to finish.
• Begin your process by pseudocoding - or writing out steps in plain English -
everything that you will need to do in order to get to your end goal.
3. Steps required to get data for one Landsat scene for a site

1. Get a list of GeoTIFF files in the directory for that scene.


2. Subset the list to just the files required to calculate NDVI.
3. Sort the list(!) so that the bands are in the right order.
3. Open and crop the data for one Landsat scene.

Now that you have the steps to get the data for one Landsat scene, you can
expand your pseudocode steps to include opening and cropping the data to the
site boundary.
1. Get a list of GeoTIFF files in the directory for that scene.
2. Subset the list to just the files required to calculate NDVI.
3. Sort the list(!) so that the bands are in the right order.
4. Open and crop the bands needed to calculate NDVI.
3. Calculate NDVI for one Landsat scene.

Last, you can expand your pseudocode to include using the bands that you
opened and cropped to calculate NDVI..
1. Get a list of GeoTIFF files in the directory for that scene.
2. Subset the list to just the files required to calculate NDVI.
3. Sort the list(!) so that the bands are in the right order.
4. Open and crop the bands needed to calculate NDVI.
5. Calculate average NDVI for that scene.
3. Calculate NDVI for one Landsat scene.

Expand Workflow to Include All Landsat Scenes for a Site


You have now identified the steps required to process a single Landsat scene (band).
Those steps now need to be repeated across all of the scenes for each site for a year.
Subset the list to just the files required to calculate NDVI.
1. 1. Get a list of all directories for the Landsat scenes for the site.
2. 2. For each directory, use the steps outlined previously for one site to calculate
NDVI for the data in that directory. (Grab the date associated with the NDVI
calculation.)
3. 3. Save NDVI values and the date for that directory - which represents the day
that Landsat scene was collected (there are some steps here that you need to flesh
out as well) - to a list or dataframe that contains average NDVI for each scene at
this site.
3. Expand Workflow to Include All Landsat Scenes for a Site
# Steps required to .process all Landsat scenes for a site
1. Get a list of all directories for the Landsat scenes for the site.
2. For each directory, use the steps outlined previously for one site to calculate NDVI for the
data in that directory. (Grab the date associated with the NDVI calculation.)
# Steps required to process one Landsat scene for a site
1. Get a list of GeoTIFF files in the directory for that scene.
2. Subset the list to just the files required to calculate NDVI.
3. Sort the list(!) so that the bands are in the right order.
4. Open and crop the bands needed to calculate NDVI.
5. Calculate average NDVI for that scene.
3. Save NDVI values and the date for that directory - which represents the day that Landsat
scene was collected (there are some steps here that you need to flesh out as well) - to a list or
dataframe that contains average NDVI for each scene at this site.
3. Add Multiple Sites Worth of Data to Your Workflow

• Above you begin to think about the steps associated with creating a workflow for:
• A single Landsat scene.
• A set of Landsat scenes for a particular site.
• But you want to do this for two or more sites. You are not sure if you will have more than
two sites but in this case you want to design a workflow that allows for two or more sites.
Add an additional layer to your pseudo code.
3. Add Multiple Sites Worth of Data to Your Workflow

• # Modular workflow for many sites


1. Get list of all directories and associated site names.
2. Open each site directory, get Landsat scenes, and calculate mean NDVI for each scene for
that site.
3. Capture results (including mean NDVI, date, and site name) to a list or dataframe.
4. Export dataframe with mean NDVI values to csv. (i.e. a “data product” output that you can
share with others)

# Create your plot!


3. Convert pseudocode to a python program for one
Landsat scene

• # Modular workflow for many sites


1. Get list of all directories and associated site names.
2. Open each site directory, get Landsat scenes, and calculate mean NDVI for each scene for
that site.
3. Capture results (including mean NDVI, date, and site name) to a list or dataframe.
4. Export dataframe with mean NDVI values to csv. (i.e. a “data product” output that you can
share with others)

# Create your plot!

You might also like