Chapter 7 NASA’s Earth Observing System (EOS)

Estimated Time: 3 hours

7.1 Learning Objectives

  • Describe the mission of NASA EOS
  • Describe the roles of DAACs in distributing data
  • Interact with the AppEEARS API to query the list of available products
  • Submit and download submitting a point and area sample requests, download the request
  • Filter data based on quality

7.2 NASA EOS Project Mission & Design

NASA’s Earth Observing System (EOS) is a coordinated series of polar-orbiting and low inclination satellites for long-term global observations of the land surface, biosphere, solid Earth, atmosphere, and oceans. As a major component of the Earth Science Division of NASA’s Science Mission Directorate, EOS enables an improved understanding of the Earth as an integrated system.

Review NASA EOS’s Mission Profile

  • Completed Missions

  • Current Missions

  • Future Missions

Credit: NASA’s Goddard Space Flight Center

7.3 NASA EOS Earth Data Account:

The EOSDIS Earthdata Login provides a centralized and simplified mechanism for user registration and profile management for all EOSDIS system components. End users may register and edit their profile information in one location allowing them access to the wide array of EOSDIS data and services. The EOSDIS Earthdata Login also helps the EOSDIS program better understand the user demographics and access patterns in support of planning for new value-added features and customized services that can be directed to specific users or user groups resulting in better user experience.

Earthdata Login provides user registration and authentication services and a common set of user information to all EOSDIS data centers in a manner that permits the data center to integrate their additional requirements with the Earthdata Login services. Below is a brief description of services provided by the Earthdata Login.

7.4 NASA EOS Coding Assignment 1

Suggested completion: following lecture 1 on NASA EOS

To submit via BBLearn:

  1. Follow the steps in the NASA EOSDIS documentation to sign up for an Earth Data account.

  2. Write an R script that stores your user and password called EARTHDATA_Token.R and submit the following line of code via .Rmd and PDF:

source('./Tokens/EARTHDATA_Token.R') #path will change based on where you stored it
exists('user')

7.5 Distributed Active Archive Centers

7.5.1 LP DAAC

The Land Processes Distributed Active Archive Center (LP DAAC) is one of several discipline-specific data centers within the NASA EOS Data and Information System (EOSDIS). The LP DAAC operates as a partnership between the U.S. Geological Survey (USGS) and the National Aeronautics and Space Administration (NASA). Data specialists, system engineers, user service representatives, and science communicators work in collaboration to support LP DAAC activities.

Watch this 4:02 minute video on LP DAAC’s 2019-2021 Prosectus

7.6 The LPDAAC Mission: Process, Archive, Distribute, Apply

The LP DAAC processes, archives, and distributes land data products to hundreds of thousands of users in the earth science community. Land data products are made universally accessible and support the ongoing monitoring of Earth’s land dynamics and environmental systems to facilitate interdisciplinary research, education, and decision-making.

Process: Raw data collected from specific satellite sensors, such as ASTER onboard NASA’s Terra satellite, are received and processed into a readable and interpretable format here at the LP DAAC, while other data undergo processing in other facilities around the country before arriving to the LP DAAC to be archived and distributed to the public.

Archive: The LP DAAC continually archives a wide variety of land remote sensing data products collected by sensors onboard satellites, aircraft, and the International Space Station (ISS). The archive currently totals more than 3.5 petabytes of data, the equivalent of listening to 800 million songs, and distributes data to over 200,000 global users.

Distribute: All data products in the archive are distributed free of charge through NASA Earthdata Search and USGS EarthExplorer search and download clients. The LP DAAC also supports tools and services, like the Application for Extracting and Exploring Analysis Ready Samples (AppEEARS), which allows users to transform and visualize data before download while offering enhanced subsetting and reprojecting capabilities.

7.6.1 How you can use LP DAAC’s data

Watch this 2:13 minute long video on searching for data at the LP DAAC

7.7 AppEEARS

The Application for Extracting and Exploring Analysis Ready Samples (AppEEARS) offers a simple and efficient way to access and transform geospatial data from a variety of federal data archives in an easy-to-use web application interface. AppEEARS enables users to subset geospatial data spatially, temporally, and by band/layer for point and area samples. AppEEARS returns not only the requested data, but also the associated quality values, and offers interactive visualizations with summary statistics in the web interface. The AppEEARS API offers users programmatic access to all features available in AppEEARS, with the exception of visualizations. The API features are demonstrated in this tutorial.

7.8 Hands on: Pulling AppEEARS Data via the API

The following section was adapted from LPDAAC’s E-Learning Tutorials on the AppEEARS API and modified to request data for NEON sites.

Contributing Authors: Material written by Mahsa Jami1 and Cole Krehbiel1
Contact:
Voice: +1-866-573-3222
Organization: Land Processes Distributed Active Archive Center (LP DAAC)
Website: https://lpdaac.usgs.gov/
Date last modified: 06-12-2020

1 KBR, Inc., contractor to the U.S. Geological Survey, Earth Resources Observation and Science (EROS) Center,
Sioux Falls, South Dakota, USA. Work performed under USGS contract G15PD00467 for LP DAAC2.

2 LP DAAC Work performed under NASA contract NNG14HH33I.

Run the following chunk to install any packages you will need for this section:

7.9 Getting Started with the AppEEARS API (Point Request)


This section demonstrates how to use R to connect to the AppEEARS API The Application for Extracting and Exploring Analysis Ready Samples (AppEEARS) offers a simple and efficient way to access and transform geospatial data from a variety of federal data archives in an easy-to-use web application interface. AppEEARS enables users to subset geospatial data spatially, temporally, and by band/layer for point and area samples. AppEEARS returns not only the requested data, but also the associated quality values, and offers interactive visualizations with summary statistics in the web interface. The AppEEARS API offers users programmatic access to all features available in AppEEARS, with the exception of visualizations. The API features are demonstrated in this tutorial.


7.9.1 Example: Submit a point request for multiple NEON sites to extract vegetation and land surface temperature data

In this tutorial, Connecting to the AppEEARS API, querying the list of available products, submitting a point sample request, downloading the request, working with the AppEEARS Quality API, and loading the results into R for visualization are covered. AppEEARS point requests allow users to subset their desired data using latitude/longitude geographic coordinate pairs (points) for a time period of interest, and for specific data layers within data products. AppEEARS returns the valid data from the parameters defined within the sample request.

7.9.1.1 Data Used in the Example:

  • Data layers:
    • Combined MODIS Leaf Area Index (LAI)
    • Terra MODIS Land Surface Temperature
      • MOD11A2.006, 1000m, 8 day: ‘LST_Day_1km’, ‘LST_Night_1km’

7.10 Topics Covered in this section:

  1. Getting Started

    1a. Load Packages

    1b. Set Up the Output Directory

    1c. Login

  2. Query Available Products

    2a. Search and Explore Available Products

    2b. Search and Explore Available Layers

  3. Submit a Point Request

    3a. Compile a JSON Object

    3b. Submit a Task Request

    3c. Retrieve Task Status

  4. Download a Request

    4a. Explore Files in Request Output

    4b. Download Files in a Request (Automation)

  5. Explore AppEEARS Quality API

    5a. List Quality Layers

    5b. Show Quality Values

    5c. Decode Quality Values

  6. BONUS: Load Request Output and Visualize

    6a. Load CSV

    6b. Plot Results (Line/Scatter Plots)


7.10.1 Prerequisites:

  • A NASA Earthdata Login account is required to login to the AppEEARS API and submit a request . You can create an account at the link provided.

  • R and RStudio. These tutorials have been tested on Windows and MAC systems using R Version 4.0.0, RStudio version 1.1.463, and the specifications listed below.

    • Required packages:
      • getPass
      • httr
      • jsonlite
      • warnings
    • To read and visualize the tabular data:
      • dplyr
      • tidyr
      • readr
      • ggplot2

