공지사항 :
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 액세스 권한을 유지하기 위해
비상업용 자격 요건을 인증 해야 합니다. 2025년 9월 26일까지 인증하지 않으면 액세스가 보류될 수 있습니다.
의견 보내기
ee.List.iterate
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
목록에서 알고리즘을 반복합니다. 이 알고리즘은 두 객체, 즉 현재 목록 항목과 이전 반복의 결과 또는 첫 번째 반복의 첫 번째 값을 가져와야 합니다.
사용 반환 값 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 API 및 geemap
를 사용한 대화형 개발에 관한 자세한 내용은
Python 환경 페이지를 참고하세요.
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 사이트 정책 을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
의견을 전달하고 싶나요?
[[["이해하기 쉬움","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(UTC)"],[],[]]