公告 :凡是在
2025 年 4 月 15 日前 註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格 ,才能繼續存取。如未在 2025 年 9 月 26 日前完成驗證,存取權可能會暫停。
提供意見
ee.Image.mod
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
針對 image1 和 image2 中每個相符的波段組合,計算第一個值除以第二個值所得的餘數。如果 image1 或 image2 只有 1 個頻帶,則會與另一張圖片中的所有頻帶進行比較。如果圖片的波段數量相同,但名稱不同,系統會依自然順序成對使用。輸出頻帶會以較長的輸入命名,如果長度相同,則會以 image1 的順序命名。輸出像素的類型是輸入類型的聯集。
引數 類型 詳細資料 這個:image1
圖片 用來擷取左運算元頻帶的圖片。 image2
圖片 系統會從這張圖片擷取右運算元頻帶。
範例
程式碼編輯器 (JavaScript)
// A Sentinel-2 surface reflectance image.
var img = ee . Image ( 'COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG' );
// Subset two image bands and display them on the map.
var swir1 = img . select ( 'B11' );
var swir2 = img . select ( 'B12' );
Map . setCenter ( - 122.276 , 37.456 , 12 );
Map . addLayer ( swir1 , { min : 0 , max : 3000 }, 'swir1' );
Map . addLayer ( swir2 , { min : 0 , max : 3000 }, 'swir2' );
// The following examples demonstrate ee.Image arithmetic methods using two
// single-band ee.Image inputs.
var addition = swir1 . add ( swir2 );
Map . addLayer ( addition , { min : 100 , max : 6000 }, 'addition' );
var subtraction = swir1 . subtract ( swir2 );
Map . addLayer ( subtraction , { min : 0 , max : 1500 }, 'subtraction' );
var multiplication = swir1 . multiply ( swir2 );
Map . addLayer ( multiplication , { min : 1.9e5 , max : 9.4e6 }, 'multiplication' );
var division = swir1 . divide ( swir2 );
Map . addLayer ( division , { min : 0 , max : 3 }, 'division' );
var remainder = swir1 . mod ( swir2 );
Map . addLayer ( remainder , { min : 0 , max : 1500 }, 'remainder' );
// If a number input is provided as the second argument, it will automatically
// be promoted to an ee.Image object, a convenient shorthand for constants.
var exponent = swir1 . pow ( 3 );
Map . addLayer ( exponent , { min : 0 , max : 2e10 }, 'exponent' );
Python 設定
請參閱
Python 環境 頁面,瞭解 Python API 和如何使用 geemap
進行互動式開發。
import ee
import geemap.core as geemap
Colab (Python)
# A Sentinel-2 surface reflectance image.
img = ee . Image ( 'COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG' )
# Subset two image bands and display them on the map.
swir_1 = img . select ( 'B11' )
swir_2 = img . select ( 'B12' )
m = geemap . Map ()
m . set_center ( - 122.276 , 37.456 , 12 )
m . add_layer ( swir_1 , { 'min' : 0 , 'max' : 3000 }, 'swir_1' )
m . add_layer ( swir_2 , { 'min' : 0 , 'max' : 3000 }, 'swir_2' )
# The following examples demonstrate ee.Image arithmetic methods using two
# single-band ee.Image inputs.
addition = swir_1 . add ( swir_2 )
m . add_layer ( addition , { 'min' : 100 , 'max' : 6000 }, 'addition' )
subtraction = swir_1 . subtract ( swir_2 )
m . add_layer ( subtraction , { 'min' : 0 , 'max' : 1500 }, 'subtraction' )
multiplication = swir_1 . multiply ( swir_2 )
m . add_layer ( multiplication , { 'min' : 1.9e5 , 'max' : 9.4e6 }, 'multiplication' )
division = swir_1 . divide ( swir_2 )
m . add_layer ( division , { 'min' : 0 , 'max' : 3 }, 'division' )
remainder = swir_1 . mod ( swir_2 )
m . add_layer ( remainder , { 'min' : 0 , 'max' : 1500 }, 'remainder' )
# If a number input is provided as the second argument, it will automatically
# be promoted to an ee.Image object, a convenient shorthand for constants.
exponent = swir_1 . pow ( 3 )
m . add_layer ( exponent , { 'min' : 0 , 'max' : 2e10 }, 'exponent' )
m
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[],["The `mod()` function calculates the remainder of a division operation between two images (`image1` and `image2`). It pairs bands from each image. If one image has a single band, that band is used against all bands of the other. Otherwise, bands are paired in order. The output image's band names are based on the input images' names, and the output pixel type is a union of the input types. Examples for other operations such as addition, subtraction, division, multiplication, and exponent are provided.\n"]]