ImageCollection के बारे में खास जानकारी

ImageCollection, इमेज का स्टैक या क्रम होता है.

कलेक्शन आईडी से बनाना

ImageCollection को लोड करने के लिए, Earth Engine ऐसेट आईडी को ImageCollection कंस्ट्रक्टर में चिपकाएं. डेटा कैटलॉग में, ImageCollection आईडी देखे जा सकते हैं. उदाहरण के लिए, Sentinel-2 के ज़रिए इकट्ठा किए गए, सतह के रिफ़्लेक्शन डेटा का कलेक्शन लोड करने के लिए:

कोड एडिटर (JavaScript)

var sentinelCollection = ee.ImageCollection('COPERNICUS/S2_SR');

Python सेटअप

Python API के बारे में जानकारी पाने और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

sentinel_collection = ee.ImageCollection('COPERNICUS/S2_SR')

इस कलेक्शन में, सार्वजनिक कैटलॉग में मौजूद हर Sentinel-2 इमेज शामिल होती है. बहुत सारे हैं. आम तौर पर, संग्रह को यहां या यहां दिखाए गए तरीके से फ़िल्टर किया जाता है.

इमेज की सूची से बनाना

कॉन्स्ट्रक्टर ee.ImageCollection() या सुविधाजनक तरीका ee.ImageCollection.fromImages(), इमेज की सूचियों से इमेज कलेक्शन बनाता है. मौजूदा कलेक्शन को मर्ज करके भी, इमेज के नए कलेक्शन बनाए जा सकते हैं. उदाहरण के लिए:

कोड एडिटर (JavaScript)

// Create arbitrary constant images.
var constant1 = ee.Image(1);
var constant2 = ee.Image(2);

// Create a collection by giving a list to the constructor.
var collectionFromConstructor = ee.ImageCollection([constant1, constant2]);
print('collectionFromConstructor: ', collectionFromConstructor);

// Create a collection with fromImages().
var collectionFromImages = ee.ImageCollection.fromImages(
  [ee.Image(3), ee.Image(4)]);
print('collectionFromImages: ', collectionFromImages);

// Merge two collections.
var mergedCollection = collectionFromConstructor.merge(collectionFromImages);
print('mergedCollection: ', mergedCollection);

// Create a toy FeatureCollection
var features = ee.FeatureCollection(
  [ee.Feature(null, {foo: 1}), ee.Feature(null, {foo: 2})]);

// Create an ImageCollection from the FeatureCollection
// by mapping a function over the FeatureCollection.
var images = features.map(function(feature) {
  return ee.Image(ee.Number(feature.get('foo')));
});

// Print the resultant collection.
print('Image collection: ', images);

Python सेटअप

Python API के बारे में जानकारी पाने और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

# Create arbitrary constant images.
constant_1 = ee.Image(1)
constant_2 = ee.Image(2)

# Create a collection by giving a list to the constructor.
collection_from_constructor = ee.ImageCollection([constant_1, constant_2])
display('Collection from constructor:', collection_from_constructor)

# Create a collection with fromImages().
collection_from_images = ee.ImageCollection.fromImages(
    [ee.Image(3), ee.Image(4)]
)
display('Collection from images:', collection_from_images)

# Merge two collections.
merged_collection = collection_from_constructor.merge(collection_from_images)
display('Merged collection:', merged_collection)

# Create a toy FeatureCollection
features = ee.FeatureCollection(
    [ee.Feature(None, {'foo': 1}), ee.Feature(None, {'foo': 2})]
)

# Create an ImageCollection from the FeatureCollection
# by mapping a function over the FeatureCollection.
images = features.map(lambda feature: ee.Image(ee.Number(feature.get('foo'))))

# Display the resultant collection.
display('Image collection:', images)

ध्यान दें कि इस उदाहरण में, ImageCollection बनाने के लिए, FeatureCollection पर Image दिखाने वाले फ़ंक्शन को मैप किया गया है. ImageCollection सेक्शन में मैपिंग में मैपिंग के बारे में ज़्यादा जानें. FeatureCollection सेक्शन में जाकर, सुविधा कलेक्शन के बारे में ज़्यादा जानें.

सीओजी की सूची से बनाना

Cloud Storage में मौजूद GeoTiff फ़ाइलों से ImageCollection बनाएं. उदाहरण के लिए:

कोड एडिटर (JavaScript)

// All the GeoTiffs are in this folder.
var uriBase = 'gs://gcp-public-data-landsat/LC08/01/001/002/' +
    'LC08_L1GT_001002_20160817_20170322_01_T2/';

// List of URIs, one for each band.
var uris = ee.List([
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B2.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B3.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B4.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF',
]);

// Make a collection from the list of images.
var images = uris.map(ee.Image.loadGeoTIFF);
var collection = ee.ImageCollection(images);

// Get an RGB image from the collection of bands.
var rgb = collection.toBands().rename(['B2', 'B3', 'B4', 'B5']);
Map.centerObject(rgb);
Map.addLayer(rgb, {bands: ['B4', 'B3', 'B2'], min: 0, max: 20000}, 'rgb');

Python सेटअप

Python API के बारे में जानकारी पाने और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

# All the GeoTiffs are in this folder.
uri_base = (
    'gs://gcp-public-data-landsat/LC08/01/001/002/'
    + 'LC08_L1GT_001002_20160817_20170322_01_T2/'
)

# List of URIs, one for each band.
uris = ee.List([
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B2.TIF',
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B3.TIF',
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B4.TIF',
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF',
])

# Make a collection from the list of images.
images = uris.map(lambda uri: ee.Image.loadGeoTIFF(uri))
collection = ee.ImageCollection(images)

# Get an RGB image from the collection of bands.
rgb = collection.toBands().rename(['B2', 'B3', 'B4', 'B5'])
m = geemap.Map()
m.center_object(rgb)
m.add_layer(rgb, {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 20000}, 'rgb')
m

Cloud GeoTiffs से इमेज लोड करने के बारे में ज़्यादा जानें.

Zarr v2 कलेक्शन से बनाना

ज़्यादा डाइमेंशन में इमेज स्लाइस लेकर, Cloud Storage में Zarr v2 कलेक्शन से ImageCollection बनाएं. उदाहरण के लिए:

कोड एडिटर (JavaScript)

var timeStart = 1000000;
var timeEnd = 1000048;
var zarrV2ArrayImages = ee.ImageCollection.loadZarrV2Array({
  uri:
      'gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',
  proj: 'EPSG:4326',
  axis: 0,
  starts: [timeStart],
  ends: [timeEnd]
});

print(zarrV2ArrayImages);

Map.addLayer(zarrV2ArrayImages, {min: -0.0001, max: 0.00005}, 'Evaporation');

Python सेटअप

Python API के बारे में जानकारी पाने और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

time_start = 1000000
time_end = 1000048
zarr_v2_array_images = ee.ImageCollection.loadZarrV2Array(
    uri='gs://gcp-public-data-arco-era5/ar/full_37-1h-0p25deg-chunk-1.zarr-v3/evaporation/.zarray',
    proj='EPSG:4326',
    axis=0,
    starts=[time_start],
    ends=[time_end],
)

display(zarr_v2_array_images)

m = geemap.Map()
m.add_layer(
    zarr_v2_array_images, {'min': -0.0001, 'max': 0.00005}, 'Evaporation'
)
m