{ "cells": [ { "cell_type": "markdown", "id": "c01a4eec-c0af-4dcd-95e9-3a9fb0aba166", "metadata": {}, "source": [ "# ICESat-02 ATL03 Subset and Visualize\n", "\n", "Authors: Sumant Jha (MSFC/USRA), Samuel Ayers (UAH), Alex Mandel (Development Seed), Aimee Barciauskas (Development Seed)\n", "\n", "Date: March 6, 2023\n", "\n", "Description: In this tutorial, we will search for ATL03 data within the NASA CMR. We will then read and visualize the data structure of a granule, create a subset and data frames, and visualize the photon heights." ] }, { "cell_type": "markdown", "id": "064dc9f3-8621-4b1e-8246-4c244d369a56", "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": "4ac294fb", "metadata": {}, "source": [ "## About the Data\n", "\n", "ATLAS/ICESat-2 L2A Global Geolocated Photon Data, Version 5\n", "\n", "\"This data set [ATL03] contains height above the WGS 84 ellipsoid (ITRF2014 reference frame), latitude, longitude, and time for all photons downlinked by the Advanced Topographic Laser Altimeter System (ATLAS) instrument on board the Ice, Cloud and land Elevation Satellite-2 (ICESat-2) observatory. The ATL03 product was designed to be a single source for all photon data and ancillary information needed by higher-level ATLAS/ICESat-2 products. As such, it also includes spacecraft and instrument parameters and ancillary data not explicitly required for ATL03.\" (Source: [ATL03 Dataset Landing Page](https://nsidc.org/data/atl03/versions/5))" ] }, { "cell_type": "markdown", "id": "4b642af1-b3fa-4b6b-8275-c4047c7f11ad", "metadata": {}, "source": [ "## Additional Resources\n", "- [ATL03 Version 5 User Guide](https://nsidc.org/sites/default/files/atl03-v005-userguide_1.pdf)\n", "- [Earthdata Search](https://search.earthdata.nasa.gov/search?q=ATL03)" ] }, { "cell_type": "markdown", "id": "82823076", "metadata": {}, "source": [ "## Importing and Installing Packages" ] }, { "cell_type": "markdown", "id": "178a2421", "metadata": {}, "source": [ "Required packages:" ] }, { "cell_type": "markdown", "id": "a6302092", "metadata": { "tags": [] }, "source": [ "You will need to install the following required packages if not already present in your working environment: \n", "maap-py, \n", "pandas, \n", "geopandas, \n", "folium, \n", "shapely, \n", "h5glance, \n", "h5py" ] }, { "cell_type": "code", "execution_count": 1, "id": "5877acc2-9813-4d8f-a153-efc819229988", "metadata": {}, "outputs": [], "source": [ "# ! pip install geopandas\n", "# ! pip install folium\n", "# ! pip install h5glance" ] }, { "cell_type": "code", "execution_count": 2, "id": "44746230", "metadata": {}, "outputs": [], "source": [ "# Import the MAAP package\n", "from maap.maap import MAAP\n", "\n", "# Invoke the MAAP constructor using the maap_host argument\n", "maap = MAAP(maap_host='api.maap-project.org')\n", "\n", "# Import pandas dataframe\n", "import pandas as pd\n", "\n", "# Import libraries needed for visualizing data spatial extent\n", "import geopandas as gpd\n", "import folium\n", "from shapely.geometry import Polygon,Point\n", "\n", "# Import H5glance to interactively explore H5 file in notebook\n", "from h5glance import H5Glance\n", "\n", "# Import H5py to read h5 file\n", "import h5py\n", "\n", "# Import os to create a new directory\n", "import os" ] }, { "cell_type": "markdown", "id": "13f4a0af", "metadata": {}, "source": [ "## Decide on a Subset of ATL03 Data\n", "First, we will create a subset using a spatial extent and date range before visualizaing using folium. For this tutorial, we will focus on a very small area over Yosemite National Park and use a temporal range of one day." ] }, { "cell_type": "code", "execution_count": 3, "id": "ac73de13", "metadata": {}, "outputs": [], "source": [ "# Create a variable for short name of ATL03 data\n", "short_name = 'ATL03'\n", "\n", "# Create Latitude, Longitude list.\n", "lat_coords = [37.700057,37.700057,37.758166,37.758166,37.700057]\n", "lon_coords = [-119.680359,-119.680359,-119.538910,-119.538910,-119.680359]\n", "\n", "# Create bounding box\n", "spatial_extent = [lon_coords[0],lat_coords[0],lon_coords[2],lat_coords[2]]\n", "\n", "# Reformat bounding box to work with NASA CMR API\n", "spatial_extent = ','.join(str(coords) for coords in spatial_extent)\n", "\n", "#Provide date range. It is just 1 day. \n", "date_range = ['2021-02-02','2022-02-03']\n", "\n", "# For folium purpose, provide the map center\n", "map_center = [37.729139,-119.609670]\n", "\n", "# Convert to AOI for visualizaton with folium\n", "polygon_geom = Polygon(zip(lon_coords, lat_coords))\n", "\n", "# Provide relevant Coordinate Reference System\n", "crs = 'epsg:4326'\n", "\n", "# Convert to Geodataframe and back to list in that specific reference system\n", "AOI = gpd.GeoDataFrame(index=[0], crs=crs, geometry=[polygon_geom])\n", "AOI_bbox = AOI.bounds.iloc[0].to_list()" ] }, { "cell_type": "code", "execution_count": 4, "id": "cefb1b8d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | Latitude | \n", "Longitude | \n", "Photon_Height | \n", "Along_track_distance | \n", "
|---|---|---|---|---|
| 0 | \n", "59.482065 | \n", "-115.906874 | \n", "611.887878 | \n", "16.894447 | \n", "
| 1 | \n", "59.482065 | \n", "-115.906877 | \n", "580.084106 | \n", "16.980614 | \n", "
| 2 | \n", "59.482064 | \n", "-115.906882 | \n", "527.962097 | \n", "17.122099 | \n", "
| 3 | \n", "59.482063 | \n", "-115.906885 | \n", "491.036133 | \n", "17.222527 | \n", "
| 4 | \n", "59.482059 | \n", "-115.906875 | \n", "616.919922 | \n", "17.593958 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 36561868 | \n", "33.011390 | \n", "-119.752303 | \n", "69.065865 | \n", "4.154013 | \n", "
| 36561869 | \n", "33.011382 | \n", "-119.752316 | \n", "-16.501354 | \n", "5.156162 | \n", "
| 36561870 | \n", "33.011380 | \n", "-119.752329 | \n", "-108.562981 | \n", "5.470425 | \n", "
| 36561871 | \n", "33.011376 | \n", "-119.752317 | \n", "-17.947205 | \n", "5.871534 | \n", "
| 36561872 | \n", "33.011375 | \n", "-119.752319 | \n", "-37.489002 | \n", "5.938596 | \n", "
36561873 rows × 4 columns
\n", "