{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Landsat 8 Product Page - Level 2\n", "\n", "This notebook contains general information about the landsat 8 satellite and demonstrates how to retrieve and visualise indexed landsat 8 products.\n", "\n", "## About the Landsat Missions\n", "\n", "\"Landsat represents the world's longest continuously acquired collection of space-based moderate-resolution land remote sensing data. Four decades of imagery provides a unique resource for those who work in agriculture, geology, forestry, regional planning, education, mapping, and global change research. Landsat images are also invaluable for emergency response and disaster relief.\" [[1](#References)] \n", "\n", "\"In the mid-1960s an ambitious effort to develop and launch the first civilian Earth observation satellite was started. The goal was achieved on July 23, 1972, with the launch of the Earth Resources Technology Satellite (ERTS-1), which was later renamed Landsat 1. The launches of Landsat 2, Landsat 3, and Landsat 4 followed in 1975, 1978, and 1982, respectively. When Landsat 5 was launched in 1984, no one could have predicted that the satellite would continue to deliver high quality, global data of Earth's land surfaces for 28 years and 10 months until its retirement in June, 2013. Landsat 6, however, failed to achieve orbit in 1993. Landsat 7 was successfully launched in 1999 and, along with Landsat 8 launched in 2013, continues to provide daily global data. Landsat 9 is planned to be launched in late 2020.\" [[2](#References)]\n", "\n", "\n", "Fig 1. Time-line of the working lives of Landsats since 1972\n", "\n", "## Landsat 8\n", "The Landsat 8 satellite images the entire Earth every 16 days in an 8-day offset from Landsat 7. Providing moderate-resolution imagery, from 15 meters to 100 meters, of Earth's land surface and polar regions. The Landsat 8 mission objective is to provide timely, high quality visible and infrared images of all landmass and near-coastal areas on the Earth, continually refreshing an existing Landsat database. Landsat 8 operates in the visible, near-infrared, short wave infrared, and thermal infrared spectrums. Landsat 8 captures more than 700 scenes a day. \n", "\n", "Landsat - 8 Contains two instruements - Operational Land Imager (OLI) and Thermal Infrared Sensor (TIRS). Data captured by these sensors is organised in the following bands.\n", "\n", "|Landsat - 8 OLI and TIRS Bands (um)| Name|Useful for|\n", "|----|----|----|\n", "|30m Coastal/ Aerosol 0.435 - 0.451|Band 1|Coastal and aerosol studies|\n", "|30m Blue 0.452 - 0.512|Band 2|Bathymetric mapping, distinguishing soil from vegetation, and deciduous from coniferous vegetation|\n", "|30m Green 0.533 - 0.590|Band 3|Emphasizes peak vegetation, which is useful for assessing plant vigor\n", "|\n", "|30m Red 0.636 - 0.673|Band 4|Discriminates vegetation slopes|\n", "|30m NIR 0.851 - 0.879|Band 5|Emphasizes biomass content and shorelines|\n", "|30m SWIR 1 1.566- 0.651|Band 6|Discriminates moisture content of soil and vegetation; penetrates thin clouds|\n", "|30m SWIR 2 2.107 - 2.294|Band 7|Improved moisture content of soil and vegetation and thin cloud penetration|\n", "|15m Pancromatic 0.503 - 0.676|Band 8|15 meter resolution, sharper image definition|\n", "|30m Cirrus 1.363 - 1.384|Band 9|Improved detection of cirrus cloud contamination|\n", "|100m TIRS 1 10.6 - 11.19|Band 10|100 meter resolution, thermal mapping and estimated soil moisture|\n", "|100m TIRS 2 11.5 - 12.51|Band 11|100 meter resolution, Improved thermal mapping and estimated soil moisture|\n", "\n", "\n", "Fig 2. Landsat 8 Spectral Bands and Wavelengths compared to Landsat 7 ETM+\n", "\n", "A Quality Assessment band is also included with each Landsat 8 data product. This band allows users to apply per pixel filters to the Landsat 8 Operational Land Imager (OLI)-only and Landsat 8 OLI/Thermal Infrared Sensor (OLI/TIRS)-combined data products.\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import modules" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# %matplotlib inline\n", "import sys\n", "import warnings\n", "import datacube\n", "import matplotlib.pyplot as plt\n", "from datacube.storage import masking\n", "from utils.utils import (\n", " lat_lon_to_epsg,\n", " three_band_image,\n", " load_config_extents,\n", " transform_to_wgs,\n", " load_config)\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Available Landsat products\n", "The `list_products` method in the Datacube class displays the names and details of all available products. In the below cell we will query what Landsat 8 Products are currently indexed in our instance." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Connect to a datacube\n", "dc = datacube.Datacube(app='Intro to Landsat')\n", "\n", "# List metadata for all Landsat NBAR and NBART products available in DEA\n", "dc_products = dc.list_products()\n", "display_columns = ['name', 'description', 'product_type', 'crs', 'resolution', 'spatial_dimensions']\n", "dc_products[dc_products['name'].str.contains(\"ls8|ls8\")][display_columns].set_index('name')\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Landsat 8 Products\n", "\n", "Acquired landsat 8 data undergo a number of processing steps before it can be used for any applications, processing includes geometric algorithms to use the Earth ellipsoid and terrain surface information in conjunction with spacecraft ephemeris and attitude data, and knowledge of the OLI and TIRS instruments and L8 satellite geometry, to relate locations in image space (band, detector, sample) to geodetic object space (latitude, longitude, and elevation).\n", "\n", "These algorithms are used to create three level tiers of products and are reffered to as Level 1 output products, data within these products are broken down into Tier 1, Tier 2, and Real-Time. \n", "\n", "Data in Tier 1 meet formal geometric and radiometric quality criteria. Tier 2 do not meet the Tier 1 criteria. The Real-Time Tier contains data immediately after acquisitions that use estimated parameters. Real-Time data are reprocessed and assessed for inclusion into Tier 1 or Tier 2 as soon as final parameters are available.\n", "\n", "### Landsat 8 Collection 1 Level 2\n", "\n", "The landsat 8 Surface Reflectance data collection 1 level 2 under goes additional processing that adheres to the Landsat Surface Reflectance Code (LaSRC), which makes use of the coastal aerosol band to perform aerosol inversion tests, uses auxiliary climate data from MODIS and uses a unique radiative transfer model. LaSRC hardcodes the view zenith angle to “0”, and the solar zenith and view zenith angles are used for calculations as part of the atmospheric correction.\n", "\n", "Specific details about the LaSRC algorithm and Landsat 8 Surface Reflectance data products can be found in the Landsat 8 Surface Reflectance Product Guide (https://landsat.usgs.gov/sites/default/files/documents/lasrc_product_guide.pdf).\n", "\n", "The Level 2 Pixel Quality Assessment band is populated from the Level 1 Quality Assessment band, specifically Cloud Confidence, Cloud Shadow, and Snow/Ice flags derived from the CFMask algorithm. In order to support science data products using level 2 as input, water values are re-calculated, and high confidence cloud pixels are dilated, making pixel_qa compare to the legacyt CFMask bands.\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Below is a demonstration of how to access this data using the ODC python api, if you're not a data python user you can use our data exploration notebooks to use this data." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "## Let's load some real time data and visualise it.\n", "\n", "#You can change these coordinates and time to suit what you'd like\n", "\n", "lon_min,lon_max,lat_min,lat_max = [31,31.25,-0.75,-1]\n", "date_range = (\"2018-01-01\",\"2018-06-01\")\n", "\n", "# Get the EPSG of a WGS UTM coordinate reference system that is appropriate for our data\n", "EPSG = lat_lon_to_epsg(lat_max,lon_min)\n", "\n", "#We're going to request a data cube projected into the local UTM zone.\n", "\n", "data_cube = dc.load(\n", " product='ls8_usgs_sr_scene',\n", " x=(lon_min, lon_max),\n", " y=(lat_min, lat_max), \n", " output_crs='epsg:' + EPSG,\n", " resolution=(-30, 30),\n", " time = date_range)\n", "data_cube" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The data has been returned to us as a data cube, to find out more about what a datacube is please run the ODC Functionality notebook.\n", "\n", "Let's use the quality band to filter out all areas where cloud and saturation is present." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Create mask around all pixels deemed good according to parameters around cloud cover and saturation.\n", "clean_pixel_mask = masking.make_mask(\n", " data_cube.pixel_qa,\n", " cloud='no_cloud')\n", "masked_cloud = data_cube.where(clean_pixel_mask)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Creating a 'true colour' image using three bands\n", "We can also plot combinations of multiple bands as a colour RGB image by converting the xarray dataset to a three band data array, using `.isel(time=1)` to pull out a single time-step to plot, then using the `.plot.imshow` method to plot.\n", "\n", "By specifying the `red`, `green` and `blue` bands, we can produce a ['true colour' plot](https://crisp.nus.edu.sg/~research/tutorial/opt_int.htm) that approximates how the landscape would appear to the human eye. Note however that below we use the `robust=True` argument to remove extreme values and result in a colour-enhanced image:\n", "\n", "Landsat 8 measurement band measurements are:\n", "\n", " ('1', 'coastal_aerosol')\n", " ('2', 'blue')\n", " ('3', 'green')\n", " ('4', 'red')\n", " ('5', 'nir')\n", " ('6', 'swir1')\n", " ('7', 'swir2')\n", " ('8', 'panchromatic')\n", " ('9', 'cirrus')\n", " ('10', 'lwir1')\n", " ('11', 'lwir2')\n", " ('QUALITY', 'quality')]\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# change the measurements to explore true colour or false colour three band images\n", "\n", "#bands = ['red', 'green', 'blue'] #True Colour\n", "bands = ['swir1', 'nir', 'green'] #False Colour\n", "\n", "#change time step to run through time, below will display both an image \n", "#with clouds and with clouds filtered out}\n", "time_step = 2\n", "\n", "data_cube[bands].isel(time=time_step).to_array().plot.imshow(robust=True, figsize=(10, 10))\n", "masked_cloud[bands].isel(time=time_step).to_array().plot.imshow(robust=True, figsize=(10, 10))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Visualising All the Images in the cube\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "# change the measurements to explore true colour or false colour three band images\n", "\n", "#bands = ['red', 'green', 'blue'] #True Colour\n", "bands = ['swir1', 'nir', 'green'] #False Colour\n", "\n", "no_time_steps = len(data_cube.time)\n", "\n", "data_cube[bands].isel(time=list(range(no_time_steps))).to_array().plot.imshow(row='time', robust=True,figsize=(10, 8*no_time_steps))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### References\n", "\n", "1. USGS, 2018a. *Landsat Project Description | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm. \n", "2. USGS, 2018b. *Landsat Missions Timeline | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm \n", "3. USGS, 2018c. *Landsat 5 History | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm \n", "4. USGS, 2018d. *Landsat 6 History | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm \n", "5. USGS, 2018e. *Landsat 7 | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm \n", "6. USGS, 2018f. *Landsat 8 | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm \n", "7. USGS, 2018g. *Landsat 9 | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm \n", "8. USGS, 2018h. *Landsat 7 Data Users Handbook - Section 2 | Landsat Missions*, Page Last Modified: 04/25/18 01:57 pm \n", "\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.7" } }, "nbformat": 4, "nbformat_minor": 2 }