إشعار : يجب
إثبات الأهلية للاستخدام غير التجاري لجميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إليها. إذا لم يتم تأكيد حسابك بحلول 26 سبتمبر 2025، قد يتم تعليق إمكانية الوصول إليه.
إرسال ملاحظات
ee.List.iterate
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تكرار خوارزمية على قائمة من المتوقّع أن تأخذ الخوارزمية عنصرَين، وهما عنصر القائمة الحالي ونتيجة التكرار السابق أو قيمة first للتكرار الأول.
الاستخدام المرتجعات List. iterate (function, first)
عنصر
الوسيطة النوع التفاصيل هذا: list
قائمة function
خوارزمية first
عنصر
أمثلة
محرّر الرموز البرمجية (JavaScript)
// This example uses the ee.List.iterate function to generate a series of
// sequentially halved values.
// Declare a list that will hold the series of sequentially halved values,
// initialize it with the starting quantity.
var quantityList = [ 1000 ];
// Define the number of iterations as a list sequence.
var nSteps = ee . List . sequence ( 1 , 10 );
// Declare a function that takes the current element of the iteration list and
// the returned result of the previous iteration as inputs. In this case, the
// the function is returning an accumulating list of quantities that are reduced
// by half at each iteration.
var halfOfPrevious = function ( currentElement , previousResult ) {
var previousQuantity = ee . Number ( ee . List ( previousResult ). get ( - 1 ));
var currentQuantity = previousQuantity . divide ( 2 );
return ee . List ( previousResult ). add ( currentQuantity );
};
// Apply the function to the nSteps list, each element is an iteration.
quantityList = ee . List ( nSteps . iterate ( halfOfPrevious , quantityList ));
// Display the results. Note that step 0 is included for the initial value.
print ( 'Steps in the iteration of halved quantities' , nSteps );
print ( 'Series of sequentially halved quantities' , quantityList );
print ( ui . Chart . array . values ({
array : quantityList ,
axis : 0 ,
xLabels : ee . List ([ 0 ]). cat ( nSteps )
}));
إعداد Python
راجِع صفحة
بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
geemap
للتطوير التفاعلي.
import ee
import geemap.core as geemap
Colab (Python)
import matplotlib.pyplot as plt
# This example uses the ee.List.iterate function to generate a series of
# sequentially halved values.
# Declare a list that will hold the series of sequentially halved values,
# initialize it with the starting quantity.
quantity_list = [ 1000 ]
# Define the number of iterations as a list sequence.
n_steps = ee . List . sequence ( 1 , 10 )
# Declare a function that takes the current element of the iteration list and
# the returned result of the previous iteration as inputs. In this case, the
# the function is returning an accumulating list of quantities that are reduced
# by half at each iteration.
def half_of_previous ( current_element , previous_result ):
previous_quantity = ee . Number ( ee . List ( previous_result ) . get ( - 1 ))
current_quantity = previous_quantity . divide ( 2 )
return ee . List ( previous_result ) . add ( current_quantity )
# Apply the function to the n_steps list, each element is an iteration.
quantity_list = ee . List ( n_steps . iterate ( half_of_previous , quantity_list ))
# Display the results.
display ( 'Steps in the iteration of halved quantities' , n_steps )
display ( 'Series of sequentially halved quantities' , quantity_list )
quantity_list_client = quantity_list . getInfo ()
plt . scatter ( range ( len ( quantity_list_client )), quantity_list_client )
plt . show ()
إرسال ملاحظات
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[]]