ee.Image.unmask

यह फ़ंक्शन, इनपुट इमेज के मास्क और वैल्यू को दूसरी इमेज के मास्क और वैल्यू से बदलता है. ऐसा उन सभी जगहों पर किया जाता है जहां इनपुट मास्क की वैल्यू शून्य होती है. आउटपुट इमेज में, इनपुट इमेज का मेटाडेटा मौजूद रहता है. डिफ़ॉल्ट रूप से, आउटपुट इमेज में भी इनपुट इमेज का फ़ुटप्रिंट बना रहता है. हालांकि, sameFootprint को false पर सेट करने से फ़ुटप्रिंट को बढ़ाया जा सकता है.

इस्तेमालरिटर्न
Image.unmask(value, sameFootprint)इमेज
आर्ग्यूमेंटटाइपविवरण
यह: inputइमेजइनपुट इमेज.
valueइमेज, डिफ़ॉल्ट: nullइनपुट इमेज के मास्क्ड पिक्सल के लिए नई वैल्यू और मास्क. अगर इसे तय नहीं किया जाता है, तो डिफ़ॉल्ट रूप से, हर जगह मान्य होने वाली शून्य इमेज का इस्तेमाल किया जाता है.
sameFootprintबूलियन, डिफ़ॉल्ट: trueअगर इस विकल्प को सही पर सेट किया जाता है या इसे सेट नहीं किया जाता है, तो आउटपुट में इनपुट इमेज का फ़ुटप्रिंट बना रहता है. अगर यह वैल्यू 'गलत' है, तो आउटपुट का फ़ुटप्रिंट, इनपुट फ़ुटप्रिंट और वैल्यू इमेज के फ़ुटप्रिंट का यूनीयन होता है.

उदाहरण

कोड एडिटर (JavaScript)

// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');
var trueColorViz = {
  bands: ['B4', 'B3', 'B2'],
  min: 0,
  max: 2700,
  gamma: 1.3
};
print('Sentinel-2 image', img);
Map.setCenter(-122.36, 37.47, 10);
Map.addLayer(img, trueColorViz, 'Sentinel-2 image');

// Create a Boolean land mask from the SWIR1 band; water is value 0, land is 1.
var landMask = img.select('B11').gt(100);
print('Land mask', landMask);
Map.addLayer(landMask, {palette: ['blue', 'lightgreen']}, 'Land mask');

// Apply the single-band land mask to all image bands; pixel values equal to 0
// in the mask become invalid in the image.
var imgMasked = img.updateMask(landMask);
print('Image, land only', imgMasked);
Map.addLayer(imgMasked, trueColorViz, 'Image, land only');

// Set invalid masked pixels to a new value, e.g. a constant nodata value
// when exporting an image as GeoTIFF.
var imgUnmasked = imgMasked.unmask(32767);
print('Image, unmasked', imgMasked);
Map.addLayer(imgUnmasked, trueColorViz, 'Image, unmasked');

// Reset masked pixels to valid, fill with default value 0, input footprint.
var maskResetFootprint = imgMasked.unmask();
print('Image mask reset, footprint', maskResetFootprint);
Map.addLayer(maskResetFootprint, trueColorViz, 'Image mask reset, footprint');

// Reset masked pixels to valid, fill with default value 0, everywhere.
var maskResetEverywhere = imgMasked.unmask({sameFootprint: false});
print('Image mask reset, everywhere', maskResetEverywhere);
Map.addLayer(maskResetEverywhere, trueColorViz, 'Image mask reset, everywhere');

// Fill masked pixels with pixels from a different image.
var fill = ee.Image('COPERNICUS/S2_SR/20200618T184919_20200618T190341_T10SEG');
var imgFilled = imgMasked.unmask(fill);
print('Image, filled', imgFilled);
Map.addLayer(imgFilled, trueColorViz, 'Image, filled');

Python सेटअप करना

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

import ee
import geemap.core as geemap

Colab (Python)

# A Sentinel-2 surface reflectance image.
img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')
true_color_viz = {
    'bands': ['B4', 'B3', 'B2'],
    'min': 0,
    'max': 2700,
    'gamma': 1.3,
}
display('Sentinel-2 image', img)
m = geemap.Map()
m.set_center(-122.36, 37.47, 10)
m.add_layer(img, true_color_viz, 'Sentinel-2 image')

# Create a Boolean land mask from the SWIR1 band water is value 0, land is 1.
land_mask = img.select('B11').gt(100)
display('Land mask', land_mask)
m.add_layer(land_mask, {'palette': ['blue', 'lightgreen']}, 'Land mask')

# Apply the single-band land mask to all image bands pixel values equal to 0
# in the mask become invalid in the image.
img_masked = img.updateMask(land_mask)
display('Image, land only', img_masked)
m.add_layer(img_masked, true_color_viz, 'Image, land only')

# Set invalid masked pixels to a new value, e.g. a constant nodata value
# when exporting an image as GeoTIFF.
img_unmasked = img_masked.unmask(32767)
display('Image, unmasked', img_masked)
m.add_layer(img_unmasked, true_color_viz, 'Image, unmasked')

# Reset masked pixels to valid, fill with default value 0, input footprint.
mask_reset_footprint = img_masked.unmask()
display('Image mask reset, footprint', mask_reset_footprint)
m.add_layer(mask_reset_footprint, true_color_viz, 'Image mask reset, footprint')

# Reset masked pixels to valid, fill with default value 0, everywhere.
mask_reset_everywhere = img_masked.unmask(sameFootprint=False)
display('Image mask reset, everywhere', mask_reset_everywhere)
m.add_layer(
    mask_reset_everywhere, true_color_viz, 'Image mask reset, everywhere'
)

# Fill masked pixels with pixels from a different image.
fill = ee.Image('COPERNICUS/S2_SR/20200618T184919_20200618T190341_T10SEG')
img_filled = img_masked.unmask(fill)
display('Image, filled', img_filled)
m.add_layer(img_filled, true_color_viz, 'Image, filled')
m