Download MODIS Aqua NDVI/EVI data from NASA EarthData, calculate the summertime average, and merge with either tract boundaries or population points.
Using the luna R package, greenness measures are downloaded from NASA's Moderate Resolution Imaging Spectroradiometer (MODIS) sensor on the Aqua satellite. We calculate summertime (warm-season) averages of two vegetation indices: NDVI (Normalized Difference Vegetation Index) and EVI (Enhanced Vegetation Index) using 16-day MODIS composites. These composites provide vegetation index estimates at approximately 250‑meter spatial resolution. St. Louis, Missouri and Suffolk County, MA are used as a demonstration areas for the NASA Earth Data query, data processing, and spatial aggregation.
When selecting a dataset for analysis of the relationship between greenness and health, there are several considerations, such as:
- Temporal Resolution: Since greenness does not tend to drastically change in the short term (unless there is an extraordinary event), a long temporal resolution is appropriate. The MODIS instrument takes measurements every 16 days, and we can use those measurements to calculate an annual summertime average.
- Time Span: Selecting a data resource is also informed by the time span available. Some research questions require an extensive historical data record spanning far into the past, and other times the most recent data is more pertinent. MODIS provides data spanning back to 2000.
- Spatial Resolution: MODIS provides data at a 250m resolution. Different data sources provide differing resolution, such as Landsat, which provides 30m resolution. This larger grid size can be advantageous, in that the storage and processing of less spatially resolved data will be less intensive.
- Spatial Extent: One of the key advantages for MODIS is its global spatial extent. As opposed to country-specific datasets, MODIS is available across all countries.
This repository provides code for analyzing two metrics of greenness: the Normalized Difference Vegetation Index (NDVI) and Enhanced Vegetation Index (EVI). There are minor differences between them, but both provide measures between -1 and +1. Areas with no greenness usually have values around 0.
This repository provides the building blocks for the query of any data from NASA EarthData using the luna package. Code for calculating summertime means from 16-day rasters and calculating annual metrics across administrative boundaries or individual points are also included, using the terra and sf packages. These satial aggregation methods can be used to derive measures from MODIS in analysis of sociodemographic disparities or epidemiologic studies of neighborhood greenness and health outcomes.
Please note that users will need to set up an account with NASA Earthdata for the API query to function effectively. For details about how to set up an account and access the necessary user ID and password inputs for the API query, please see: https://urs.earthdata.nasa.gov/users/new.
- This code was run to generate 10 years of greenness measures across St. Louis census tracts on a local machine. The use of a shared computing cluster would allow for more intensive computation to run more quickly and to run without the limits of conventional storage options on a single computer.
- Each downloaded raster file covers a roughly 1200km by 1200km grid, which takes up about 100MB of storage before clipping to a smaller area. If downloading long periods of time or a large spatial area, you may encounter storage considerations.
Five scripts are included in the code repository.
- 00_Download_MODIS_NDVI_EVI.R applies the luna package to query 16-day MODIS data from NASA Earthdata.
- 01_Calculate_Summer_Mean_NDVI.R masks pixels in each raster with poor quality, then calculates one raster per year containing mean summertime NDVI/EVI.
- 02_Join_MODIS_to_Pts.R extracts greenness values for a given set of points and converts them into a longitudinal format, ideal for cohort studies with geocoded addresses.
- 03A_MODIS_Extraction_Pts.R is the first in a two-step process for aggregating the summertime mean rasters to administrative boundaries.
- A fishnet approach is used, where a grid of points is established and the merged with points representing the spatial extent of the administrative boundaries for the area of interest.
- This is set as a separate file because it can be very time consuming with a highly spatially resolved raster.
- More details about the use of a fishnet for spatial aggregation of raster data can be found here: https://github.com/Climate-CAFE/population_weighting_raster_data
- 03B_Aggregate_MODIS_NDVI_UseFishnet.R uses the fishnet gred set up in script 3 and merges the grid with centroids for the administrative boundaries.
- Spatially weighted averages across the administrative boundaries are computed from the extraction points.
- The resulting output is a dataframe with administrative boundaries and a time series of annual NDVI and EVI.
Packages used in this repository include:
- library("luna") for MODIS data query
- library("terra") for raster data
- library("sf") for vector data
- library("tidyverse") for data management
- library("lwgeom") for spatial data management
- library("tigris") if downloading US administrative boundaries
luna package: https://github.com/rspatial/luna