ee.Image.reduceRegion

किसी खास इलाके के सभी पिक्सल पर रिड्यूसर लागू करें.

रिड्यूसर में उतने ही इनपुट होने चाहिए जितने इनपुट इमेज में बैंड हैं. इसके अलावा, रिड्यूसर में एक इनपुट होना चाहिए और इसे हर बैंड के लिए दोहराया जाएगा.

यह फ़ंक्शन, रिड्यूसर के आउटपुट की डिक्शनरी दिखाता है.

इस्तेमालरिटर्न
Image.reduceRegion(reducer, geometry, scale, crs, crsTransform, bestEffort, maxPixels, tileScale)शब्दकोश
आर्ग्यूमेंटटाइपविवरण
यह: imageइमेजवह इमेज जिसका साइज़ कम करना है.
reducerरेड्यूसरलागू किया जाने वाला रिड्यूसर.
geometryज्यामिति, डिफ़ॉल्ट: nullवह क्षेत्र जहां डेटा कम करना है. यह इमेज के पहले बैंड के फ़ुटप्रिंट पर डिफ़ॉल्ट रूप से सेट होता है.
scaleफ़्लोट, डिफ़ॉल्ट: nullयह प्रोजेक्शन का नॉमिनल स्केल है, जिसमें काम करना है. यह मीटर में होता है.
crsप्रोजेक्शन, डिफ़ॉल्ट: nullकाम करने के लिए प्रोजेक्शन. अगर यह जानकारी नहीं दी जाती है, तो इमेज के पहले बैंड के प्रोजेक्शन का इस्तेमाल किया जाता है. अगर इसे स्केल के अलावा किसी और एट्रिब्यूट में बताया गया है, तो इसे बताई गई स्केल के हिसाब से फिर से स्केल किया जाता है.
crsTransformसूची, डिफ़ॉल्ट: nullसीआरएस ट्रांसफ़ॉर्म वैल्यू की सूची. यह 3x2 ट्रांसफ़ॉर्म मैट्रिक्स का लाइन-मेजर ऑर्डर है. यह विकल्प, 'स्केल' के साथ इस्तेमाल नहीं किया जा सकता. साथ ही, यह प्रोजेक्शन पर पहले से सेट किए गए किसी भी ट्रांसफ़ॉर्म की जगह ले लेता है.
bestEffortबूलियन, डिफ़ॉल्ट वैल्यू: falseअगर दिए गए स्केल पर पॉलीगॉन में बहुत ज़्यादा पिक्सल शामिल हैं, तो बड़े स्केल का हिसाब लगाएं और उसका इस्तेमाल करें. इससे ऑपरेशन पूरा हो पाएगा.
maxPixelsलंबी, डिफ़ॉल्ट वैल्यू: 10000000कम किए जाने वाले पिक्सल की ज़्यादा से ज़्यादा संख्या.
tileScaleफ़्लोट, डिफ़ॉल्ट: 1एग्रीगेशन टाइल के साइज़ को अडजस्ट करने के लिए, 0.1 से 16 के बीच का स्केलिंग फ़ैक्टर. tileScale को बड़ा सेट करने पर (जैसे, 2 या 4) में छोटी टाइलें इस्तेमाल की जाती हैं. साथ ही, इसमें ऐसी कंप्यूटेशन चालू की जा सकती हैं जो डिफ़ॉल्ट सेटिंग के साथ मेमोरी से बाहर हो जाती हैं.

उदाहरण

कोड एडिटर (JavaScript)

// A Landsat 8 surface reflectance image with SWIR1, NIR, and green bands.
var img = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508')
              .select(['SR_B6', 'SR_B5', 'SR_B3']);

// Santa Cruz Mountains ecoregion geometry.
var geom = ee.FeatureCollection('EPA/Ecoregions/2013/L4')
               .filter('us_l4name == "Santa Cruz Mountains"').geometry();

// Display layers on the map.
Map.setCenter(-122.08, 37.22, 9);
Map.addLayer(img, {min: 10000, max: 20000}, 'Landsat image');
Map.addLayer(geom, {color: 'white'}, 'Santa Cruz Mountains ecoregion');

// Calculate median band values within Santa Cruz Mountains ecoregion. It is
// good practice to explicitly define "scale" (or "crsTransform") and "crs"
// parameters of the analysis to avoid unexpected results from undesired
// defaults when e.g. reducing a composite image.
var stats = img.reduceRegion({
  reducer: ee.Reducer.median(),
  geometry: geom,
  scale: 30,  // meters
  crs: 'EPSG:3310',  // California Albers projection
});

// A dictionary is returned; keys are band names, values are the statistic.
print('Median band values, Santa Cruz Mountains ecoregion', stats);

// You can combine reducers to calculate e.g. mean and standard deviation
// simultaneously. The output dictionary keys are the concatenation of the band
// names and statistic names, separated by an underscore.
var reducer = ee.Reducer.mean().combine({
  reducer2: ee.Reducer.stdDev(),
  sharedInputs: true
});
var multiStats = img.reduceRegion({
  reducer: reducer,
  geometry: geom,
  scale: 30,
  crs: 'EPSG:3310',
});
print('Mean & SD band values, Santa Cruz Mountains ecoregion', multiStats);

Python सेटअप करना

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

import ee
import geemap.core as geemap

Colab (Python)

# A Landsat 8 surface reflectance image with SWIR1, NIR, and green bands.
img = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508').select(
    ['SR_B6', 'SR_B5', 'SR_B3']
)

# Santa Cruz Mountains ecoregion geometry.
geom = (
    ee.FeatureCollection('EPA/Ecoregions/2013/L4')
    .filter('us_l4name == "Santa Cruz Mountains"')
    .geometry()
)

# Display layers on the map.
m = geemap.Map()
m.set_center(-122.08, 37.22, 9)
m.add_layer(img, {'min': 10000, 'max': 20000}, 'Landsat image')
m.add_layer(geom, {'color': 'white'}, 'Santa Cruz Mountains ecoregion')
display(m)

# Calculate median band values within Santa Cruz Mountains ecoregion. It is
# good practice to explicitly define "scale" (or "crsTransform") and "crs"
# parameters of the analysis to avoid unexpected results from undesired
# defaults when e.g. reducing a composite image.
stats = img.reduceRegion(
    reducer=ee.Reducer.median(),
    geometry=geom,
    scale=30,  # meters
    crs='EPSG:3310',  # California Albers projection
)

# A dictionary is returned keys are band names, values are the statistic.
display('Median band values, Santa Cruz Mountains ecoregion', stats)

# You can combine reducers to calculate e.g. mean and standard deviation
# simultaneously. The output dictionary keys are the concatenation of the band
# names and statistic names, separated by an underscore.
reducer = ee.Reducer.mean().combine(
    reducer2=ee.Reducer.stdDev(), sharedInputs=True
)
multi_stats = img.reduceRegion(
    reducer=reducer,
    geometry=geom,
    scale=30,
    crs='EPSG:3310',
)
display('Mean & SD band values, Santa Cruz Mountains ecoregion', multi_stats)