7.10.1.1 Getting Started:

  1. Clone/download AppEEARS API Getting Started in R Repository from the LP DAAC Data User Resources Repository or pull code from this textbook.

  2. If you opted to clone LP DAAC’s repo open the AppEEARS_API_R.Rproj file to directly open the project. Next, select the AppEEARS_API_Point_R.Rmd from the files list and open it.


7.10.2 AppEEARS Information:

To access AppEEARS, visit: https://lpdaacsvc.cr.usgs.gov/appeears/.

For comprehensive documentation of the full functionality of the AppEEARS API, please see the AppEEARS API Documentation.


7.11 Getting Started with the AppEEARS API

7.11.2 Set Up the Output Directory

Set your input directory, and create an output directory for the results.


7.11.3 Login to Earth Data

To submit a request, you must first login to the AppEEARS API. Use your private R Script to enter your NASA Earthdata login Username and Password.

## [1] TRUE

Decode the username and password to be used to post login request.

Next, assign the AppEEARS API URL to a static variable.

Use the httr package to post your username and password. A successful login will provide you with a token to be used later in this tutorial to submit a request. For more information or if you are experiencing difficulties, please see the API Documentation.

## {
##     "token_type": "Bearer",
##     "token": "qHEa7l-TJQmr9LTGwqgchMg2v9_Xhnuz3ADxZRwYkNOg8CBxwXNZ7H-WgmB9FY2STOltNjK1KRNzWjRKqHNSjA",
##     "expiration": "2021-02-14T17:41:11Z"
## }
## 

Above, you should see a Bearer token. Notice that this token will expire approximately 48 hours after being acquired.


7.13 Search and Explore Available Products

Create a list indexed by product name to make it easier to query a specific product.

## [1] "AppEEARS currently supports 122 products."

Next, look at the product’s names and descriptions. Below, the ‘ProductAndVersion’ and ‘Description’ are printed for all products.

## [1] "GPW_DataQualityInd.004 is Quality of Input Data for Population Count and Density Grids from SEDAC"
## [1] "GPW_UN_Adj_PopCount.004 is UN-adjusted Population Count from SEDAC"
## [1] "GPW_UN_Adj_PopDensity.004 is UN-adjusted Population Density from SEDAC"
## [1] "MCD12Q1.006 is Land Cover Type from LP DAAC"
## [1] "MCD12Q2.006 is Land Cover Dynamics from LP DAAC"
## [1] "MCD15A2H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MCD15A3H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MCD43A1.006 is Bidirectional Reflectance Distribution Function (BRDF) and Albedo from LP DAAC"
## [1] "MCD43A3.006 is Bidirectional Reflectance Distribution Function (BRDF) and Albedo from LP DAAC"
## [1] "MCD43A4.006 is Bidirectional Reflectance Distribution Function (BRDF) and Albedo from LP DAAC"
## [1] "MCD64A1.006 is Burned Area (fire) from LP DAAC"
## [1] "MOD09A1.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MOD09GA.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MOD09GQ.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MOD09Q1.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MOD10A1.005 is Snow Cover from NSIDC DAAC"
## [1] "MOD10A1.006 is Snow Cover (NDSI) from NSIDC DAAC"
## [1] "MOD10A2.005 is Snow Cover from NSIDC DAAC"
## [1] "MOD10A2.006 is Snow Cover from NSIDC DAAC"
## [1] "MOD11A1.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MOD11A2.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MOD13A1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD13A2.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD13A3.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD13Q1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD14A2.006 is Thermal Anomalies and Fire from LP DAAC"
## [1] "MOD15A2H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MOD16A2.006 is Evapotranspiration (ET & LE) from LP DAAC"
## [1] "MOD16A2GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MOD16A3GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MOD17A2H.006 is Gross Primary Productivity (GPP) from LP DAAC"
## [1] "MOD17A2HGF.006 is Gross Primary Productivity (GPP) from LP DAAC"
## [1] "MOD17A3HGF.006 is Net Primary Production (NPP) Gap-Filled from LP DAAC"
## [1] "MOD44B.006 is Vegetation Continuous Fields (VCF) from LP DAAC"
## [1] "MOD44W.006 is Land/Water Mask from LP DAAC"
## [1] "MODOCGA.006 is Ocean Reflectance Bands 8-16 from LP DAAC"
## [1] "MODTBGA.006 is Thermal Bands and Albedo from LP DAAC"
## [1] "MYD09A1.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MYD09GA.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MYD09GQ.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MYD09Q1.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MYD10A1.005 is Snow Cover from NSIDC DAAC"
## [1] "MYD10A1.006 is Snow Cover (NDSI) from NSIDC DAAC"
## [1] "MYD10A2.005 is Snow Cover from NSIDC DAAC"
## [1] "MYD10A2.006 is Snow Cover from NSIDC DAAC"
## [1] "MYD11A1.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD11A2.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD13A1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD13A2.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD13A3.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD13Q1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD14A2.006 is Thermal Anomalies and Fire from LP DAAC"
## [1] "MYD15A2H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MYD16A2.006 is Evapotranspiration (ET & LE) from LP DAAC"
## [1] "MYD16A2GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MYD16A3GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MYD17A2H.006 is Gross Primary Productivity (GPP) from LP DAAC"
## [1] "MYD17A2HGF.006 is Gross Primary Productivity (GPP) Gap-Filled from LP DAAC"
## [1] "MYD17A3HGF.006 is Net Primary Production (NPP) Gap-Filled from LP DAAC"
## [1] "MYD21A1D.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD21A1N.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD21A2.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYDOCGA.006 is Ocean Reflectance Bands 8-16 from LP DAAC"
## [1] "MYDTBGA.006 is Thermal Bands and Albedo from LP DAAC"
## [1] "NASADEM_NC.001 is Elevation from LP DAAC"
## [1] "NASADEM_NUMNC.001 is Source from LP DAAC"
## [1] "SPL3SMP_E.004 is Enhanced L3 Radiometer Soil Moisture from NSIDC DAAC"
## [1] "SPL3SMP.007 is Soil Moisture from NSIDC DAAC"
## [1] "SPL4CMDL.005 is Carbon Net Ecosystem Exchange from NSIDC DAAC"
## [1] "SPL4SMGP.005 is Surface and Root Zone Soil Moisture from NSIDC DAAC"
## [1] "SPL3FTP.003 is Freeze/Thaw State from NSIDC DAAC"
## [1] "SRTMGL1_NC.003 is Elevation (DEM) from LP DAAC"
## [1] "SRTMGL1_NUMNC.003 is Source (DEM) from LP DAAC"
## [1] "SRTMGL3_NC.003 is Elevation (DEM) from LP DAAC"
## [1] "SRTMGL3_NUMNC.003 is Source (DEM) from LP DAAC"
## [1] "ASTGTM_NC.003 is Elevation from LP DAAC"
## [1] "ASTGTM_NUMNC.003 is Source from LP DAAC"
## [1] "ASTWBD_ATTNC.001 is Water Bodies Database Attributes from LP DAAC"
## [1] "ASTWBD_NC.001 is Water Bodies Database Elevation from LP DAAC"
## [1] "VNP09H1.001 is Surface Reflectance from LP DAAC"
## [1] "VNP09A1.001 is Surface Reflectance from LP DAAC"
## [1] "VNP09GA.001 is Surface Reflectance from LP DAAC"
## [1] "VNP13A1.001 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "VNP13A2.001 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "VNP13A3.001 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "VNP14A1.001 is Thermal Anomalies/Fire from LP DAAC"
## [1] "VNP15A2H.001 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "VNP21A1D.001 is Land Surface Temperature & Emissivity Day (LST&E) from LP DAAC"
## [1] "VNP21A1N.001 is Land Surface Temperature & Emissivity Night (LST&E) from LP DAAC"
## [1] "VNP21A2.001 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "VNP22Q2.001 is Global Land Surface Phenology (GLSP) from LP DAAC"
## [1] "VNP43IA1.001 is BRDF-Albedo Model Parameters from LP DAAC"
## [1] "VNP43IA2.001 is BRDF-Albedo Quality from LP DAAC"
## [1] "VNP43IA3.001 is Albedo (BRDF) from LP DAAC"
## [1] "VNP43IA4.001 is Nadir BRDF-Adjusted Reflectance from LP DAAC"
## [1] "VNP43MA1.001 is BRDF-Albedo Model Parameters from LP DAAC"
## [1] "VNP43MA2.001 is BRDF-Albedo Quality from LP DAAC"
## [1] "VNP43MA3.001 is Albedo (BRDF) from LP DAAC"
## [1] "VNP43MA4.001 is Nadir BRDF-Adjusted Reflectance from LP DAAC"
## [1] "CU_LC08.001 is CONUS Landsat 8 Surface Reflectance from USGS"
## [1] "CU_LE07.001 is CONUS Landsat 7 Surface Reflectance from USGS"
## [1] "CU_LT05.001 is CONUS Landsat 5 Surface Reflectance from USGS"
## [1] "CU_LT04.001 is CONUS Landsat 4 Surface Reflectance from USGS"
## [1] "AK_LC08.001 is Alaska Landsat 8 Surface Reflectance from USGS"
## [1] "AK_LE07.001 is Alaska Landsat 7 Surface Reflectance from USGS"
## [1] "AK_LT05.001 is Alaska Landsat 5 Surface Reflectance from USGS"
## [1] "AK_LT04.001 is Alaska Landsat 4 Surface Reflectance from USGS"
## [1] "HI_LC08.001 is Hawaii Landsat 8 Surface Reflectance from USGS"
## [1] "HI_LE07.001 is Hawaii Landsat 7 Surface Reflectance from USGS"
## [1] "HI_LT05.001 is Hawaii Landsat 5 Surface Reflectance from USGS"
## [1] "HI_LT04.001 is Hawaii Landsat 4 Surface Reflectance from USGS"
## [1] "DAYMET.003 is Daily Surface Weather Data for North America from ORNL"
## [1] "SSEBop_ET.004 is SSEBop Actual Evapotranspiration (ETa) from USGS"
## [1] "eMODIS_Smoothed_NDVI.001 is eMODIS Smoothed Normalized Difference Vegetation Index (NDVI) from USGS"
## [1] "ECO2LSTE.001 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "ECO2CLD.001 is Cloud Mask from LP DAAC"
## [1] "ECO3ETPTJPL.001 is Evapotranspiration PT-JPL from LP DAAC"
## [1] "ECO3ANCQA.001 is L3/L4 Ancillary Data Quality Assurance (QA) Flags from LP DAAC"
## [1] "ECO4ESIPTJPL.001 is Evaporative Stress Index PT-JPL from LP DAAC"
## [1] "ECO4WUE.001 is Water Use Efficiency from LP DAAC"
## [1] "ECO1BGEO.001 is Geolocation from LP DAAC"
## [1] "ECO1BMAPRAD.001 is Resampled Radiance from LP DAAC"

