{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Working with ECOSTRESS Evapotranspiration Data\n", "### This tutorial demonstrates how to work with the ECOSTRESS Evapotranspiration PT-JPL Daily L3 Global 70m Version 1 ([ECO3ETPTJPL.001](https://doi.org/10.5067/ECOSTRESS/ECO3ETPTJPL.001)) data product in Python.\n", "The Land Processes Distributed Active Archive Center (LP DAAC) distributes the Ecosystem Spaceborne Thermal Radiometer Experiment on Space Station ([ECOSTRESS](https://ecostress.jpl.nasa.gov/)) data products. The ECOSTRESS mission is tasked with measuring the temperature of plants to better understand how much water plants need and how they respond to stress. ECOSTRESS products are archived and distributed in the HDF5 file format as swath-based products.\n", "\n", "In this tutorial, you will use Python to perform a swath to grid conversion to project the swath data on to a grid with a defined coordinate reference system (CRS), compare ECOSTRESS data with ground-based AmeriFlux flux tower observations, and export science dataset (SDS) layers as GeoTIFF files that can be loaded into a GIS and/or Remote Sensing software program. \n", "***\n", "### Example: Converting a swath ECO3ETPTJPL.001 HDF5 file into a GeoTIFF with a defined CRS and comparing ECOSTRESS Evapotranspiration (ET) with ground-based ET observations from an AmeriFlux flux tower location in California. \n", "#### Data Used in the Example: \n", "- Data Product: ECOSTRESS Evapotranspiration PT-JPL Daily L3 Global 70m Version 1 ([ECO3ETPTJPL.001](https://doi.org/10.5067/ECOSTRESS/ECO3ETPTJPL.001)) \n", " - Science Dataset (SDS) layers: \n", " - ETinst \n", " - ETinstUncertainty \n", "- Data Product: ECOSTRESS Geolocation Daily L1B Global 70m Version 1 ([ECO1BGEO.001](https://doi.org/10.5067/ECOSTRESS/ECO1BGEO.001)) \n", " - Science Dataset (SDS) layers: \n", " - Latitude \n", " - Longitude \n", "- Data Product: AmeriFlux Ground Observations for [Flux Tower US-CZ3](https://ameriflux.lbl.gov/sites/siteinfo/US-CZ3): Sierra Critical Zone, Sierra Transect, Sierran Mixed Conifer, P301\n", " - Variables: \n", " - Latent Heat (W/m$^{2}$) \n", "*** \n", "# Topics Covered:\n", "1. **Getting Started** \n", " 1a. Import Packages \n", " 1b. Set Up the Working Environment \n", " 1c. Retrieve Files \n", "2. **Importing and Interpreting Data** \n", " 2a. Open an ECOSTRESS HDF5 File and Read File Metadata \n", " 2b. Subset SDS Layers \n", "3. **Performing Swath2grid Conversion** \n", " 3a. Import Geolocation File \n", " 3b. Define Projection and Output Grid \n", " 3c. Read SDS Metadata \n", " 3d. Perform K-D Tree Resampling \n", " 3e. Basic Image Processing \n", "4. **Exporting Results** \n", " 4a. Set Up a Dictionary \n", " 4b. Define CRS and Export as GeoTIFFs \n", "5. **Combining ECOSTRESS and AmeriFlux Tower Data** \n", " 5a. Loading Tables with Pandas \n", " 5b. Locate ECOSTRESS Pixel from Lat/Lon Coordinates \n", "6. **Visualizing Data** \n", " 6a. Create Colormap \n", " 6b. Plot ET Data \n", " 6c. Exporting an Image \n", "7. **Comparing Observations** \n", " 7a. Calculate Distribution of ECOSTRESS Data \n", " 7b. Visualize Ground Observations \n", " 7c. Combine ECOSTRESS and Ground Observations \n", "\n", "***\n", "# Before Starting this Tutorial: \n", "#### If you are simply looking to batch process/perform the swath2grid conversion for ECOSTRESS files, be sure to check out the [ECOSTRESS Swath to Grid Conversion Script](https://git.earthdata.nasa.gov/projects/LPDUR/repos/ecostress_swath2grid/browse).\n", "\n", "NOTE: This tutorial was developed specifically for the ECOSTRESS Evapotranspiration PT-JPL Level 3, Version 1 HDF5 files and will need to be adapted to work with other ECOSTRESS products. \n", "## Dependencies: \n", "*Disclaimer: This tutorial has been tested on Windows and MacOS using the specifications identified below.* \n", "+ #### Python Version 3.8 \n", " + `h5py` \n", " + `pyproj` \n", " + `matplotlib` \n", " + `pandas` \n", " + `pyresample` \n", " + `pandas` \n", " + `scipy` \n", " + `gdal` \n", " + `jupyter notebook`\n", "\n", "- A [NASA Earthdata Login](https://urs.earthdata.nasa.gov/) account is required to download the data used in this tutorial. You can create an account at the link provided. \n", "- The [Geospatial Data Abstraction Library](http://www.gdal.org/) (GDAL) is required.\n", "\n", "---\n", "# Procedures: \n", "## Getting Started: \n", "#### 1. This tutorial uses data from ECOSTRESS Version 1, including an ECO3ETPTJPL.001 (and accompanying ECO1BGEO.001) observation from August 05, 2018. You can download the files directly from the [LP DAAC Data Pool](https://e4ftl01.cr.usgs.gov/ECOSTRESS/) at:\n", " - [ECOSTRESS_L1B_GEO_00468_007_20180805T220314_0601_03.h5](https://e4ftl01.cr.usgs.gov/ECOSTRESS/ECO1BGEO.001/2018.08.05/ECOSTRESS_L1B_GEO_00468_007_20180805T220314_0601_03.h5) \n", " - [ECOSTRESS_L3_ET_PT-JPL_00468_007_20180805T220314_0601_04.h5](https://e4ftl01.cr.usgs.gov/ECOSTRESS/ECO3ETPTJPL.001/2018.08.05/ECOSTRESS_L3_ET_PT-JPL_00468_007_20180805T220314_0601_04.h5) \n", "**A [NASA Earthdata Login](https://urs.earthdata.nasa.gov/) account is required to download the data used in this tutorial. You can create an account at the link provided.** \n", "\n", " - Ancillary Files Needed: \n", " - The AmeriFlux Latent Heat data used in Section 4 can be downloaded via a [csv file](https://git.earthdata.nasa.gov/projects/LPDUR/repos/tutorial-ecostress/raw/tower_data.csv?at=refs%2Fheads%2Fmain). \n", "\n", "The `tower_data.csv` file will need to be downloaded into the same directory as the tutorial in order to execute the tutorial. \n", "#### 2.\tCopy/clone/download the [ECOSTRESS Tutorial repo](https://git.earthdata.nasa.gov/rest/api/latest/projects/LPDUR/repos/tutorial-ecostress/archive?format=zip), or the desired tutorial from the LP DAAC Data User Resources Repository: \n", " - [Working with ECOSTRESS Evapotranspiration Data in Python Jupyter Notebook](https://git.earthdata.nasa.gov/projects/LPDUR/repos/tutorial-ecostress/browse/ECOSTRESS_Tutorial.ipynb) \n", "
\n", " | Date/Time | \n", "Time | \n", "LE | \n", "
---|---|---|---|
1 | \n", "2018-08-05 09:30:00 | \n", "09:30:00 | \n", "18.027752 | \n", "
3 | \n", "2018-08-05 10:00:00 | \n", "10:00:00 | \n", "68.495970 | \n", "
5 | \n", "2018-08-05 10:30:00 | \n", "10:30:00 | \n", "89.050031 | \n", "
7 | \n", "2018-08-05 11:00:00 | \n", "11:00:00 | \n", "154.564199 | \n", "
9 | \n", "2018-08-05 11:30:00 | \n", "11:30:00 | \n", "118.685090 | \n", "
11 | \n", "2018-08-05 12:00:00 | \n", "12:00:00 | \n", "107.071870 | \n", "
13 | \n", "2018-08-05 12:30:00 | \n", "12:30:00 | \n", "189.551249 | \n", "
15 | \n", "2018-08-05 13:00:00 | \n", "13:00:00 | \n", "129.985112 | \n", "
19 | \n", "2018-08-05 14:00:00 | \n", "14:00:00 | \n", "139.651745 | \n", "
21 | \n", "2018-08-05 14:30:00 | \n", "14:30:00 | \n", "155.416112 | \n", "
23 | \n", "2018-08-05 15:00:00 | \n", "15:00:00 | \n", "124.511936 | \n", "
25 | \n", "2018-08-05 15:30:00 | \n", "15:30:00 | \n", "106.666146 | \n", "
27 | \n", "2018-08-05 16:00:00 | \n", "16:00:00 | \n", "176.321112 | \n", "
29 | \n", "2018-08-05 16:30:00 | \n", "16:30:00 | \n", "203.363058 | \n", "
31 | \n", "2018-08-05 17:00:00 | \n", "17:00:00 | \n", "166.714904 | \n", "
33 | \n", "2018-08-05 17:30:00 | \n", "17:30:00 | \n", "124.236028 | \n", "
35 | \n", "2018-08-05 18:00:00 | \n", "18:00:00 | \n", "96.232450 | \n", "
37 | \n", "2018-08-05 18:30:00 | \n", "18:30:00 | \n", "133.121365 | \n", "
39 | \n", "2018-08-05 19:00:00 | \n", "19:00:00 | \n", "44.660266 | \n", "
41 | \n", "2018-08-05 19:30:00 | \n", "19:30:00 | \n", "11.618052 | \n", "
43 | \n", "2018-08-05 20:00:00 | \n", "20:00:00 | \n", "44.201492 | \n", "