• Overview
• Installation
• Get started
• Data collections available
• Foundational framework
• Comparison with similar R packages
• Future developments
• Citation
• Contributing
• Acknowledgments
modisfast
is an R package designed for easy and fast downloads and import of some widely-used satellite-derived environmental data, including MODIS Land products, VIIRS Land products, and [GPM])(https://gpm.nasa.gov/data/) products (Global Precipitation Measurement Mission).
modisfast
uses the abilities offered by the OPeNDAP framework (Open-source Project for a Network Data Access Protocol) to download a subset of Earth science 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.
modisfast
is hence particularly suited for retrieving MODIS or VIIRS data over long time series and over areas, rather than short time series and points.
Below is a comparison of modisfast with other packages available for downloading chunks of MODIS or VIIRS data :
Package | Data | Available on CRAN | Utilizes open standards for data access protocols | Spatial subsetting* | Dimensional subsetting* | Maximum area size allowed for download | Speed |
---|---|---|---|---|---|---|---|
modisfast |
MODIS, VIIRS, GPM | ✅ | ✅ | ✅ | ✅ | unlimited | ✅ |
appeears |
MODIS, VIIRS, and many others | ✅ | ✅ | ✅ | ✅ | unlimited | variable |
MODISTools |
MODIS, VIIRS | ✅ | ❌ | ✅ | ✅ | 200 km x 200 km | ✅ |
rgee |
MODIS, VIIRS, GPM, and many others | ✅ | ❌ | ✅ | ✅ | unlimited | not tested |
MODIStsp |
MODIS | ❌ | ❌ | ✅ | unlimited | NA | |
MODIS |
MODIS | ❌ | ❌ | ❌ | ❌ | NA | NA |
* at the downloading phase
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")
Accessing and opening MODIS data with modisfast
is a simple 3-steps workflow, as shown in the example below. This example shows how to download 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 = T)
3/ And finally, open the data in R as a terra::SpatRaster
object using the function mf_import_data()
( ⚠️ 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)))
et voilà !
Want more examples ? modisfast
provides three long-form documentations and examples to learn more about the package :
modisfast
(for multi-time frame or multi-regions data access);Currently modisfast
supports download of 77 data collections, extracted from the following meta-collections :
In addition, modisfast
supports download of the following satellite-derived environmental data :
Details of each product available for download are provided in the tables below or through the function mf_list_collections()
. Want more details on a specific collection ? Click on the “DOI” column !
modisfast
is an R wrapper for OPeNDAP (Open-source Project for a Network Data Access Protocol). When utilized by data providers, such as those managing many NASA datasets, OPeNDAP allows for subsetting portions of Earth observation cubes based on any dimension by specifying filters in a URL. modisfast
facilitates this process by constructing the URL based on the spatial, temporal, and dimensional filters provided by the user in the function mf_get_url()
.
Let’s take an example to understand.
The following URL ⬇️
https
provides a link to download the MOD11A2.061 data in netCDF, subsetted for :
The indices within the []
refer to values encoding for the spatial and temporal filters.
These OPeNDAP URLs are not trivial to build. modisfast
converts the spatial, temporal and dimensional filters (R objects) provided by the user through the function mf_get_url()
into the appropriate OPeNDAP URL(s). Subsequently, the function mf_download_data()
allows for downloading the data using the httr
and parallel
packages.
There are other R packages available for accessing MODIS data. These include :
Take a look at the article “Comparison of performance with other similar R packages” to get an overview of how modisfast
compares to these packages in terms of data access time.
Future developments of the package may include access to additional data collections from other OPeNDAP servers, and support for a variety of data formats as they become available from data providers through their OPeNDAP servers. Furthermore, the creation of an RShiny application on top of the package is being considered, as a means of further simplifying data access for users with limited coding skills.
This package is licensed under a GNU General Public License v3.0 or later license.
We thank in advance people that use modisfast
for citing it in their work / publication(s). For this, please use the following citation :
Taconet, P. & Moiroux N.(2024). modisfast: Fast and Efficient Access to MODIS Earth Observation Data. In CRAN: Contributed Packages. The R Foundation. https://doi.org/10.32614/cran.package.modisfast
All types of contributions are encouraged and valued. For more information, check out our Contributor Guidelines.
Please note that the modisfast
project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
We thank NASA and its partners for making all their Earth science data freely available, and implementing open data access protocols such as OPeNDAP. modisfast
heavily builds on top of the OPeNDAP, so we thank the non-profit OPeNDAP, Inc. for developing the eponym tool in an open and collaborative way.
We also thank the contributors that have tested the package, reviewed the documentation and brought valuable feedbacks to improve the package : Florian de Boissieu, Julien Taconet, Nicolas Moiroux
The initial development and first release of this package were financed by the MIVEGEC unit of the French Research Institute for Sustainable Development, as part of the REACT project.
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.
The OPeNDAP, over which the package builds, is a project developed by the non-profit OPeNDAP, Inc. and advanced openly and collaboratively. By using this data access protocol, modisfast
support the open-source-software movement.