You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Google Earth Engine中编写循环批量导出时序影像?

Batch Export GOES-16 FRP Images in Earth Engine

Got it, let's get you set up to batch export all those 287 FRP images instead of doing it one by one! The key here is to leverage client-side JavaScript looping (since Earth Engine's server-side functions can't directly trigger export tasks) to create export jobs for every image in your date range.

Modified Script for Batch Export

Here's the updated code that will generate export tasks for all images in your 2021-08-05 to 2021-08-06 window, with filenames formatted as FRP0, FRP1, ..., FRP286:

var USgeometry = ee.Geometry.Rectangle({coords: [-122.15, 41.25, -121.25, 42], geodesic: false});

Map.centerObject(USgeometry, 10);

// Clip images to your ROI
var clipToCol = function(image){
  return image.clip(USgeometry);
};

// Load and filter the image collection
var collection = ee.ImageCollection('NOAA/GOES/16/FDCC')
  .filterDate('2021-08-05', '2021-08-06')
  .map(clipToCol);
var listOfImages = collection.toList(collection.size());

// Get total image count (convert server-side value to client-side)
collection.size().evaluate(function(totalImages) {
  // Loop through each image index
  for (var i = 0; i < totalImages; i++) {
    var image = ee.Image(listOfImages.get(i));
    var powerBand = image.select('Power');
    
    // Create export task for each image
    Export.image.toDrive({
      image: powerBand,
      description: 'FRP' + i,
      crs: 'EPSG:3031',
      scale: 100,
      region: USgeometry,
      folder: 'GOES_FRP_Batch' // Optional: Organize exports in a Drive folder
    });
  }
});

Key Changes & Notes

  • Client-Side Looping: We use .evaluate() to pull the total number of images from Earth Engine's server to your browser (client-side), so we can use a standard JavaScript for loop to iterate over each image.
  • Auto-Naming: The description field uses 'FRP' + i to automatically generate sequential filenames matching your request.
  • Optional Folder: Adding the folder parameter will save all exports to a dedicated Google Drive folder (it will create the folder if it doesn't exist), which keeps your Drive organized.

How to Run the Batch Exports

  1. Paste this script into the Earth Engine Code Editor and run it.
  2. Click the Tasks tab in the top-right corner of the editor—you'll see all 287 export tasks listed there.
  3. Select all tasks (hold Ctrl/Cmd to multi-select), then click the Run button for any selected task to start them all at once.

Important Tips

  • Storage Check: Make sure your Google Drive has enough space for all exports. Each 100m-resolution image will be a few MB, so total usage should be manageable, but double-check to avoid failures.
  • Rate Limits: Earth Engine has limits on concurrent export tasks. If you run into errors, try splitting the batch into smaller groups (e.g., 50 tasks at a time) instead of running all 287 at once.

内容的提问来源于stack exchange,提问作者Sean f

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 16:50:16