ee.ImageCollection.select

باندهایی را از هر تصویر در یک مجموعه انتخاب کنید.

مجموعه تصاویر را با باندهای انتخاب شده برمی گرداند.

استفاده برمی گرداند
ImageCollection. select (selectors, names ) ImageCollection
استدلال تایپ کنید جزئیات
این: imagecollection ImageCollection نمونه ImageCollection.
selectors فهرست < شی > فهرستی از نام ها، رجکس ها یا شاخص های عددی که باندهای مورد نظر را مشخص می کند.
names List<String>، اختیاری است لیستی از نام های جدید برای باندهای خروجی. باید با تعداد باندهای انتخاب شده مطابقت داشته باشد.

نمونه ها

ویرایشگر کد (جاوا اسکریپت)

// A Sentinel-2 surface reflectance image collection.
var col = ee.ImageCollection('COPERNICUS/S2_SR')
    .filterBounds(ee.Geometry.Point(-122.152, 37.336))
    .filterDate('2021-01-01', '2021-02-01');
print('All band names', col.first().bandNames());

print('Select a band by name',
      col.select('B11').first().bandNames());

print('Select a band by index',
      col.select(10).first().bandNames());

print('Select bands using a list',
      col.select(['B11', 'B8', 'B3']).first().bandNames());

print('Select bands by an argument series',
      col.select('B11', 'B8', 'B3').first().bandNames());

print('Mixing string and integer selectors is valid',
      col.select(10, 'B8', 2).first().bandNames());

print('Rename selected bands using two corresponding lists',
      col.select(['B11', 'B8', 'B3'], ['SWIR1', 'NIR', 'Green'])
      .first().bandNames());

// Use regular expressions to select bands.
print('Match "QA" followed by any two characters',
      col.select('QA..').first().bandNames());

print('Match "B" followed by any character, any number of times',
      col.select('B.*').first().bandNames());

print('Match "B" followed by any character, and any optional third character',
      col.select('B..?').first().bandNames());

print('Match "B" followed by a character in the range 6-8',
      col.select('B[6-8]').first().bandNames());

print('Match "B" followed by a character in the range 1-9 and then 1-2',
      col.select('B[1-9][1-2]').first().bandNames());

print('Match "B" or "QA" each followed by any character, any number of times.',
      col.select('B.*|QA.*').first().bandNames());

راه اندازی پایتون

برای اطلاعات در مورد API پایتون و استفاده از geemap برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.

import ee
import geemap.core as geemap

کولب (پایتون)

# A Sentinel-2 surface reflectance image collection.
col = ee.ImageCollection('COPERNICUS/S2_SR').filterBounds(
    ee.Geometry.Point(-122.152, 37.336)
    ).filterDate('2021-01-01', '2021-02-01')
print('All band names', col.first().bandNames().getInfo())

print('Select a band by name:',
      col.select('B11').first().bandNames().getInfo())

print('Select a band by index:',
      col.select(10).first().bandNames().getInfo())

print('Select bands using a list:',
      col.select(['B11', 'B8', 'B3']).first().bandNames().getInfo())

print('Select bands by an argument series:',
      col.select('B11', 'B8', 'B3').first().bandNames().getInfo())

print('Mixing string and integer selectors is valid:',
      col.select(10, 'B8', 2).first().bandNames().getInfo())

print('Rename selected bands using two corresponding lists:',
      col.select(['B11', 'B8', 'B3'], ['SWIR1', 'NIR', 'Green'])
      .first().bandNames().getInfo())

# Use regular expressions to select bands.
print('Match "QA" followed by any two characters:',
      col.select('QA..').first().bandNames().getInfo())

print('Match "B" followed by any character, any number of times:',
      col.select('B.*').first().bandNames().getInfo())

print('Match "B" followed by any character, and any optional third character:',
      col.select('B..?').first().bandNames().getInfo())

print('Match "B" followed by a character in the range 6-8:',
      col.select('B[6-8]').first().bandNames().getInfo())

print('Match "B" followed by a character in the range 1-9 and then 1-2:',
      col.select('B[1-9][1-2]').first().bandNames().getInfo())

print('Match "B" or "QA" each followed by any character, any number of times:',
      col.select('B.*|QA.*').first().bandNames().getInfo())