Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003e\u003ccode\u003eImageCollection.min()\u003c/code\u003e reduces an image collection to a single image by calculating the minimum pixel value across all images in the collection for each band.\u003c/p\u003e\n"],["\u003cp\u003eBands with the same name are matched for the minimum value calculation.\u003c/p\u003e\n"],["\u003cp\u003eThe result is a single image containing the minimum pixel values for each corresponding band across the collection.\u003c/p\u003e\n"],["\u003cp\u003eThis method is useful for finding the lowest values across a time series or a set of images with varying conditions.\u003c/p\u003e\n"]]],["The `min()` function reduces an image collection to a single image by computing the minimum pixel value across all images, matching bands by name. It operates on an `ImageCollection` and returns a single `Image`. The process is demonstrated in both JavaScript and Python code examples, showcasing how to apply it to Sentinel-2 data and visualize the result. Other methods like `mean`, `median`, `max`, and `sum` are also presented.\n"],null,["# ee.ImageCollection.min\n\nReduces an image collection by calculating the minimum value of each pixel across the stack of all matching bands. Bands are matched by name.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------------|---------|\n| ImageCollection.min`()` | Image |\n\n| Argument | Type | Details |\n|--------------------|-----------------|---------------------------------|\n| this: `collection` | ImageCollection | The image collection to reduce. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Sentinel-2 image collection for July 2021 intersecting a point of interest.\n// Reflectance, cloud probability, and scene classification bands are selected.\nvar col = ee.ImageCollection('COPERNICUS/S2_SR')\n .filterDate('2021-07-01', '2021-08-01')\n .filterBounds(ee.Geometry.Point(-122.373, 37.448))\n .select('B.*|MSK_CLDPRB|SCL');\n\n// Visualization parameters for reflectance RGB.\nvar visRefl = {\n bands: ['B11', 'B8', 'B3'],\n min: 0,\n max: 4000\n};\nMap.setCenter(-122.373, 37.448, 9);\nMap.addLayer(col, visRefl, 'Collection reference', false);\n\n// Reduce the collection to a single image using a variety of methods.\nvar mean = col.mean();\nMap.addLayer(mean, visRefl, 'Mean (B11, B8, B3)');\n\nvar median = col.median();\nMap.addLayer(median, visRefl, 'Median (B11, B8, B3)');\n\nvar min = col.min();\nMap.addLayer(min, visRefl, 'Min (B11, B8, B3)');\n\nvar max = col.max();\nMap.addLayer(max, visRefl, 'Max (B11, B8, B3)');\n\nvar sum = col.sum();\nMap.addLayer(sum,\n {bands: ['MSK_CLDPRB'], min: 0, max: 500}, 'Sum (MSK_CLDPRB)');\n\nvar product = col.product();\nMap.addLayer(product,\n {bands: ['MSK_CLDPRB'], min: 0, max: 1e10}, 'Product (MSK_CLDPRB)');\n\n// ee.ImageCollection.mode returns the most common value. If multiple mode\n// values occur, the minimum mode value is returned.\nvar mode = col.mode();\nMap.addLayer(mode, {bands: ['SCL'], min: 1, max: 11}, 'Mode (pixel class)');\n\n// ee.ImageCollection.count returns the frequency of valid observations. Here,\n// image pixels are masked based on cloud probability to add valid observation\n// variability to the collection. Note that pixels with no valid observations\n// are masked out of the returned image.\nvar notCloudCol = col.map(function(img) {\n return img.updateMask(img.select('MSK_CLDPRB').lte(10));\n});\nvar count = notCloudCol.count();\nMap.addLayer(count, {min: 1, max: 5}, 'Count (not cloud observations)');\n\n// ee.ImageCollection.mosaic composites images according to their position in\n// the collection (priority is last to first) and pixel mask status, where\n// invalid (mask value 0) pixels are filled by preceding valid (mask value \u003e0)\n// pixels.\nvar mosaic = notCloudCol.mosaic();\nMap.addLayer(mosaic, visRefl, 'Mosaic (B11, B8, B3)');\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Sentinel-2 image collection for July 2021 intersecting a point of interest.\n# Reflectance, cloud probability, and scene classification bands are selected.\ncol = (\n ee.ImageCollection('COPERNICUS/S2_SR')\n .filterDate('2021-07-01', '2021-08-01')\n .filterBounds(ee.Geometry.Point(-122.373, 37.448))\n .select('B.*|MSK_CLDPRB|SCL')\n)\n\n# Visualization parameters for reflectance RGB.\nvis_refl = {'bands': ['B11', 'B8', 'B3'], 'min': 0, 'max': 4000}\nm = geemap.Map()\nm.set_center(-122.373, 37.448, 9)\nm.add_layer(col, vis_refl, 'Collection reference', False)\n\n# Reduce the collection to a single image using a variety of methods.\nmean = col.mean()\nm.add_layer(mean, vis_refl, 'Mean (B11, B8, B3)')\n\nmedian = col.median()\nm.add_layer(median, vis_refl, 'Median (B11, B8, B3)')\n\nmin = col.min()\nm.add_layer(min, vis_refl, 'Min (B11, B8, B3)')\n\nmax = col.max()\nm.add_layer(max, vis_refl, 'Max (B11, B8, B3)')\n\nsum = col.sum()\nm.add_layer(\n sum, {'bands': ['MSK_CLDPRB'], 'min': 0, 'max': 500}, 'Sum (MSK_CLDPRB)'\n)\n\nproduct = col.product()\nm.add_layer(\n product,\n {'bands': ['MSK_CLDPRB'], 'min': 0, 'max': 1e10},\n 'Product (MSK_CLDPRB)',\n)\n\n# ee.ImageCollection.mode returns the most common value. If multiple mode\n# values occur, the minimum mode value is returned.\nmode = col.mode()\nm.add_layer(\n mode, {'bands': ['SCL'], 'min': 1, 'max': 11}, 'Mode (pixel class)'\n)\n\n# ee.ImageCollection.count returns the frequency of valid observations. Here,\n# image pixels are masked based on cloud probability to add valid observation\n# variability to the collection. Note that pixels with no valid observations\n# are masked out of the returned image.\nnot_cloud_col = col.map(\n lambda img: img.updateMask(img.select('MSK_CLDPRB').lte(10))\n)\ncount = not_cloud_col.count()\nm.add_layer(count, {'min': 1, 'max': 5}, 'Count (not cloud observations)')\n\n# ee.ImageCollection.mosaic composites images according to their position in\n# the collection (priority is last to first) and pixel mask status, where\n# invalid (mask value 0) pixels are filled by preceding valid (mask value \u003e0)\n# pixels.\nmosaic = not_cloud_col.mosaic()\nm.add_layer(mosaic, vis_refl, 'Mosaic (B11, B8, B3)')\nm\n```"]]