The product service provides many useful details, including if a product is currently available in AppEEARS, a description, and information on the spatial and temporal resolution. Below, the product details are retrieved using ‘ProductAndVersion’.

## [
##     {
##         "Product": "MCD15A3H",
##         "Platform": "Combined MODIS",
##         "Description": "Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR)",
##         "RasterType": "Tile",
##         "Resolution": "500m",
##         "TemporalGranularity": "4 day",
##         "Version": "006",
##         "Available": true,
##         "DocLink": "https://doi.org/10.5067/MODIS/MCD15A3H.006",
##         "Source": "LP DAAC",
##         "TemporalExtentStart": "2002-07-04",
##         "TemporalExtentEnd": "Present",
##         "Deleted": false,
##         "DOI": "10.5067/MODIS/MCD15A3H.006",
##         "ProductAndVersion": "MCD15A3H.006"
##     }
## ]
## 

Also, the products can be searched using their description. Below, search for products containing Leaf Area Index in their description and make a list of their productAndVersion.

## [[1]]
## [1] "MCD15A2H.006"
## 
## [[2]]
## [1] "MCD15A3H.006"
## 
## [[3]]
## [1] "MOD15A2H.006"
## 
## [[4]]
## [1] "MYD15A2H.006"
## 
## [[5]]
## [1] "VNP15A2H.001"

Using the info above, Create a list of desired products.

## [1] "MCD15A3H.006" "MOD11A2.006"

7.14 Search and Explore Available Layers

This API call will list all of the layers available for a given product. Each product is referenced by its ProductAndVersion property which is also referred to as the product_id. First, request the layers for the MCD15A3H.006 product.

## [1] "FparExtra_QC"    "FparLai_QC"      "FparStdDev_500m" "Fpar_500m"      
## [5] "LaiStdDev_500m"  "Lai_500m"

Next, request the layers for the MOD11A2.006 product.

##  [1] "Clear_sky_days"   "Clear_sky_nights" "Day_view_angl"    "Day_view_time"   
##  [5] "Emis_31"          "Emis_32"          "LST_Day_1km"      "LST_Night_1km"   
##  [9] "Night_view_angl"  "Night_view_time"  "QC_Day"           "QC_Night"

Lastly, select the desired layers and pertinent products and make a data frame using this information. This data frame will be inserted into the nested data frame that will be used to create a JSON object to submit a request in Section 3.


7.15 Submit a Point Request

The Submit task API call provides a way to submit a new request to be processed. It can accept data via JSON or query string. In the example below, create a JSON object and submit a request. Tasks in AppEEARS correspond to each request associated with your user account. Therefore, each of the calls to this service requires an authentication token.


7.15.1 Compile a JSON Object

In this section, begin by setting up the information needed for a nested data frame that will be later converted to a JSON object for submitting an AppEEARS point request. For detailed information on required JSON parameters, see the API Documentation.

For point requests, beside the date range and desired layers information, the coordinates property must also be inside the task object. Optionally, set id and category properties to further identify your selected coordinates.

We’ll start by requesting point-based data for NEON.D17.SOAP and NEON.D17.SJER:

To be able to successfully submit a task, the JSON object should be structured in a certain way. The code chunk below uses the information from the previous chunk to create a nested data frame. This nested data frame will be converted to JSON object that can be used to complete the request.

toJSON function from jsonlite package converts the type of data frame to a string that can be recognized as a JSON object to be submitted as a point request.


7.15.3 Retrieve Task Status

This API call will list all of the requests associated with your user account, automatically sorted by date descending with the most recent requests listed first. The AppEEARS API contains some helpful formatting resources. Below, limit the API response to 2 entries for the last 2 requests and set pretty to True to format the response as an organized JSON object to make it easier to read. Additional information on AppEEARS API retrieve task, pagination, and formatting can be found in the API documentation.

## [
##     {
##         "params": {
##             "dates": [
##                 {
##                     "endDate": "10-01-2020",
##                     "startDate": "01-01-2020"
##                 }
##             ],
##             "layers": [
##                 {
##                     "layer": "LST_Day_1km",
##                     "product": "MOD11A2.006"
##                 },
##                 {
##                     "layer": "LST_Night_1km",
##                     "product": "MOD11A2.006"
##                 },
##                 {
##                     "layer": "Lai_500m",
##                     "product": "MCD15A3H.006"
##                 }
##             ]
##         },
##         "status": "pending",
##         "created": "2020-10-07T21:37:14.871259",
##         "task_id": "3a808dfa-ff0b-48f9-ac7b-9f598d73233b",
##         "updated": "2020-10-07T21:37:14.883937",
##         "user_id": "kdw223@nau.edu",
##         "estimate": {
##             "request_size": 204
##         },
##         "task_name": "NEON SOAP SJER Vegetation",
##         "task_type": "point",
##         "api_version": "v1",
##         "svc_version": "2.47",
##         "web_version": {
## 
##         },
##         "expires_on": "2020-11-06T21:37:14.883937"
##     },
##     {
##         "error": {
## 
##         },
##         "params": {
##             "dates": [
##                 {
##                     "endDate": "10-01-2020",
##                     "startDate": "01-01-2020"
##                 }
##             ],
##             "layers": [
##                 {
##                     "layer": "LST_Day_1km",
##                     "product": "MOD11A2.006"
##                 },
##                 {
##                     "layer": "LST_Night_1km",
##                     "product": "MOD11A2.006"
##                 },
##                 {
##                     "layer": "Lai_500m",
##                     "product": "MCD15A3H.006"
##                 }
##             ]
##         },
##         "status": "done",
##         "created": "2020-10-07T21:00:20.497312",
##         "task_id": "de45360e-d6e4-4577-97a1-760b9893c002",
##         "updated": "2020-10-07T21:02:10.990738",
##         "user_id": "kdw223@nau.edu",
##         "attempts": 1,
##         "estimate": {
##             "request_size": 204
##         },
##         "retry_at": {
## 
##         },
##         "completed": "2020-10-07T21:02:10.987115",
##         "task_name": "NEON SOAP SJER Vegetation",
##         "task_type": "point",
##         "api_version": "v1",
##         "svc_version": "2.47",
##         "web_version": {
## 
##         },
##         "size_category": "0",
##         "expires_on": "2020-11-06T21:02:10.990738"
##     }
## ]
## 

