{ "cells": [ { "cell_type": "markdown", "id": "078dd796", "metadata": {}, "source": [ "# GEDI_L2B Search and Visualize" ] }, { "cell_type": "markdown", "id": "78d4037b", "metadata": {}, "source": [ "Authors: Samuel Ayers (UAH), Sumant Jha (MSFC/USRA), Anish Bhusal (UAH), Alex Mandel (Development Seed), Aimee Barciauskas (Development Seed)\n", "\n", "Date: December 19, 2022\n", "\n", "Description: In this tutorial, we will use the integrated Earthdata search function in MAAP Algorithm Development Environment (ADE) to search for GEDI L2B data for an area of interest. We will then download some of this data and read its attributes in preparation for some analysis. We will perform a spatial subset on the data to reduce data volumes, and then make some basic plots of our data." ] }, { "cell_type": "markdown", "id": "4e049ed3", "metadata": {}, "source": [ "## Run This Notebook\n", "To access and run this tutorial within MAAP's Algorithm Development Environment (ADE), please refer to the [\"Getting started with the MAAP\"](https://docs.maap-project.org/en/latest/getting_started/getting_started.html) section of our documentation.\n", "\n", "Disclaimer: it is highly recommended to run a tutorial within MAAP's ADE, which already includes packages specific to MAAP, such as maap-py. Running the tutorial outside of the MAAP ADE may lead to errors." ] }, { "cell_type": "markdown", "id": "f92161a0", "metadata": {}, "source": [ "## About the Data\n", "\n", "GEDI L2B Canopy Cover and Vertical Profile Metrics Data Global Footprint Level V002\n", "\n", "This dataset provides Global Ecosystem Dynamics Investigation (GEDI) Level 2 (L2) data, which has the purpose of extracting biophysical metrics and consists of Canopy Cover and Vertical Profile Metrics. These metrics are derived from the L1B waveform, and include canopy cover, Plant Area Index (PAI), Plant Area Volume Density (PAVD), and Foliage Height Diversity (FHD). GEDI is attached to the International Space Station (ISS) and collects data globally between 51.6° N and 51.6° S latitudes at the highest resolution and densest sampling of any light detection and ranging (lidar) instrument in orbit to date; specifically, GEDI L2B data has a spatial resolution of 25m. (Source: [GEDI L2B CMR Search](https://cmr.earthdata.nasa.gov/search/concepts/C1908350066-LPDAAC_ECS.html))" ] }, { "cell_type": "markdown", "id": "4352c920", "metadata": {}, "source": [ "## Additional Resources\n", "- [GEDI_L2B Version 2 Dataset Landing Page](https://lpdaac.usgs.gov/products/gedi02_bv002/)\n", "- [GEDI Level 2 Version 2 User Guide](https://lpdaac.usgs.gov/documents/998/GEDI02_UserGuide_V21.pdf)\n", "- [The GEDI Website](https://gedi.umd.edu/)" ] }, { "cell_type": "markdown", "id": "cd7bc7b1", "metadata": {}, "source": [ "## Importing and Installing Packages\n", "\n", "We will begin by installing any packages we need and importing the packages that we will use." ] }, { "cell_type": "markdown", "id": "2f1ebae0", "metadata": {}, "source": [ "**Prerequisites** \n", "\n", "* geopandas\n", "* folium" ] }, { "cell_type": "code", "execution_count": null, "id": "e008ff2c", "metadata": {}, "outputs": [], "source": [ "# Uncomment the following lines to install these packages if you haven't already.\n", "# !pip install geopandas\n", "# !pip install folium" ] }, { "cell_type": "code", "execution_count": 1, "id": "d7388fd7", "metadata": {}, "outputs": [], "source": [ "from maap.maap import MAAP\n", "maap = MAAP(maap_host='api.maap-project.org')\n", "import geopandas as gpd\n", "import folium\n", "import h5py\n", "import pandas\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "import shapely\n", "import os" ] }, { "cell_type": "markdown", "id": "115748f1", "metadata": {}, "source": [ "## Search Data Using an AOI" ] }, { "cell_type": "markdown", "id": "564bbad0", "metadata": {}, "source": [ "We will search and download GEDI L2B data using the bounding box of a vector AOI. Firstly, an AOI over the Shenandoah National Park will be created and then we will plot its location on a map." ] }, { "cell_type": "code", "execution_count": 2, "id": "92e3f1c8", "metadata": {}, "outputs": [], "source": [ "# Using bounding coordinates to create a polygon around Shenandoah National Park\n", "lon_coords = [-78.32129105072025, -78.04618813890727, -78.72985973163064, -79.0158578082679, -78.32129105072025]\n", "lat_coords = [38.88703610703791, 38.74909216350823, 37.88789051477522, 38.03177640342157, 38.88703610703791]\n", "\n", "polygon_geom = shapely.geometry.polygon.Polygon(zip(lon_coords, lat_coords))\n", "crs = 'epsg:4326'\n", "AOI = gpd.GeoDataFrame(index=[0], crs=crs, geometry=[polygon_geom])" ] }, { "cell_type": "markdown", "id": "ac237d81", "metadata": {}, "source": [ "We can get the bounding box of the AOI so we can use it as a spatial limit on our data search. GeoPandas has a function for returning the spatial coordinates of a bounding box:" ] }, { "cell_type": "code", "execution_count": 3, "id": "851d3490", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "minx = -79.0158578082679\n", "miny = 37.88789051477522\n", "maxx = -78.04618813890727\n", "maxy = 38.88703610703791\n" ] } ], "source": [ "# Get the bounding box of the shp\n", "bbox = AOI.bounds\n", "# print the bounding box coords\n", "print('minx = ', bbox['minx'][0])\n", "print('miny = ', bbox['miny'][0])\n", "print('maxx = ', bbox['maxx'][0])\n", "print('maxy = ', bbox['maxy'][0])" ] }, { "cell_type": "markdown", "id": "a62b03b2", "metadata": {}, "source": [ "Let's look at our AOI on an interactive map using folium." ] }, { "cell_type": "code", "execution_count": 4, "id": "e5935b6e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "