[null,null,["最后更新时间 (UTC):2025-07-27。"],[[["\u003cp\u003eThe Water Occurrence Change Intensity data layer shows surface water changes between 1984-1999 and 2000-2015.\u003c/p\u003e\n"],["\u003cp\u003eThis tutorial demonstrates visualizing water occurrence change intensity with a styled map layer, using red for decreased and green for increased surface water.\u003c/p\u003e\n"],["\u003cp\u003eIt also covers summarizing the change intensity within a user-defined region of interest using a histogram chart generated in the Code Editor.\u003c/p\u003e\n"],["\u003cp\u003eUsers can interactively explore the chart to understand the distribution of surface water change intensity values within their chosen region.\u003c/p\u003e\n"],["\u003cp\u003eThe tutorial utilizes the Global Surface Water dataset and provides JavaScript code examples for implementation in Google Earth Engine.\u003c/p\u003e\n"]]],["The core content details analyzing changes in surface water between 1984-1999 and 2000-2015. Key actions include visualizing \"water occurrence change intensity\" using absolute values and a defined color palette (red for decrease, green for increase, black for no change). Users can define a region-of-interest (ROI) and calculate a histogram to summarize the change intensity within that area. The process involves generating and customizing a histogram chart, which is then printed to the console for interactive exploration.\n"],null,["# Water Occurrence Change Intensity\n\nThe Water Occurrence Change Intensity data layer provides a measure of how surface water has\nchanged between two epochs: 1984-1999 and 2000-2015. The layer averages the change across\nhomologous pairs of months taken from the two epochs. See the\n[Data Users Guide (v2)](https://storage.googleapis.com/global-surface-water/downloads_ancillary/DataUsersGuidev2.pdf) for additional details on this layer.\n\nThis section of the tutorial will:\n\n1. add a styled map layer for visualizing water occurrence change intensity, and\n2. summarize the change intensity in a specified region-of-interest using a histogram.\n\nVisualization\n-------------\n\nSimilar to the water occurrence layer, we will start by adding a basic visualization of\noccurrence change intensity to the map and then improve upon it. Occurrence change intensity\nis provided in two ways, both as absolute and normalized values. We will use the absolute\nvalues in this tutorial.\nStart by selecting the absolute occurrence change intensity layer from the GSW image:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar change = gsw.select(\"change_abs\");\n```\n\nIn the Constants section of the code, add a statement that creates a new variable that\ndefines how the layer will be styled. This styling shows areas where the surface water\noccurrence has decreased/increased in red/green. Areas where surface water occurrence\nis relatively unchanged are shown in black.\n\n### Code Editor (JavaScript)\n\n```javascript\nvar VIS_CHANGE = {\n min:-50,\n max:50,\n palette: ['red', 'black', 'limegreen']\n};\n```\n\nAt the end of the Map Layers section of code, add a statement that adds a new layer to\nthe map.\n\n### Code Editor (JavaScript)\n\n```javascript\nMap.setCenter(-74.4557, -8.4289, 11); // Ucayali River, Peru\nMap.addLayer({\n eeObject: change,\n visParams: VIS_CHANGE,\n name: 'occurrence change intensity'\n});\n```\nFigure 6. Screenshot of a surface water change intensity for the Ucayali River near Pucallpa, a city in the Amazonian rainforest of eastern Peru. Red/green indicates a decrease/increase in surface water occurrence between the epochs.\n\nSummarizing Change within a Region of Interest\n----------------------------------------------\n\nIn this section, we will summarize the amount of change within a specified region of\ninterest. To specify a region of interest, click on the polygon drawing tool, which is one of\nthe\n[Geometry tools](/earth-engine/guides/playground#geometry-tools).\nThis will create a new Geometry Imports layer, which is named \"geometry\"\nby default. To change the name, click on the gear icon located to the right of the to the\nlayer name. (Note that you may need to place your cursor on the layer name to make it appear.)\n\nChange the layer name to `roi` (for region-of-interest or ROI). We then can click on a\nseries of points on the map to define a polygon region of interest.\nFigure 7. Screenshot of the Ucayali River near Pucallpa, Peru, with a region-of-interest created by using the polygon drawing tool.\n\nNow that our region-of-interest is defined and stored in a variable, we can use it to\ncalculate a histogram of the change intensity for the ROI. Add the following code to the\nCalculations section of the script.\n\n### Code Editor (JavaScript)\n\n```javascript\n// Calculate a change intensity for the region of interest.\nvar histogram = change.reduceRegion({\n reducer: ee.Reducer.histogram(),\n geometry: roi,\n scale: 30,\n bestEffort: true,\n});\nprint(histogram);\n```\n\nThe first statement calculates a histogram of occurrence change intensity values within the\nROI, sampling at a 30m scale. The second prints the resulting object to the Code Editor\nConsole Tab. You can expand out the object tree to view the values of the histogram buckets.\nThe numeric data is there, but there are better ways to visualize the results.\nFigure 8. Console tab results, showing histogram values of surface water change intensity.\n\nTo improve upon this, we can generate a histogram chart instead. Replace the statement that\ndefines the histogram object with the following statements:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Generate a histogram object and print it to the console tab.\nvar histogram = ui.Chart.image.histogram({\n image: change,\n region: roi,\n scale: 30,\n minBucketWidth: 10\n});\nhistogram.setOptions({\n title: 'Histogram of surface water change intensity.'\n});\n```\n\nThese statements create a histogram chart object, which replaces the histogram object tree\nin the Console Tab with a chart. The chart method contains several arguments, including\n`scale` which defines the spatial scale, in meters, at which the region of interest'\nis sampled, and\n`minBucketWidth` which is used to control the width of the histogram\nbuckets.\nFigure 9. Console tab results, showing a histogram chart of surface water change intensity.\n\nYou can explore the chart values interactively by placing your cursor over the histogram\nbars.\n\nFinal Script\n------------\n\nThe entire script for this section is listed below. Note that the script includes statements\nfor defining a polygon geometry (`roi`), which is comparable to the geometry that\nyou created using the Code Editor's geometry tools.\n\n### Code Editor (JavaScript)\n\n```javascript\n//////////////////////////////////////////////////////////////\n// Asset List\n//////////////////////////////////////////////////////////////\n\nvar gsw = ee.Image('JRC/GSW1_0/GlobalSurfaceWater');\nvar occurrence = gsw.select('occurrence');\nvar change = gsw.select(\"change_abs\");\nvar roi = /* color: 0B4A8B */ee.Geometry.Polygon(\n [[[-74.17213, -8.65569],\n [-74.17419, -8.39222],\n [-74.38362, -8.36980],\n [-74.43031, -8.61293]]]);\n\n//////////////////////////////////////////////////////////////\n// Constants\n//////////////////////////////////////////////////////////////\n\nvar VIS_OCCURRENCE = {\n min:0,\n max:100,\n palette: ['red', 'blue']\n};\nvar VIS_CHANGE = {\n min:-50,\n max:50,\n palette: ['red', 'black', 'limegreen']\n};\nvar VIS_WATER_MASK = {\n palette: ['white', 'black']\n};\n\n//////////////////////////////////////////////////////////////\n// Calculations\n//////////////////////////////////////////////////////////////\n\n// Create a water mask layer, and set the image mask so that non-water areas are transparent.\nvar water_mask = occurrence.gt(90).mask(1);\n\n// Generate a histogram object and print it to the console tab.\nvar histogram = ui.Chart.image.histogram({\n image: change,\n region: roi,\n scale: 30,\n minBucketWidth: 10\n});\nhistogram.setOptions({\n title: 'Histogram of surface water change intensity.'\n});\nprint(histogram);\n\n//////////////////////////////////////////////////////////////\n// Initialize Map Location\n//////////////////////////////////////////////////////////////\n\n// Uncomment one of the following statements to center the map on\n// a particular location.\n// Map.setCenter(-90.162, 29.8597, 10); // New Orleans, USA\n// Map.setCenter(-114.9774, 31.9254, 10); // Mouth of the Colorado River, Mexico\n// Map.setCenter(-111.1871, 37.0963, 11); // Lake Powell, USA\n// Map.setCenter(149.412, -35.0789, 11); // Lake George, Australia\n// Map.setCenter(105.26, 11.2134, 9); // Mekong River Basin, SouthEast Asia\n// Map.setCenter(90.6743, 22.7382, 10); // Meghna River, Bangladesh\n// Map.setCenter(81.2714, 16.5079, 11); // Godavari River Basin Irrigation Project, India\n// Map.setCenter(14.7035, 52.0985, 12); // River Oder, Germany & Poland\n// Map.setCenter(-59.1696, -33.8111, 9); // Buenos Aires, Argentina\\\nMap.setCenter(-74.4557, -8.4289, 11); // Ucayali River, Peru\n\n//////////////////////////////////////////////////////////////\n// Map Layers\n//////////////////////////////////////////////////////////////\n\nMap.addLayer({\n eeObject: water_mask,\n visParams: VIS_WATER_MASK,\n name: '90% occurrence water mask',\n shown: false\n});\nMap.addLayer({\n eeObject: occurrence.updateMask(occurrence.divide(100)),\n name: \"Water Occurrence (1984-2015)\",\n visParams: VIS_OCCURRENCE,\n shown: false\n});\nMap.addLayer({\n eeObject: change,\n visParams: VIS_CHANGE,\n name: 'occurrence change intensity'\n});\n```\n\nIn the [next section](/earth-engine/tutorials/tutorial_global_surface_water_04), you will further\nexplore how water changed over time, by working with the water class **transition** layer."]]