The task_id that was generated when submitting your request can also be used to retrieve a task status.

## {
##     "params": {
##         "dates": [
##             {
##                 "endDate": "10-01-2020",
##                 "startDate": "01-01-2020"
##             }
##         ],
##         "layers": [
##             {
##                 "layer": "LST_Day_1km",
##                 "product": "MOD11A2.006"
##             },
##             {
##                 "layer": "LST_Night_1km",
##                 "product": "MOD11A2.006"
##             },
##             {
##                 "layer": "Lai_500m",
##                 "product": "MCD15A3H.006"
##             }
##         ],
##         "coordinates": [
##             {
##                 "id": "0",
##                 "category": "SOAP",
##                 "latitude": 37.0334,
##                 "longitude": -119.2622
##             },
##             {
##                 "id": "1",
##                 "category": "SJER",
##                 "latitude": 37.1088,
##                 "longitude": -119.7323
##             }
##         ]
##     },
##     "status": "pending",
##     "created": "2020-10-07T21:37:14.871259",
##     "task_id": "3a808dfa-ff0b-48f9-ac7b-9f598d73233b",
##     "updated": "2020-10-07T21:37:14.883937",
##     "user_id": "kdw223@nau.edu",
##     "estimate": {
##         "request_size": 204
##     },
##     "task_name": "NEON SOAP SJER Vegetation",
##     "task_type": "point",
##     "api_version": "v1",
##     "svc_version": "2.47",
##     "web_version": {
## 
##     },
##     "expires_on": "2020-11-06T21:37:14.883937"
## }
## 

Retrieve the task status every 5 seconds. The task status should be done to be able to download the output.


7.16 Download a Request

7.16.1 Explore Files in Request Output

Before downloading the request output, examine the files contained in the request output.

## {
##     "files": [
##         {
##             "sha256": "e12e3634d11491fd77aa4c8f347b94304885746713852d21a08c635b2a9e4852",
##             "file_id": "82ab979e-0dbe-4869-b676-88193c79727f",
##             "file_name": "NEON-SOAP-SJER-Vegetation-MCD15A3H-006-results.csv",
##             "file_size": 68260,
##             "file_type": "csv"
##         },
##         {
##             "sha256": "e465df89151b28d63a1dda2420cedec7f24b383d03e0482083839565a27f8d5d",
##             "file_id": "ab2e3574-3c50-44dd-bafd-c30b1fb4d99d",
##             "file_name": "NEON-SOAP-SJER-Vegetation-MOD11A2-006-results.csv",
##             "file_size": 28570,
##             "file_type": "csv"
##         },
##         {
##             "sha256": "100dd40b43760430c900eea1d39b78a73bf880ae397020ad29bcf1c58947e8b5",
##             "file_id": "765639a0-7278-497d-aca6-433ebf41d021",
##             "file_name": "NEON-SOAP-SJER-Vegetation-granule-list.txt",
##             "file_size": 11402,
##             "file_type": "txt"
##         },
##         {
##             "sha256": "6b824abc02ce3e49409e332e5b941533a66b2ff4c2a362b4d3b5b31b4266ecd5",
##             "file_id": "16eae3d4-8876-403e-b673-2e29f2d8324a",
##             "file_name": "NEON-SOAP-SJER-Vegetation-request.json",
##             "file_size": 883,
##             "file_type": "json"
##         },
##         {
##             "sha256": "3e025646ef6eadb42eb4d9f172db96ed824bbc72333519f0c8f44c3449fe4d7d",
##             "file_id": "ff3f16d7-75c2-4185-8ce6-f6a3cc4de17c",
##             "file_name": "NEON-SOAP-SJER-Vegetation-MCD15A3H-006-metadata.xml",
##             "file_size": 17255,
##             "file_type": "xml"
##         },
##         {
##             "sha256": "650cd511fcfc442fe675e35d14a244247c565085d5dcbb215782354d7ceda774",
##             "file_id": "ffa0432e-cc7a-4cde-8264-6ad97dbed7c3",
##             "file_name": "NEON-SOAP-SJER-Vegetation-MOD11A2-006-metadata.xml",
##             "file_size": 17217,
##             "file_type": "xml"
##         },
##         {
##             "sha256": "337cd424036258f85f9d216debfe1f9b0649bf2971ea1ce356a44b9c9ca51078",
##             "file_id": "aa98b009-c955-468d-bd03-9ca7068969b9",
##             "file_name": "README.md",
##             "file_size": 17894,
##             "file_type": "txt"
##         }
##     ],
##     "created": "2020-10-07T21:38:39.407692",
##     "task_id": "3a808dfa-ff0b-48f9-ac7b-9f598d73233b",
##     "updated": "2020-10-07T21:39:07.732995",
##     "bundle_type": "point"
## }
## 

7.17 Download Files in a Request (Automation)

The bundle API provides information about completed tasks. For any completed task, a bundle can be queried to return the files contained as a part of the task request. Below, call the bundle API and return all of the output files. Next, read the contents of the bundle in JSON format and loop through file_id to automate downloading all of the output files into the output directory. For more information, please see AppEEARS API Documentation.


7.18 Explore AppEEARS Quality Service

The quality API provides quality details about all of the data products available in AppEEARS. Below are examples of how to query the quality API for listing quality products, layers, and values. The final example (Section 5c.) demonstrates how AppEEARS quality services can be leveraged to decode pertinent quality values for your data. For more information visit AppEEARS API documentation.

First, reset pagination to include offset which allows you to set the number of results to skip before starting to return entries. Next, make a call to list all of the data product layers and the associated quality product and layer information.

## [
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB1",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ]
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB2",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ]
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB3",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ]
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB4",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ]
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB5",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ]
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB7",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ]
##     }
## ]
## 

7.18.1 List Quality Layers

This API call will list all of the quality layer information for a product. For more information visit AppEEARS API documentation

## [
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "Fpar_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ]
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "FparStdDev_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ]
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "Lai_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ]
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "LaiStdDev_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ]
##     }
## ]
## 

7.18.2 Inspect Quality Values

This API call will list all of the values for a given quality layer.

