I can get this code to run and compile the CSV for the RivWidth software in Google Earth Engine. However, all attempts to try different Landsat images with different coordinates results in this error: Element (Error)
Image.load: Image asset ‘LC08_L1TP_178034_20201007_20201018_02_T1’ not found (does not exist or caller does not have access)
Here is the code that works:
// Goal: calculate river centerlines and widths for one Landsat SR image (LC08_L1TP_022034_20130422_20170310_01_T1)
// load in RivWidthCloud
var fns = require('users/eeProject/RivWidthCloudPaper:rwc_landsat_C2.js');
// assign the image product id (LANDSAT_PRODUCT_ID) of the image from which the widths and centerline will be extracted
var imageId = "LE07_L2SP_023035_19990704_20200918_02_T1";
// setting the parameters for the rivwidthcloud (rwc) function
var aoi = ee.Geometry.Polygon(
[[[-89.7637, 36.3137],
[-89.7637, 36.1475],
[-89.5192, 36.1475],
[-89.5192, 36.3137]]], null, false);
var rwc = fns.rwGenSR('Fmask', 4000, 333, 500, aoi);
// apply the rwc function to the image
var widths = rwc(imageId);
// remove the geometry before exporting the width as CSV file
widths = widths.map(function(f) {return(f.setGeometry(null))});
print(widths.first());
// export the result as a CSV file into Google drive
Export.table.toDrive({
collection: widths,
description: imageId,
folder: "",
fileNamePrefix: imageId,
fileFormat: "CSV"});
I tried this, but get that error. Basically I am trying to run this code to get river widths for other Landsat images of my choosing, but any image I try I get that same error.
/ Goal: calculate river centerlines and widths for one Landsat SR image (LC08_L1TP_022034_20130422_20170310_01_T1)
// load in RivWidthCloud
var fns = require('users/eeProject/RivWidthCloudPaper:rwc_landsat_C2.js');
// assign the image product id (LANDSAT_PRODUCT_ID) of the image from which the widths and centerline will be extracted
var imageId = "LANDSAT/LC08/C02/T1_L2/LC08_040027_20210613";
// setting the parameters for the rivwidthcloud (rwc) function
var aoi = ee.Geometry.Polygon(
[[[-113.702, 47.053], // Replace these with the actual coordinates for Blackfoot River
[-113.702, 46.938],
[-113.533, 46.938],
[-113.533, 47.053]]], null, false);
var rwc = fns.rwGenSR('Fmask', 4000, 333, 500, aoi);
// apply the rwc function to the image
var widths = rwc(imageId);
// remove the geometry before exporting the width as CSV file
widths = widths.map(function(f) {return(f.setGeometry(null))});
print(widths.first());
// export the result as a CSV file into Google drive
Export.table.toDrive({
collection: widths,
description: imageId,
folder: "",
New contributor
Sam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.