SkillAgentSearch skills...

Modisfast

Fast and efficient access to MODIS, VIIRS and GPM Earth Observation data with R

Install / Use

/learn @ptaconet/Modisfast

README

<!-- README.md is generated from README.Rmd. Please edit that file -->

modisfast <a href="https://github.com/ptaconet/modisfast"><img src="man/figures/logo.png" align="right" height="138" /></a>

<!-- <img src="man/figures/logo.png" align="right" /> --> <!-- badges: start -->

licence CRAN_Status_Badge Github_Status_Badge R-CMD-check DOI CRAN_downloads

<!-- [![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/ptaconet/modisfast/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/ptaconet/modisfast) --> <!-- [![DOI-zenodo](https://zenodo.org/badge/doi/10.5281/zenodo.8475.svg)](https://doi.org/10.5281/zenodo.12772739) --> <!-- badges: end -->

Table of contents

<p align="left">

<a href="#overview">Overview</a><br><a href="#installation">Installation</a><br><a href="#get-started">Get started</a><br><a href="#collections-available-in-modisfast">Data collections available</a><br><a href="#manual-testing-of-the-functionality">Manual testing of the functionality</a><br><a href="#foundational-framework">Foundational framework</a><br><a href="#comparison-with-similar-r-packages">Comparison with similar R packages</a><br><a href="#citation">Citation</a><br><a href="#future-developments">Future developments</a><br><a href="#contributing">Contributing</a><br><a href="#acknowledgments">Acknowledgments</a><br>

</p>

News

2025-09-17 : IMPORTANT NOTIFICATION : Due to major recent migrations of NASA’s servers (details here), modisfast will be temporarily unavailable in the coming months. Work is in progress to connect modisfast to the new NASA OPeNDAP servers.

Overview

modisfast is an R package designed for easy and fast downloads of MODIS Land products, VIIRS Land products, and GPM (Global Precipitation Measurement Mission) Earth Observation data.

modisfast uses the abilities offered by the OPeNDAP framework (Open-source Project for a Network Data Access Protocol) to download a subset of Earth Observation data cube, along spatial, temporal or any other data dimension (depth, …). This way, it reduces downloading time and disk usage to their minimum : no more 1° x 1° MODIS tiles with 10 bands when your region of interest is only 30 km x 30 km wide and you need 2 bands ! Moreover, modisfast enables parallel downloads of data.

This package is hence particularly suited for retrieving MODIS or VIIRS data over long time series and over areas, rather than short time series and points.

Importantly, the robust, sustainable, and cost-free foundational framework of modisfast, both for the data provider (NASA) and the software (R, OPeNDAP, the tidyverse and GDAL suite of packages and software), guarantees the long-term reliability and open-source nature of the package.

By enabling to download subsets of data cubes, modisfast facilites the access to Earth science data for R users in places where internet connection is slow or expensive and promotes digital sobriety for our research work.

Installation

You can install the released version of modisfast from CRAN with :

install.packages("modisfast")

or the development version (to get a bug fix or to use a feature from the development version) with :

if(!require(devtools)){install.packages("devtools")}
devtools::install_github("ptaconet/modisfast")

Get Started

Accessing and opening MODIS data with modisfast is a simple 3-steps workflow. This example shows how to download and import a one-year-long monthly time series of MODIS Normalized Difference Vegetation Index (NDVI) at 1 km spatial resolution over the whole country of Madagascar.

1/ First, define the variables of interest (ROI, time frame, collection, and bands) :

# Load the packages
library(modisfast)
library(sf)
library(terra)

# ROI and time range of interest
roi <- st_as_sf(data.frame(id = "madagascar", geom = "POLYGON((41.95 -11.37,51.26 -11.37,51.26 -26.17,41.95 -26.17,41.95 -11.37))"), wkt = "geom", crs = 4326) # a ROI of interest, format sf polygon
time_range <- as.Date(c("2023-01-01", "2023-12-31")) # a time range of interest

# MODIS collections and variables (bands) of interest
collection <- "MOD13A3.061" # run mf_list_collections() for an exhaustive list of collections available
variables <- c("_1_km_monthly_NDVI") # run mf_list_variables("MOD13A3.061") for an exhaustive list of variables available for the collection "MOD13A3.061"

2/ Then, get the URL of the data and download them :

## Login to Earthdata servers with your EOSDIS credentials.
# To create an account (free) go to : https://urs.earthdata.nasa.gov/.
log <- mf_login(credentials = c("username", "password")) # set your own EOSDIS username and password

## Get the URLs of the data
urls <- mf_get_url(
  collection = collection,
  variables = variables,
  roi = roi,
  time_range = time_range
)

## Download the data. By default the data is downloaded in a temporary directory, but you can specify a folder
res_dl <- mf_download_data(urls, parallel = TRUE)

3/ And finally, import the data in R as a terra::SpatRaster object using the function mf_import_data() ( :warning: see here why you should use this function, instead of the original terra::rast(), in the context of modisfast) :

r <- mf_import_data(
  path = dirname(res_dl$destfile[1]),
  collection = collection,
  proj_epsg = 4326
)

terra::plot(r, col = rev(terrain.colors(20)))
<figure> <img src=".Rplot_readme.png" alt="Time series of monthly 1-km MODIS NDVI over Madagascar for the year 2023, retrieved with modisfast" /> <figcaption aria-hidden="true">Time series of monthly 1-km MODIS NDVI over Madagascar for the year 2023, retrieved with <code>modisfast</code></figcaption> </figure>

et voilà !

Want more examples ? modisfast provides three long-form documentations and examples to learn more about the package :

<!-- ## Objectives modisfast provides an entry point to some specific OPeNDAP servers (e.g. MODIS, VNP, GPM or SMAP) via HTTPS. The development of the package was motivated by the following reasons : * **Providing a simple and single way in R to download data stored on heterogeneous servers** : People that use Earth science data often struggle with data access. In modisfast we propose a harmonized way to download data from various providers that have implemented access to their data through OPeNDAP. * **Fastening the data import phase**, especially for large time series analysis. Apart from these performance aspects, ethical considerations have driven the development of this package : * **Facilitating the access to Earth science data for R users in places where internet connection is slow or expensive** : Earth science products are generally huge files that can be quite difficult to download in places with slow internet connection, even more if large time series are needed. By enabling to download strictly the data that is needed, the products become more accessible in those places; * **Caring about the environmental digital impact of our research work** : Downloading data has an impact on environment and to some extent contributes to climate change. By downloading only the data that is need (rather than e.g a whole MODIS tile, or a global SMAP or GPM dataset) we somehow promote digital sobriety. * **Supporting the open-source-software movement** : The OPeNDAP is developed and advanced openly and collaboratively, by the non-profit [OPeNDAP, Inc.](https://www.opendap.org/about/) This open, powerfull and standard data access protocol is more and more used, by major Earth science data providers (e.g. NASA or NOAA). Using OPeNDAP means supporting methods for data access protocols that are open, build collaboratively and shared. --> <!-- ## Citation We thank in advance people that use `modisfast` for citing it in their work / publication(s). For this, please use the citation provided at this link [zenodo link to add] or through `citation("modisfast")`. -->

Collections available in modisfast

Currently modisfast supports download of 69 data collections, extracted from the following meta-collections :

Related Skills

View on GitHub
GitHub Stars41
CategoryDevelopment
Updated1mo ago
Forks5

Languages

R

Security Score

95/100

Audited on Feb 12, 2026

No findings