## [
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "MODLAND",
##         "Value": 0,
##         "Description": "Good quality (main algorithm with or without saturation)",
##         "Acceptable": true
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "MODLAND",
##         "Value": 1,
##         "Description": "Other Quality (back-up algorithm or fill values)",
##         "Acceptable": false
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "Sensor",
##         "Value": 0,
##         "Description": "Terra",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "Sensor",
##         "Value": 1,
##         "Description": "Aqua",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "DeadDetector",
##         "Value": 0,
##         "Description": "Detectors apparently fine for up to 50% of channels 1, 2",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "DeadDetector",
##         "Value": 1,
##         "Description": "Dead detectors caused >50% adjacent detector retrieval",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 0,
##         "Description": "Significant clouds NOT present (clear)",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 1,
##         "Description": "Significant clouds WERE present",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 2,
##         "Description": "Mixed cloud present in pixel",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 3,
##         "Description": "Cloud state not defined, assumed clear",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 0,
##         "Description": "Main (RT) method used, best result possible (no saturation)",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 1,
##         "Description": "Main (RT) method used with saturation. Good, very usable",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 2,
##         "Description": "Main (RT) method failed due to bad geometry, empirical algorithm used",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 3,
##         "Description": "Main (RT) method failed due to problems other than geometry, empirical algorithm used",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 4,
##         "Description": "Pixel not produced at all, value couldn't be retrieved (possible reasons: bad L1B data, unusable MOD09GA data)",
##         "Acceptable": {
## 
##         }
##     }
## ]
## 

7.19 Decode Quality Values

This API call will decode the bits for a given quality value.

## {
##     "Binary Representation": "0b00000001",
##     "MODLAND": {
##         "bits": "0b1",
##         "description": "Other Quality (back-up algorithm or fill values)"
##     },
##     "Sensor": {
##         "bits": "0b0",
##         "description": "Terra"
##     },
##     "DeadDetector": {
##         "bits": "0b0",
##         "description": "Detectors apparently fine for up to 50% of channels 1, 2"
##     },
##     "CloudState": {
##         "bits": "0b00",
##         "description": "Significant clouds NOT present (clear)"
##     },
##     "SCF_QC": {
##         "bits": "0b000",
##         "description": "Main (RT) method used, best result possible (no saturation)"
##     }
## }
## 

7.20 Load Request Output and Visualize

Here, load the CSV file containing the results from your request using readr package, and create some basic visualizations using the ggplot2 package.

7.22 Plot Results (Line/Scatter Plots)

Next, plot a time series of daytime LST for the selected point. Below, filter the LST data to exclude fill values.

Next, plot LST Day as a time series with some additional formatting using ggplot2.

Using the tidyr package, the LST Day and Night values for Grand Canyon NP are being gathered in a single column to be used to make a plot including both LST_Day_1km and LST_Night_1km.

## # A tibble: 5 x 5
##   Latitude Longitude Date       Tstat                     LST
##      <dbl>     <dbl> <date>     <chr>                   <dbl>
## 1     37.0     -119. 2019-12-27 MOD11A2_006_LST_Day_1km  278.
## 2     37.0     -119. 2020-01-01 MOD11A2_006_LST_Day_1km  283.
## 3     37.0     -119. 2020-01-09 MOD11A2_006_LST_Day_1km  280.
## 4     37.0     -119. 2020-01-17 MOD11A2_006_LST_Day_1km  283.
## 5     37.0     -119. 2020-01-25 MOD11A2_006_LST_Day_1km  285.

Next, plot LST Day and Night as a time series with some additional formatting.

Finally, bring in the daytime LST data from SJER , and compare with daytime LST at SOAP , shown below in a scatterplot using ggplot2 package. Here, the dplyr is used to extract the LST_DAY_1km for SJER.

Make a scatterplot.

This example can provide a template to use for your own research workflows. Leveraging the AppEEARS API for searching, extracting, and formatting analysis ready data, and loading it directly into R means that you can keep your entire research workflow in a single software program, from start to finish.

7.23 Submit an Area Request

The following section was adapted from LPDAAC’s E-Learning Tutorials on the AppEEARS API and modified to request data for NEON sites.

Contributing Authors:

Contact Information
Material written by Mahsa Jami1 and Cole Krehbiel1
Contact:
Voice: +1-866-573-3222
Organization: Land Processes Distributed Active Archive Center (LP DAAC)
Website: https://lpdaac.usgs.gov/
Date last modified: 06-12-2020

1 KBR, Inc., contractor to the U.S. Geological Survey, Earth Resources Observation and Science (EROS) Center,
Sioux Falls, South Dakota, USA. Work performed under USGS contract G15PD00467 for LP DAAC2.

2 LP DAAC Work performed under NASA contract NNG14HH33I.

This tutorial demonstrates how to use R to connect to the AppEEARS API The Application for Extracting and Exploring Analysis Ready Samples (AppEEARS) offers a simple and efficient way to access and transform geospatial data from a variety of federal data archives in an easy-to-use web application interface. AppEEARS enables users to subset geospatial data spatially, temporally, and by band/layer for point and area samples. AppEEARS returns not only the requested data, but also the associated quality values, and offers interactive visualizations with summary statistics in the web interface. The AppEEARS API offers users programmatic access to all features available in AppEEARS, with the exception of visualizations. The API features are demonstrated in this tutorial.

7.24 Submit an area request using a NEON site boundary as the region of interest for extracting elevation, vegetation and land surface temperature data

In this section: * Connecting to the AppEEARS API, * Querying the list of available products, * Submitting an area sample request, downloading the request, * Working with the AppEEARS Quality API, and * Loading the results into R for visualization.

AppEEARS area sample requests allow users to subset their desired data by spatial area via vector polygons (shapefiles or GeoJSONs). Users can also reproject and reformat the output data. AppEEARS returns the valid data from the parameters defined within the sample request.

7.24.0.1 Data Used in this Example:

  • Data layers:
    • NASA MEaSUREs Shuttle Radar Topography Mission (SRTM) Version 3 Digital Elevation Model
    • Combined MODIS Leaf Area Index (LAI)
    • Terra MODIS Land Surface Temperature
      • MOD11A2.006, 1000m, 8 day: ‘LST_Day_1km’, ‘LST_Night_1km’

7.24.1 Topics Covered in this Tutorial

Getting Started
* Load Packages
* Login

Query Available Products
* Search and Explore Available Products
* Search and Explore Available Layers

Submit an Area Request
* Load a Shapefile
* Search and Explore Available Projections
* Compile a JSON Object
* Submit a Task Request
* Retrieve Task Status
Download a Request
* Explore Files in Request Output
* Download Files in a Request (Automation)
Explore AppEEARS Quality Service
* List Quality Layers
* Show Quality Values
* Decode Quality Values
BONUS: Load Request Output and Visualize
* Load a GeoTIFF
* Plot a GeoTIFF


7.24.2 Prerequisites:

  • A NASA Earthdata Login account is required to login to the AppEEARS API and submit a request . You can create an account at the link provided.

  • Install R and RStudio. These tutorials have been tested on Windows and Mac systems using R Version 4.0.0, RStudio version 1.1.463, and the specifications listed below.

    • Required packages:
      • getPass
      • httr
      • jsonlite
      • geojsonio
      • geojsonR
      • rgdal
      • sp
      • warnings
    • To read and visualize the GeoTIFF:
      • raster
      • rasterVis
      • RColorBrewer
      • ggplot2

7.24.3 Procedures:

7.24.3.1 Getting Started:

  1. Clone/download AppEEARS API Getting Started in R Repository from the LP DAAC Data User Resources Repository or use the code in this textbook.

  2. Open the AppEEARS_API_R.Rproj file to directly open the project. Next, select the AppEEARS_API_AREA_R.Rmd from the files list and open it.


7.24.4 AppEEARS Information:

To access AppEEARS, visit: https://lpdaacsvc.cr.usgs.gov/appeears/.

For comprehensive documentation of the full functionality of the AppEEARS API, please see the AppEEARS API Documentation.


7.26 Set Up the Output Directory

Create an output directory for the results.

Next, assign the AppEEARS API URL to a static variable.


7.27 Load your Earth Data Token

To submit a request, you must first login to the AppEEARS API. Use your token script to import your credentials.

Decode the username and password to be used to post login request.

Next, assign the AppEEARS API URL to a static variable.

Use the httr package to post your username and password. A successful login will provide you with a token to be used later in this tutorial to submit a request. For more information or if you are experiencing difficulties, please see the API Documentation.

