Earth Engine은 공유 컴퓨팅 리소스를 보호하고 모든 사용자에게 안정적인 성능을 보장하기 위해
비상업적 할당량 등급 을 도입했습니다. 비상업적 프로젝트는 기본적으로 커뮤니티 등급을 사용하지만 언제든지 프로젝트의 등급을 변경할 수 있습니다.
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
의견 보내기
ee.ImageCollection.toArrayPerBand
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
여러 이미지를 단일 배열 이미지로 연결합니다.
사용 반환 값 ImageCollection. toArrayPerBand (axis , dropMasked )이미지
인수 유형 세부정보 collectionImageCollection 연결할 이미지입니다. 연결은 밴드별로 별도로 실행되므로 연결 축을 따라가는 길이를 제외하고 모든 이미지는 밴드별로 동일한 차원과 모양을 가져야 합니다. axis정수, 기본값: 0 연결할 축입니다. 0 이상이고 컬렉션의 모든 밴드의 최소 차원 이하여야 합니다. dropMasked불리언, 기본값: false false (기본값)인 경우 출력 픽셀의 마스크 값은 입력 픽셀의 마스크 중 최솟값입니다. 계산 경계 상자 내 컬렉션의 이미지가 픽셀에서 완전히 마스크 처리되면 해당 출력 픽셀이 마스크 처리됩니다. 따라서 마스크가 적용되지 않은 모든 출력 픽셀 배열의 크기는 동일합니다.
true인 경우 출력 픽셀의 마스크 값은 입력 마스크의 최댓값입니다. 해당 픽셀에서 완전히 마스크 처리된 이미지는 무시되며 출력 배열에 데이터를 제공하지 않습니다. 따라서 출력 배열의 크기는 픽셀마다 동일하지 않을 수 있습니다.
예
코드 편집기(JavaScript)
// A function to extract and print the array of a selected pixel.
function sampleArrayImage ( arrImg ) {
var point = ee . Geometry . Point ([ 0 , 0 ]);
return arrImg . sample ( point , 1 ). first (). get ( 'b1' );
}
// Define three single-band constant images with unified data types.
var img0 = ee . Image ( 0 ). byte (). rename ( 'b1' );
var img1 = ee . Image ( 1 ). byte (). rename ( 'b1' );
var img2 = ee . Image ( 2 ). byte (). rename ( 'b1' );
// 1. Basic usage: concatenate fully valid images along axis 0.
var colSimple = ee . ImageCollection ([ img0 , img1 , img2 ]);
var arrayBasic = colSimple . toArrayPerBand ();
print ( 'Basic toArrayPerBand (pixel array):' , sampleArrayImage ( arrayBasic ));
// Result: [0, 1, 2]
// 2. Masking behavior: introduce an image with a masked pixel.
// Update mask so img1 has no valid data at the sampled pixel.
var img1Masked = img1 . updateMask ( 0 );
var colMasked = ee . ImageCollection ([ img0 , img1Masked , img2 ]);
// By default (dropMasked = false), if any input image is masked at a pixel,
// the output array is masked at that pixel. Since sampling a masked pixel
// returns no features, we inspect the output image's mask directly.
var arrayDefault = colMasked . toArrayPerBand ();
print ( 'Default masking behavior (pixel mask is 0):' ,
sampleArrayImage ( arrayDefault . mask ()));
// Result: 0
// With dropMasked = true, if any input image is masked at a specific pixel,
// its value is omitted from the output array at that pixel. As a result,
// array lengths can vary across different pixels.
var arrayDropped = colMasked . toArrayPerBand ( 0 , true );
print ( 'dropMasked=true (pixel array omits image-specific masked pixels):' ,
sampleArrayImage ( arrayDropped ));
// Result: [0, 2]
Python 설정
Python API 및 geemap를 사용한 대화형 개발에 관한 자세한 내용은
Python 환경 페이지를 참고하세요.
import ee
import geemap.core as geemap
Colab(Python)
# A function to extract and print the array of a selected pixel.
def sample_array_image ( arr_img ):
point = ee . Geometry . Point ([ 0 , 0 ])
return arr_img . sample ( point , 1 ) . first () . get ( 'b1' )
# Define three single-band constant images with unified data types.
img0 = ee . Image ( 0 ) . byte () . rename ( 'b1' )
img1 = ee . Image ( 1 ) . byte () . rename ( 'b1' )
img2 = ee . Image ( 2 ) . byte () . rename ( 'b1' )
# 1. Basic usage: concatenate fully valid images along axis 0.
col_simple = ee . ImageCollection ([ img0 , img1 , img2 ])
array_basic = col_simple . toArrayPerBand ()
display ( 'Basic toArrayPerBand (pixel array):' , sample_array_image ( array_basic ))
# Result: [0, 1, 2]
# 2. Masking behavior: introduce an image with a masked pixel.
# Update mask so img1 has no valid data at the sampled pixel.
img1_masked = img1 . updateMask ( 0 )
col_masked = ee . ImageCollection ([ img0 , img1_masked , img2 ])
# By default (dropMasked = False), if any input image is masked at a pixel,
# the output array is masked at that pixel. Since sampling a masked pixel
# returns no features, we inspect the output image's mask directly.
array_default = col_masked . toArrayPerBand ()
display (
'Default masking behavior (pixel mask is 0):' ,
sample_array_image ( array_default . mask ()),
)
# Result: 0
# With dropMasked = true, if any input image is masked at a specific pixel,
# its value is omitted from the output array at that pixel. As a result,
# array lengths can vary across different pixels.
array_dropped = col_masked . toArrayPerBand ( 0 , True )
display (
'dropMasked=True (pixel array omits image-specific masked pixels):' ,
sample_array_image ( array_dropped ),
)
# Result: [0, 2]
의견 보내기
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스 에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스 에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책 을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2026-05-31(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"]],["최종 업데이트: 2026-05-31(UTC)"],[],[]]