diff --git a/guides/linked/ee-api-colab-setup.ipynb b/guides/linked/ee-api-colab-setup.ipynb index 5c12eff3d..090d279a0 100644 --- a/guides/linked/ee-api-colab-setup.ipynb +++ b/guides/linked/ee-api-colab-setup.ipynb @@ -255,11 +255,11 @@ "# Import the matplotlib.pyplot module.\n", "import matplotlib.pyplot as plt\n", "\n", - "# Fetch a Landsat image.\n", - "img = ee.Image('LANDSAT/LT05/C01/T1_SR/LT05_034033_20000913')\n", + "# Fetch a Landsat TOA image.\n", + "img = ee.Image('LANDSAT/LT05/C02/T1_TOA/LT05_034033_20000913')\n", "\n", - "# Select Red and NIR bands, scale them, and sample 500 points.\n", - "samp_fc = img.select(['B3','B4']).divide(10000).sample(scale=30, numPixels=500)\n", + "# Select Red and NIR bands and sample 500 points.\n", + "samp_fc = img.select(['B3','B4']).sample(scale=30, numPixels=500)\n", "\n", "# Arrange the sample as a list of lists.\n", "samp_dict = samp_fc.reduceColumns(ee.Reducer.toList().repeat(2), ['B3', 'B4'])\n", diff --git a/samples/python/guides/images11.py b/samples/python/guides/images11.py index 5eddadfd8..85017315c 100644 --- a/samples/python/guides/images11.py +++ b/samples/python/guides/images11.py @@ -15,9 +15,9 @@ """Google Earth Engine Developer's Guide examples for 'Images - Morphological operations'.""" # [START earthengine__images11__morphology] -# Load a Landsat 8 image, select the NIR band, threshold, display. +# Load a Landsat 8 TOA image, select the NIR band, threshold, display. image = ( - ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318').select(4).gt(0.2) + ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318').select(4).gt(0.2) ) # Define a kernel. @@ -29,10 +29,10 @@ ) # Define a map centered on Redwood City, California. -map_opened = geemap.Map(center=[37.5010, -122.1899], zoom=13) +m = geemap.Map(center=[37.5010, -122.1899], zoom=13) # Add the image layers to the map and display it. -map_opened.add_layer(image, None, 'NIR threshold') -map_opened.add_layer(opened, None, 'opened') -display(map_opened) +m.add_layer(image, None, 'NIR threshold') +m.add_layer(opened, None, 'opened') +m # [END earthengine__images11__morphology] diff --git a/tutorials/extract-raster-values-for-points/index.md b/tutorials/extract-raster-values-for-points/index.md index 170f97579..7a3d1163a 100644 --- a/tutorials/extract-raster-values-for-points/index.md +++ b/tutorials/extract-raster-values-for-points/index.md @@ -369,26 +369,18 @@ Enhanced Thematic Mapper Plus (ETM+) from Landsat 7, and Operational Land Imager (OLI) from Landsat 8. The following section prepares these collections so that band names are -consistent and cloud masks are applied. Reflectance among corresponding -bands are roughly congruent for the three sensors when using the surface -reflectance product, therefore the processing steps that follow do not -address inter-sensor harmonization. If you would like to apply a correction, -please see the -["Landsat ETM+ to OLI Harmonization" tutorial](https://developers.google.com/earth-engine/tutorials/community/landsat-etm-to-oli-harmonization) -for more information on the subject. +consistent and cloud masks are applied. #### Prepare the Landsat image collection First, define the function to mask cloud and shadow pixels. ```js -function fmask(img) { - var cloudShadowBitMask = 1 << 3; - var cloudsBitMask = 1 << 5; - var qa = img.select('pixel_qa'); - var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0) - .and(qa.bitwiseAnd(cloudsBitMask).eq(0)); - return img.updateMask(mask); +// Scales and masks Landsat 8 surface reflectance images. +function scaleAndMask(image) { + var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0); + var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2); + return image.select().addBands(opticalBands).updateMask(qaMask); } ``` @@ -400,35 +392,32 @@ between OLI and TM/ETM+, and it will make future index calculations easier. // Selects and renames bands of interest for Landsat OLI. function renameOli(img) { return img.select( - ['B2', 'B3', 'B4', 'B5', 'B6', 'B7'], + ['SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7'], ['Blue', 'Green', 'Red', 'NIR', 'SWIR1', 'SWIR2']); } // Selects and renames bands of interest for TM/ETM+. function renameEtm(img) { return img.select( - ['B1', 'B2', 'B3', 'B4', 'B5', 'B7'], + ['SR_B1', 'SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B7'], ['Blue', 'Green', 'Red', 'NIR', 'SWIR1', 'SWIR2']); } ``` Combine the cloud mask and band renaming functions into preparation functions -for OLI and TM/ETM+. If you want to include band harmonization coefficients, -you can combine the `prepOli` and `prepEtm` functions from the -["Landsat ETM+ to OLI Harmonization" tutorial](https://developers.google.com/earth-engine/tutorials/community/landsat-etm-to-oli-harmonization) -with the functions below. +for OLI and TM/ETM+. ```js // Prepares (cloud masks and renames) OLI images. function prepOli(img) { - img = fmask(img); + img = scaleAndMask(img); img = renameOli(img); return img; } // Prepares (cloud masks and renames) TM/ETM+ images. function prepEtm(img) { - img = fmask(img); + img = scaleAndMask(img); img = renameEtm(img); return img; } @@ -441,16 +430,21 @@ the relevant image preparation function. ```js var ptsLandsat = pts.map(bufferPoints(15, true)); -var oliCol = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') +var dateRange = ee.DateRange('2005-01-01', '2015-01-01'); + +var oliCol = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') .filterBounds(ptsLandsat) + .filterDate(dateRange) .map(prepOli); -var etmCol = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR') +var etmCol = ee.ImageCollection('LANDSAT/LE07/C02/T1_L2') .filterBounds(ptsLandsat) + .filterDate(dateRange) .map(prepEtm); -var tmCol = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR') +var tmCol = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2') .filterBounds(ptsLandsat) + .filterDate(dateRange) .map(prepEtm); ``` @@ -475,7 +469,7 @@ var params = { crs: 'EPSG:5070', bands: ['Blue', 'Green', 'Red', 'NIR', 'SWIR1', 'SWIR2'], bandsRename: ['ls_blue', 'ls_green', 'ls_red', 'ls_nir', 'ls_swir1', 'ls_swir2'], - imgProps: ['LANDSAT_ID', 'SATELLITE'], + imgProps: ['LANDSAT_PRODUCT_ID', 'SPACECRAFT_ID'], imgPropsRename: ['img_id', 'satellite'], datetimeName: 'date', datetimeFormat: 'YYYY-MM-dd' @@ -557,13 +551,13 @@ unscaling Landsat SR data: ```js // Define a Landsat image. -var img = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR').first(); +var img = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2').first(); // Print its properties. print(img.propertyNames()); // Select the reflectance bands and unscale them. -var computedImg = img.select('B.*').divide(1e4); +var computedImg = img.select('SR_B.').multiply(0.0000275).add(-0.2); // Print the unscaled image's properties. print(computedImg.propertyNames()); @@ -575,7 +569,7 @@ function to add the source properties to the derived image. ```js // Select the reflectance bands and unscale them. -var computedImg = img.select('B.*').divide(1e4) +var computedImg = img.select('SR_B.').multiply(0.0000275).add(-0.2) .copyProperties(img, img.propertyNames()); // Print the unscaled image's properties. diff --git a/tutorials/landsat-etm-to-oli-harmonization/index.md b/tutorials/landsat-etm-to-oli-harmonization/index.md index 798a04a39..33bf3659e 100644 --- a/tutorials/landsat-etm-to-oli-harmonization/index.md +++ b/tutorials/landsat-etm-to-oli-harmonization/index.md @@ -23,10 +23,12 @@ limitations under the License. -Caution: The procedures described in this tutorial to harmonize Landsat ETM+ and -OLI data may be outdated and not recommended or necessary when working with +WARNING: The procedures described in this tutorial to harmonize Landsat ETM+ and +OLI data are outdated and not recommended or necessary when working with Landsat Collection 2 surface reflectance data. For more information, see the [FAQ entry on Landsat harmonization](https://developers.google.com/earth-engine/faq#is_cross-sensor_landsat_surface_reflectance_harmonization_needed). +Collection 1 data are deprecated and the code in this tutorial will no longer +work or be updated. [Open In Code Editor](https://code.earthengine.google.com/798ae7a268f8e2c8022433b9562785c0) diff --git a/tutorials/landsat-etm-to-oli-harmonization/script.js b/tutorials/landsat-etm-to-oli-harmonization/script.js index 2b4e9a926..caa20e5a0 100644 --- a/tutorials/landsat-etm-to-oli-harmonization/script.js +++ b/tutorials/landsat-etm-to-oli-harmonization/script.js @@ -15,6 +15,12 @@ * limitations under the License. */ +// 2024-07-16: This script is no longer supported. Landsat Collection 1 has been +// deprecated and this script no longer works. Collection 2 is available, but +// the harmonization coefficients described here may not be applicable and the +// improvements made during Collection reprocessing have made harmonization +// generally unnecessary. + // ################################################################ // ### FUNCTIONS ### // ################################################################