## {
##     "token_type": "Bearer",
##     "token": "qHEa7l-TJQmr9LTGwqgchMg2v9_Xhnuz3ADxZRwYkNOg8CBxwXNZ7H-WgmB9FY2STOltNjK1KRNzWjRKqHNSjA",
##     "expiration": "2021-02-14T17:41:11Z"
## }
## 

Above, you should see a Bearer token. Notice that this token will expire approximately 48 hours after being acquired.


7.29 Search and Explore Available Products

Create a list indexed by product name to make it easier to query a specific product.

## [1] "AppEEARS currently supports 122 products."

Next, look at the product’s names and descriptions. Below, the ‘ProductAndVersion’ and ‘Description’ are printed for all products.

## [1] "GPW_DataQualityInd.004 is Quality of Input Data for Population Count and Density Grids from SEDAC"
## [1] "GPW_UN_Adj_PopCount.004 is UN-adjusted Population Count from SEDAC"
## [1] "GPW_UN_Adj_PopDensity.004 is UN-adjusted Population Density from SEDAC"
## [1] "MCD12Q1.006 is Land Cover Type from LP DAAC"
## [1] "MCD12Q2.006 is Land Cover Dynamics from LP DAAC"
## [1] "MCD15A2H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MCD15A3H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MCD43A1.006 is Bidirectional Reflectance Distribution Function (BRDF) and Albedo from LP DAAC"
## [1] "MCD43A3.006 is Bidirectional Reflectance Distribution Function (BRDF) and Albedo from LP DAAC"
## [1] "MCD43A4.006 is Bidirectional Reflectance Distribution Function (BRDF) and Albedo from LP DAAC"
## [1] "MCD64A1.006 is Burned Area (fire) from LP DAAC"
## [1] "MOD09A1.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MOD09GA.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MOD09GQ.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MOD09Q1.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MOD10A1.005 is Snow Cover from NSIDC DAAC"
## [1] "MOD10A1.006 is Snow Cover (NDSI) from NSIDC DAAC"
## [1] "MOD10A2.005 is Snow Cover from NSIDC DAAC"
## [1] "MOD10A2.006 is Snow Cover from NSIDC DAAC"
## [1] "MOD11A1.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MOD11A2.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MOD13A1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD13A2.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD13A3.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD13Q1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MOD14A2.006 is Thermal Anomalies and Fire from LP DAAC"
## [1] "MOD15A2H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MOD16A2.006 is Evapotranspiration (ET & LE) from LP DAAC"
## [1] "MOD16A2GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MOD16A3GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MOD17A2H.006 is Gross Primary Productivity (GPP) from LP DAAC"
## [1] "MOD17A2HGF.006 is Gross Primary Productivity (GPP) from LP DAAC"
## [1] "MOD17A3HGF.006 is Net Primary Production (NPP) Gap-Filled from LP DAAC"
## [1] "MOD44B.006 is Vegetation Continuous Fields (VCF) from LP DAAC"
## [1] "MOD44W.006 is Land/Water Mask from LP DAAC"
## [1] "MODOCGA.006 is Ocean Reflectance Bands 8-16 from LP DAAC"
## [1] "MODTBGA.006 is Thermal Bands and Albedo from LP DAAC"
## [1] "MYD09A1.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MYD09GA.006 is Surface Reflectance Bands 1-7 from LP DAAC"
## [1] "MYD09GQ.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MYD09Q1.006 is Surface Reflectance Bands 1-2 from LP DAAC"
## [1] "MYD10A1.005 is Snow Cover from NSIDC DAAC"
## [1] "MYD10A1.006 is Snow Cover (NDSI) from NSIDC DAAC"
## [1] "MYD10A2.005 is Snow Cover from NSIDC DAAC"
## [1] "MYD10A2.006 is Snow Cover from NSIDC DAAC"
## [1] "MYD11A1.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD11A2.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD13A1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD13A2.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD13A3.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD13Q1.006 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "MYD14A2.006 is Thermal Anomalies and Fire from LP DAAC"
## [1] "MYD15A2H.006 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "MYD16A2.006 is Evapotranspiration (ET & LE) from LP DAAC"
## [1] "MYD16A2GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MYD16A3GF.006 is Net Evapotranspiration Gap-Filled (ET & LE) from LP DAAC"
## [1] "MYD17A2H.006 is Gross Primary Productivity (GPP) from LP DAAC"
## [1] "MYD17A2HGF.006 is Gross Primary Productivity (GPP) Gap-Filled from LP DAAC"
## [1] "MYD17A3HGF.006 is Net Primary Production (NPP) Gap-Filled from LP DAAC"
## [1] "MYD21A1D.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD21A1N.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYD21A2.006 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "MYDOCGA.006 is Ocean Reflectance Bands 8-16 from LP DAAC"
## [1] "MYDTBGA.006 is Thermal Bands and Albedo from LP DAAC"
## [1] "NASADEM_NC.001 is Elevation from LP DAAC"
## [1] "NASADEM_NUMNC.001 is Source from LP DAAC"
## [1] "SPL3SMP_E.004 is Enhanced L3 Radiometer Soil Moisture from NSIDC DAAC"
## [1] "SPL3SMP.007 is Soil Moisture from NSIDC DAAC"
## [1] "SPL4CMDL.005 is Carbon Net Ecosystem Exchange from NSIDC DAAC"
## [1] "SPL4SMGP.005 is Surface and Root Zone Soil Moisture from NSIDC DAAC"
## [1] "SPL3FTP.003 is Freeze/Thaw State from NSIDC DAAC"
## [1] "SRTMGL1_NC.003 is Elevation (DEM) from LP DAAC"
## [1] "SRTMGL1_NUMNC.003 is Source (DEM) from LP DAAC"
## [1] "SRTMGL3_NC.003 is Elevation (DEM) from LP DAAC"
## [1] "SRTMGL3_NUMNC.003 is Source (DEM) from LP DAAC"
## [1] "ASTGTM_NC.003 is Elevation from LP DAAC"
## [1] "ASTGTM_NUMNC.003 is Source from LP DAAC"
## [1] "ASTWBD_ATTNC.001 is Water Bodies Database Attributes from LP DAAC"
## [1] "ASTWBD_NC.001 is Water Bodies Database Elevation from LP DAAC"
## [1] "VNP09H1.001 is Surface Reflectance from LP DAAC"
## [1] "VNP09A1.001 is Surface Reflectance from LP DAAC"
## [1] "VNP09GA.001 is Surface Reflectance from LP DAAC"
## [1] "VNP13A1.001 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "VNP13A2.001 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "VNP13A3.001 is Vegetation Indices (NDVI & EVI) from LP DAAC"
## [1] "VNP14A1.001 is Thermal Anomalies/Fire from LP DAAC"
## [1] "VNP15A2H.001 is Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR) from LP DAAC"
## [1] "VNP21A1D.001 is Land Surface Temperature & Emissivity Day (LST&E) from LP DAAC"
## [1] "VNP21A1N.001 is Land Surface Temperature & Emissivity Night (LST&E) from LP DAAC"
## [1] "VNP21A2.001 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "VNP22Q2.001 is Global Land Surface Phenology (GLSP) from LP DAAC"
## [1] "VNP43IA1.001 is BRDF-Albedo Model Parameters from LP DAAC"
## [1] "VNP43IA2.001 is BRDF-Albedo Quality from LP DAAC"
## [1] "VNP43IA3.001 is Albedo (BRDF) from LP DAAC"
## [1] "VNP43IA4.001 is Nadir BRDF-Adjusted Reflectance from LP DAAC"
## [1] "VNP43MA1.001 is BRDF-Albedo Model Parameters from LP DAAC"
## [1] "VNP43MA2.001 is BRDF-Albedo Quality from LP DAAC"
## [1] "VNP43MA3.001 is Albedo (BRDF) from LP DAAC"
## [1] "VNP43MA4.001 is Nadir BRDF-Adjusted Reflectance from LP DAAC"
## [1] "CU_LC08.001 is CONUS Landsat 8 Surface Reflectance from USGS"
## [1] "CU_LE07.001 is CONUS Landsat 7 Surface Reflectance from USGS"
## [1] "CU_LT05.001 is CONUS Landsat 5 Surface Reflectance from USGS"
## [1] "CU_LT04.001 is CONUS Landsat 4 Surface Reflectance from USGS"
## [1] "AK_LC08.001 is Alaska Landsat 8 Surface Reflectance from USGS"
## [1] "AK_LE07.001 is Alaska Landsat 7 Surface Reflectance from USGS"
## [1] "AK_LT05.001 is Alaska Landsat 5 Surface Reflectance from USGS"
## [1] "AK_LT04.001 is Alaska Landsat 4 Surface Reflectance from USGS"
## [1] "HI_LC08.001 is Hawaii Landsat 8 Surface Reflectance from USGS"
## [1] "HI_LE07.001 is Hawaii Landsat 7 Surface Reflectance from USGS"
## [1] "HI_LT05.001 is Hawaii Landsat 5 Surface Reflectance from USGS"
## [1] "HI_LT04.001 is Hawaii Landsat 4 Surface Reflectance from USGS"
## [1] "DAYMET.003 is Daily Surface Weather Data for North America from ORNL"
## [1] "SSEBop_ET.004 is SSEBop Actual Evapotranspiration (ETa) from USGS"
## [1] "eMODIS_Smoothed_NDVI.001 is eMODIS Smoothed Normalized Difference Vegetation Index (NDVI) from USGS"
## [1] "ECO2LSTE.001 is Land Surface Temperature & Emissivity (LST&E) from LP DAAC"
## [1] "ECO2CLD.001 is Cloud Mask from LP DAAC"
## [1] "ECO3ETPTJPL.001 is Evapotranspiration PT-JPL from LP DAAC"
## [1] "ECO3ANCQA.001 is L3/L4 Ancillary Data Quality Assurance (QA) Flags from LP DAAC"
## [1] "ECO4ESIPTJPL.001 is Evaporative Stress Index PT-JPL from LP DAAC"
## [1] "ECO4WUE.001 is Water Use Efficiency from LP DAAC"
## [1] "ECO1BGEO.001 is Geolocation from LP DAAC"
## [1] "ECO1BMAPRAD.001 is Resampled Radiance from LP DAAC"

