ارسال بازخورد
ee.ImageCollection.median
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
با محاسبه میانه تمام مقادیر در هر پیکسل در پشته همه باندهای منطبق، یک مجموعه تصویر را کاهش می دهد. گروه ها با نام مطابقت دارند.
استفاده برمی گرداند ImageCollection. median ()
تصویر
استدلال تایپ کنید جزئیات این: collection
ImageCollection مجموعه تصاویر برای کاهش.
نمونه ها ویرایشگر کد (جاوا اسکریپت)
// Sentinel-2 image collection for July 2021 intersecting a point of interest.
// Reflectance, cloud probability, and scene classification bands are selected.
var col = ee . ImageCollection ( 'COPERNICUS/S2_SR' )
. filterDate ( '2021-07-01' , '2021-08-01' )
. filterBounds ( ee . Geometry . Point ( - 122.373 , 37.448 ))
. select ( 'B.*|MSK_CLDPRB|SCL' );
// Visualization parameters for reflectance RGB.
var visRefl = {
bands : [ 'B11' , 'B8' , 'B3' ],
min : 0 ,
max : 4000
};
Map . setCenter ( - 122.373 , 37.448 , 9 );
Map . addLayer ( col , visRefl , 'Collection reference' , false );
// Reduce the collection to a single image using a variety of methods.
var mean = col . mean ();
Map . addLayer ( mean , visRefl , 'Mean (B11, B8, B3)' );
var median = col . median ();
Map . addLayer ( median , visRefl , 'Median (B11, B8, B3)' );
var min = col . min ();
Map . addLayer ( min , visRefl , 'Min (B11, B8, B3)' );
var max = col . max ();
Map . addLayer ( max , visRefl , 'Max (B11, B8, B3)' );
var sum = col . sum ();
Map . addLayer ( sum ,
{ bands : [ 'MSK_CLDPRB' ], min : 0 , max : 500 }, 'Sum (MSK_CLDPRB)' );
var product = col . product ();
Map . addLayer ( product ,
{ bands : [ 'MSK_CLDPRB' ], min : 0 , max : 1e10 }, 'Product (MSK_CLDPRB)' );
// ee.ImageCollection.mode returns the most common value. If multiple mode
// values occur, the minimum mode value is returned.
var mode = col . mode ();
Map . addLayer ( mode , { bands : [ 'SCL' ], min : 1 , max : 11 }, 'Mode (pixel class)' );
// ee.ImageCollection.count returns the frequency of valid observations. Here,
// image pixels are masked based on cloud probability to add valid observation
// variability to the collection. Note that pixels with no valid observations
// are masked out of the returned image.
var notCloudCol = col . map ( function ( img ) {
return img . updateMask ( img . select ( 'MSK_CLDPRB' ). lte ( 10 ));
});
var count = notCloudCol . count ();
Map . addLayer ( count , { min : 1 , max : 5 }, 'Count (not cloud observations)' );
// ee.ImageCollection.mosaic composites images according to their position in
// the collection (priority is last to first) and pixel mask status, where
// invalid (mask value 0) pixels are filled by preceding valid (mask value >0)
// pixels.
var mosaic = notCloudCol . mosaic ();
Map . addLayer ( mosaic , visRefl , 'Mosaic (B11, B8, B3)' ); راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap کولب (پایتون)
# Sentinel-2 image collection for July 2021 intersecting a point of interest.
# Reflectance, cloud probability, and scene classification bands are selected.
col = (
ee . ImageCollection ( 'COPERNICUS/S2_SR' )
. filterDate ( '2021-07-01' , '2021-08-01' )
. filterBounds ( ee . Geometry . Point ( - 122.373 , 37.448 ))
. select ( 'B.*|MSK_CLDPRB|SCL' )
)
# Visualization parameters for reflectance RGB.
vis_refl = { 'bands' : [ 'B11' , 'B8' , 'B3' ], 'min' : 0 , 'max' : 4000 }
m = geemap . Map ()
m . set_center ( - 122.373 , 37.448 , 9 )
m . add_layer ( col , vis_refl , 'Collection reference' , False )
# Reduce the collection to a single image using a variety of methods.
mean = col . mean ()
m . add_layer ( mean , vis_refl , 'Mean (B11, B8, B3)' )
median = col . median ()
m . add_layer ( median , vis_refl , 'Median (B11, B8, B3)' )
min = col . min ()
m . add_layer ( min , vis_refl , 'Min (B11, B8, B3)' )
max = col . max ()
m . add_layer ( max , vis_refl , 'Max (B11, B8, B3)' )
sum = col . sum ()
m . add_layer (
sum , { 'bands' : [ 'MSK_CLDPRB' ], 'min' : 0 , 'max' : 500 }, 'Sum (MSK_CLDPRB)'
)
product = col . product ()
m . add_layer (
product ,
{ 'bands' : [ 'MSK_CLDPRB' ], 'min' : 0 , 'max' : 1e10 },
'Product (MSK_CLDPRB)' ,
)
# ee.ImageCollection.mode returns the most common value. If multiple mode
# values occur, the minimum mode value is returned.
mode = col . mode ()
m . add_layer (
mode , { 'bands' : [ 'SCL' ], 'min' : 1 , 'max' : 11 }, 'Mode (pixel class)'
)
# ee.ImageCollection.count returns the frequency of valid observations. Here,
# image pixels are masked based on cloud probability to add valid observation
# variability to the collection. Note that pixels with no valid observations
# are masked out of the returned image.
not_cloud_col = col . map (
lambda img : img . updateMask ( img . select ( 'MSK_CLDPRB' ) . lte ( 10 ))
)
count = not_cloud_col . count ()
m . add_layer ( count , { 'min' : 1 , 'max' : 5 }, 'Count (not cloud observations)' )
# ee.ImageCollection.mosaic composites images according to their position in
# the collection (priority is last to first) and pixel mask status, where
# invalid (mask value 0) pixels are filled by preceding valid (mask value >0)
# pixels.
mosaic = not_cloud_col . mosaic ()
m . add_layer ( mosaic , vis_refl , 'Mosaic (B11, B8, B3)' )
m
ارسال بازخورد
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
میخواهید موارد بیشتری را با ما درمیان بگذارید؟
[[["درک آسان","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-24 بهوقت ساعت هماهنگ جهانی."],[[["`ImageCollection.median()` reduces an image collection to a single image by calculating the median pixel value across all images in the collection for each band."],["Bands are matched by name when computing the median, ensuring that the same band from each image is used in the calculation."],["The result is a single image representing the median values of the input image collection, useful for summarizing central tendencies in the data."],["This method is applicable to any type of numeric band in the input image collection."]]],["The `median()` method reduces an `ImageCollection` to a single `Image` by calculating the median value for each pixel across all images in the collection. This is done for all bands that are matched by name. The method takes one argument, which is the `ImageCollection` itself. Each image pixel value that is available for a band will be used to calculate the median. This median is the value that will be output in the band of the new `Image`.\n"]]