ee.Reducer.median
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tạo một hàm giảm sẽ tính toán giá trị trung vị của các đầu vào. Đối với số lượng nhỏ dữ liệu đầu vào (tối đa là maxRaw), giá trị trung vị sẽ được tính toán trực tiếp; đối với số lượng lớn dữ liệu đầu vào, giá trị trung vị sẽ được lấy từ biểu đồ.
Cách sử dụng | Giá trị trả về |
---|
ee.Reducer.median(maxBuckets, minBucketWidth, maxRaw) | Bộ giảm tốc |
Đối số | Loại | Thông tin chi tiết |
---|
maxBuckets | Số nguyên, mặc định: null | Số lượng nhóm tối đa cần dùng khi tạo biểu đồ; sẽ được làm tròn lên thành luỹ thừa của 2. |
minBucketWidth | Float, mặc định: null | Độ rộng tối thiểu của vùng chứa biểu đồ tần suất hoặc giá trị rỗng để cho phép mọi luỹ thừa của 2. |
maxRaw | Số nguyên, mặc định: null | Số lượng giá trị cần tích luỹ trước khi tạo biểu đồ tần suất ban đầu. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eThis reducer calculates the median of input values, using either direct computation or a histogram-based approach depending on the input size.\u003c/p\u003e\n"],["\u003cp\u003eFor small datasets (up to \u003ccode\u003emaxRaw\u003c/code\u003e values), the median is computed directly from the raw input values.\u003c/p\u003e\n"],["\u003cp\u003eFor larger datasets, the reducer constructs a histogram with a maximum of \u003ccode\u003emaxBuckets\u003c/code\u003e, potentially rounding up to the nearest power of 2, and \u003ccode\u003eminBucketWidth\u003c/code\u003e as the minimum width of each bucket for efficient approximation.\u003c/p\u003e\n"],["\u003cp\u003eUsers can control the calculation process by specifying parameters like \u003ccode\u003emaxBuckets\u003c/code\u003e, \u003ccode\u003eminBucketWidth\u003c/code\u003e, and \u003ccode\u003emaxRaw\u003c/code\u003e to customize the reducer's behavior.\u003c/p\u003e\n"]]],["The core content describes a reducer that calculates the median of inputs. For smaller datasets (up to `maxRaw`), the median is directly computed. Larger datasets utilize a histogram for median derivation. The `ee.Reducer.median` function creates this reducer, accepting `maxBuckets` (maximum histogram buckets), `minBucketWidth` (minimum bucket size), and `maxRaw` (raw values threshold) as parameters to customize the histogram creation.\n"],null,["# ee.Reducer.median\n\nCreate a reducer that will compute the median of the inputs. For small numbers of inputs (up to maxRaw) the median will be computed directly; for larger numbers of inputs the median will be derived from a histogram.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------------------------------|---------|\n| `ee.Reducer.median(`*maxBuckets* `, `*minBucketWidth* `, `*maxRaw*`)` | Reducer |\n\n| Argument | Type | Details |\n|------------------|------------------------|-----------------------------------------------------------------------------------------------------|\n| `maxBuckets` | Integer, default: null | The maximum number of buckets to use when building a histogram; will be rounded up to a power of 2. |\n| `minBucketWidth` | Float, default: null | The minimum histogram bucket width, or null to allow any power of 2. |\n| `maxRaw` | Integer, default: null | The number of values to accumulate before building the initial histogram. |"]]