The product service provides many useful details, including if a product is currently available in AppEEARS, a description, and information on the spatial and temporal resolution. Below, the product details are retrieved using ‘ProductAndVersion’.

## [
##     {
##         "Product": "MCD15A3H",
##         "Platform": "Combined MODIS",
##         "Description": "Leaf Area Index (LAI) and Fraction of Photosynthetically Active Radiation (FPAR)",
##         "RasterType": "Tile",
##         "Resolution": "500m",
##         "TemporalGranularity": "4 day",
##         "Version": "006",
##         "Available": true,
##         "DocLink": "https://doi.org/10.5067/MODIS/MCD15A3H.006",
##         "Source": "LP DAAC",
##         "TemporalExtentStart": "2002-07-04",
##         "TemporalExtentEnd": "Present",
##         "Deleted": false,
##         "DOI": "10.5067/MODIS/MCD15A3H.006",
##         "ProductAndVersion": "MCD15A3H.006"
##     }
## ]
## 

Below, search for products containing Leaf Area Index in their description.

## [[1]]
## [1] "MCD15A2H.006"
## 
## [[2]]
## [1] "MCD15A3H.006"
## 
## [[3]]
## [1] "MOD15A2H.006"
## 
## [[4]]
## [1] "MYD15A2H.006"
## 
## [[5]]
## [1] "VNP15A2H.001"

Using the info above, Create a list of desired products.

## [1] "MCD15A3H.006"   "MOD11A2.006"    "SRTMGL1_NC.003"

7.30 Search and Explore Available Layers

This API call will list all of the layers available for a given product. Each product is referenced by its ProductAndVersion property which is also referred to as the product_id. First, request the layers for the MCD15A3H.006 product.

## [1] "FparExtra_QC"    "FparLai_QC"      "FparStdDev_500m" "Fpar_500m"      
## [5] "LaiStdDev_500m"  "Lai_500m"

Next, request the layers for the MOD11A2.006 product.

##  [1] "Clear_sky_days"   "Clear_sky_nights" "Day_view_angl"    "Day_view_time"   
##  [5] "Emis_31"          "Emis_32"          "LST_Day_1km"      "LST_Night_1km"   
##  [9] "Night_view_angl"  "Night_view_time"  "QC_Day"           "QC_Night"

Next, request the layers for theSRTMGL1_NC.003 product.

## [1] "SRTMGL1_DEM"

Lastly, select the desired layers and pertinent products and make a data frame using this information. This list will be inserted into the JSON file used to submit a request.


7.31 Submit an Area Request

The Submit task API call provides a way to submit a new request to be processed. It can accept data via JSON or query string. In the example below, create a JSON object and submit a request. Tasks in AppEEARS correspond to each request associated with your user account. Therefore, each of the calls to this service requires an authentication token.


7.31.1 Load a Shapefile

In this section, begin by loading a shapefile using the rgdal package. The shapefile is publicly available for download from the NPS website.

## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/kdw223/Research/katharynduffy.github.io/ONAQ_extent", layer: "D15_ONAQ_C1_P1_v2"
## with 1 features
## It has 1 fields

convert the Spatial data frame to GeoJSON using geojson_json from geojsonio package, which makes it easy to create the geospatial data in and out of GeoJSON format.

## Warning: 'geojsonlint' not installed, skipping GeoJSON linting

Next, the GeoJSON object can be read as a list using the FROM_GeoJson function from geojsonR package.


7.33 Compile a JSON Object

In this section, begin by setting up the information needed for a nested data list that will be later converted to a JSON object for submitting an AppEEARS area request.For detailed information on required JSON parameters, see the API Documentation.

To be able to successfully submit a task, the JSON object should be structured in a certain way. The code chunk below uses the information from the previous chunk to create a nested data frame. This nested data frame will be converted to JSON object that can be used to complete the request.

toJSON function from jsonlite package converts the type of data frame to a string that can be recognized as a JSON object to be submitted as an area request.


7.35 Retrieve Task Status

This API call will list all of the requests associated with your user account, automatically sorted by date, with the most recent requests listed first.

The AppEEARS API contains some helpful formatting resources. Below, limit the API response to 2 entries for the last 2 requests and set pretty to True to format the response as an organized JSON, making it easier to read. Additional information on AppEEARS API retrieve task, pagination, and formatting can be found in the API documentation.

## {
##     "message": "You don't have the permission to access the requested resource. It is either read-protected or not readable by the server."
## }
## 

The task_id that was generated when submitting your request can also be used to retrieve a task status. Notice, this could get longer because of the number of vertices in the shapefile that will be printed.

Retrieve the task status every 60 seconds. The task status should be done to be able to download the output.


7.36 Download a Request

7.37 Download Files in a Request (Automation)

The bundle API provides information about completed tasks. For any completed task, a bundle can be queried to return the files contained as a part of the task request. Below, call the bundle API and return all of the output files. Next, read the contents of the bundle in JSON format and loop through file_id to automate downloading all of the output files into the output directory. For more information, please see AppEEARS API Documentation.

Now, take a look at “R_output” directory. Separate folders are made for each product and the outputs are saved in these folders.

