laads

Build Status Build status codecov.io

laads is under development (and not really usable yet) and will provide an interface to the NASA API of MODIS Level 1 and Atmosphere data products.

library("laads")
library("dplyr")

The functions of the package mimick the API methods. The documentation is often a copy of the parameters or API methods documentation. Further below a few workflow examples are given in order to help navigating the different functions.

A bit of information about the API

What data is accessible via the LAADS API

From the FAQ, "LAADS is being populated with large volumes of MODIS data from the NASA EOS Terra and Aqua spacecrafts as they are produced. These data include Collection 5 and some earlier data from Collection 3 & 4 such as Aqua/Terra Atmosphere Level 2 & 3 products. New Collection 6 MODIS Aqua Level 1 and Level 2 Atmosphere products are available while all Terra and rest of Aqua products will be included soon. LAADS also provide access to MODIS Airborne Simulator (MAS) data (via FTP only; not searchable), NPP VIIRS Level 1, Level 2, and Level 3 products, and ENVISAT MERIS Level 1B Full Resolution (FR) and Reduced Resolution (RR) data sets from European Space Agency (ESA)."

If this does not include the data you are looking for, have a look at the MODISTools package that supports retrieving and using MODIS data subsets using ORNL DAAC web service (SOAP) for subsetting from Oak Ridge National Laboratory (ORNL).

How is the data organized

The data is organized by satellite instrument / product / collection / file: each instrument provides different products whose files are organized in different collections. The goal of the package is to help getting the files.

A type of product, for instance Aerosol Optical Density with a given resolution, can be produced by several satellites.

Some files are available online, other have to be ordered. At some point the ordering function will be available in this package.

How to cite the data when using it

For knowing how to cite the data when using it, please see this document.

Workflow example

Getting files for aerosol optical density near Hyderabad

Context: say we want to get Aerosol Optical Density data for a rectangle 17 N to 18 N latitude, 78 E to 79 E longitude, with 3km resolution, for one day of January in 2015.

The first step will be to look for a product that corresponds to this.

laads_search_datasets(keywords = "aerosol") %>%
  knitr::kable()

Two satellites provides "Aerosol 5-Min L2 Swath 3km". The corresponding products are "MYD04_3K" (from the Aqua satellite) and "MOD04_3K" (from the Terra satellite).

We will now search the corresponding files.

files <- laads_search_files(product = c("MYD04_3K", "MOD04_3K"),
                   start_time = "2015-01-01",
                   end_time = "2015-01-02",
                   coords_or_tiles = "coords",
                   south = 17, north = 18,
                   east = 79, west = 78) 
knitr::kable(files)

As you see, the search function only gives files IDs, nothing else. For getting more information about these files before trying to download them, for instance for knowing if they are available online, we will use another function.

properties <- laads_file_properties(files$file_id) 
head(properties) %>%
  knitr::kable()
all(properties$online == TRUE)

Now we can get their URL using laads_file_urls.

urls <- laads_file_urls(files$file_id) 
head(urls) %>%
  knitr::kable()

Then one can use them for downloading files via download.file and further process them (story to be continued).

library(gdalUtils)
file_to_download <- urls$file_url[1]
download.file(file_to_download, destfile = "test.hdf")
gdalinfo("test.hdf")
sds <- get_subdatasets("MOD17A3H.A2000001.h21v09.006.2015141183401.hdf")
sds
file.remove(file_to_download)


maelle/laads documentation built on May 20, 2019, 4:09 p.m.