##  [1] "./data/"                                                                                     
##  [2] "./data//__MACOSX"                                                                            
##  [3] "./data//__MACOSX/All_NEON_TOS_Plots_V8"                                                      
##  [4] "./data//All_NEON_TOS_Plots_V8"                                                               
##  [5] "./data//AOP"                                                                                 
##  [6] "./data//AOPTerrestrial"                                                                      
##  [7] "./data//AOPTerrestrial 2"                                                                    
##  [8] "./data//DP1.30003.001"                                                                       
##  [9] "./data//DP1.30003.001/2017"                                                                  
## [10] "./data//DP1.30003.001/2017/FullSite"                                                         
## [11] "./data//DP1.30003.001/2017/FullSite/D16"                                                     
## [12] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1"                                         
## [13] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/L1"                                      
## [14] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/L1/DiscreteLidar"                        
## [15] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/L1/DiscreteLidar/ClassifiedPointCloud"   
## [16] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/Metadata"                                
## [17] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar"                  
## [18] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary"     
## [19] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/kmls"
## [20] "./data//DP1.30003.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/shps"
## [21] "./data//DP3.30015.001"                                                                       
## [22] "./data//DP3.30015.001/2017"                                                                  
## [23] "./data//DP3.30015.001/2017/FullSite"                                                         
## [24] "./data//DP3.30015.001/2017/FullSite/D16"                                                     
## [25] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1"                                         
## [26] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/L3"                                      
## [27] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/L3/DiscreteLidar"                        
## [28] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/L3/DiscreteLidar/CanopyHeightModelGtif"  
## [29] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata"                                
## [30] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar"                  
## [31] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary"     
## [32] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/kmls"
## [33] "./data//DP3.30015.001/2017/FullSite/D16/2017_WREF_1/Metadata/DiscreteLidar/TileBoundary/shps"
## [34] "./data//filesToStack00200"                                                                   
## [35] "./data//NEON_TOS"                                                                            
## [36] "./data//pointreyes"                                                                          
## [37] "./data//pointreyesclear"                                                                     
## [38] "./data//pointreyesfoggy"                                                                     
## [39] "./data//SJER"                                                                                
## [40] "./data//SOAP"

Below, the list of relative path and file names is assigned to a variable and part of the list is printed.

Later in this tutorial, the SRTMGL1_NC GeoTIFF is loaded for visulalization. Below, the directory to this file is assigned to a variable.

## [1] "./data/NASADEM_NC.001_NASADEM_HGT_doy2000042_aid0001.tif"

7.38 Explore AppEEARS Quality Service

The quality API provides quality details about all of the data products available in AppEEARS. Below are examples of how to query the quality API for listing quality products, layers, and values. The final example demonstrates how AppEEARS quality services can be leveraged to decode pertinent quality values for your data. For more information visit AppEEARS API documentation

First, reset pagination to include offset which allows you to set the number of results to skip before starting to return entries. Next, make a call to list all of the data product layers and the associated quality product and layer information.

## [
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB1",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB2",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB3",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB4",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB5",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "CU_LT05.001",
##         "Layer": "SRB7",
##         "QualityProductAndVersion": "CU_LT05.001",
##         "QualityLayers": [
##             "PIXELQA"
##         ],
##         "VisibleToWorker": true
##     }
## ]
## 

7.39 List Quality Layers

This API call will list all of the quality layer information for a product. For more information visit AppEEARS API documentation

## [
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "Fpar_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "FparStdDev_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "Lai_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ],
##         "VisibleToWorker": true
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "Layer": "LaiStdDev_500m",
##         "QualityProductAndVersion": "MCD15A3H.006",
##         "QualityLayers": [
##             "FparLai_QC",
##             "FparExtra_QC"
##         ],
##         "VisibleToWorker": true
##     }
## ]
## 

7.40 Show Quality Values

This API call will list all of the values for a given quality layer.

## [
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "MODLAND",
##         "Value": 0,
##         "Description": "Good quality (main algorithm with or without saturation)",
##         "Acceptable": true
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "MODLAND",
##         "Value": 1,
##         "Description": "Other Quality (back-up algorithm or fill values)",
##         "Acceptable": false
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "Sensor",
##         "Value": 0,
##         "Description": "Terra",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "Sensor",
##         "Value": 1,
##         "Description": "Aqua",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "DeadDetector",
##         "Value": 0,
##         "Description": "Detectors apparently fine for up to 50% of channels 1, 2",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "DeadDetector",
##         "Value": 1,
##         "Description": "Dead detectors caused >50% adjacent detector retrieval",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 0,
##         "Description": "Significant clouds NOT present (clear)",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 1,
##         "Description": "Significant clouds WERE present",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 2,
##         "Description": "Mixed cloud present in pixel",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "CloudState",
##         "Value": 3,
##         "Description": "Cloud state not defined, assumed clear",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 0,
##         "Description": "Main (RT) method used, best result possible (no saturation)",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 1,
##         "Description": "Main (RT) method used with saturation. Good, very usable",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 2,
##         "Description": "Main (RT) method failed due to bad geometry, empirical algorithm used",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 3,
##         "Description": "Main (RT) method failed due to problems other than geometry, empirical algorithm used",
##         "Acceptable": {
## 
##         }
##     },
##     {
##         "ProductAndVersion": "MCD15A3H.006",
##         "QualityLayer": "FparLai_QC",
##         "Name": "SCF_QC",
##         "Value": 4,
##         "Description": "Pixel not produced at all, value couldn't be retrieved (possible reasons: bad L1B data, unusable MOD09GA data)",
##         "Acceptable": {
## 
##         }
##     }
## ]
## 

7.41 Decode Quality Values

This API call will decode the bits for a given quality value.

## {
##     "Binary Representation": "0b00000001",
##     "MODLAND": {
##         "bits": "0b1",
##         "description": "Other Quality (back-up algorithm or fill values)"
##     },
##     "Sensor": {
##         "bits": "0b0",
##         "description": "Terra"
##     },
##     "DeadDetector": {
##         "bits": "0b0",
##         "description": "Detectors apparently fine for up to 50% of channels 1, 2"
##     },
##     "CloudState": {
##         "bits": "0b00",
##         "description": "Significant clouds NOT present (clear)"
##     },
##     "SCF_QC": {
##         "bits": "0b000",
##         "description": "Main (RT) method used, best result possible (no saturation)"
##     }
## }
## 

7.42 BONUS: Load Request Output and Visualize

Here, load one of the output GeoTIFFs and show some basic visualizations using the rasterVis and ggplot2 packages.

7.43 Load a GeoTIFF

First, created a raster object by calling the raster() function from the raster package.


7.45 NASA EOS Coding Lab #2

  1. Choose two NEON sites in different ecoregions. Then complete the following for each of your two NEON sites:

  2. Using your Earth Data account submit a point-based request to AppEEARS to pull 250m NDVI from AQUA and TERA for 2017, 2018, & 2019.

Hint: How might you decide on the lat/lon to submit? Metadata for the site? NEON TOS data?

  1. Use QA/QC values to filter out ‘poor quality’.

Hint: Look at the QA/QC files that accompany your request

  1. Plot 3 years of NDVI from MODIS AQUA and TERA as a timeseries.

  2. Constrain a 3-week window for ‘peak greeness’ from MODIS and highlight it on your timeseries plot.

  3. Pull the canopy-level gcc90 from PhenoCam for the same site and the same time period as above.

Hint: Check the numbering of your PhenoCam on the PhenoCam gallery

  1. Plot the PhenoCam and MODIS timeseries on the same plot.

  2. Constrain a 3-week window for ‘peak greeness’ from PhenoCam and highlight it on your timeseries. Hint: Remember our PhenoCam discussions regarding early ‘extra green’ leaves? You’ll need to use some logic for this, not just a max

  3. Find the timing of the AOP flights that have occured at your sites over the same time period. Add those dates as a vertical line.

BONUS: If you’d like to submit an area-based request instead you can do so using the shapefiles for each NEON site in this folder

7.46 NASA EOS Written Questions

  1. How does the scientific method of Earth Science differ from that of traditional/classical labratory sciences?

7.47 NASA EOS Culmination Write Up

Write up a 1-page derived data product or research pipeline proposal summary of a project that you might want to explore using NASA EOS data. Include the types of data that you would need to implement this project and how you would retrieve them. Save this summary as you will be refining and adding to your ideas over the course of the semester.

Suggestions:

  1. Tables or bullet lists of specific data products

  2. An overarching high-quality figure to show how these data align

  3. One paragraph summarizing how this data or analysis is useful to you and/or the infrastructure.