当前位置:网站首页>Gee: explore the change of water area in the North Canal basin over the past 30 years [year by year]
Gee: explore the change of water area in the North Canal basin over the past 30 years [year by year]
2022-07-02 05:11:00 【Gee water ecological space】
Catalog
Preface
Use GEE Analyze the change characteristics of water area in the basin , Take the North Canal basin as an example
For the same area analysis, see :
GEE: Reclassification of land use in the North Canal basin
The analysis area is as follows :
One 、 Analysis steps
Main analysis steps :
Two 、python Code
1、 Load watershed range
python The code is as follows
# Add display underlay , Select Gaode map
Map = geemap.Map()
Map.add_basemap('HYBRID')
# Import watershed range
basin_shp = '../world_basins/byh.shp'
basin_bj = geemap.shp_to_ee(basin_shp)
roi = basin_bj.geometry()
# Add display
Map.addLayer(ee.Image().paint(roi, 0, 2), {
'palette':'red'}, 'roi')
Map.centerObject(basin_bj)
Map
give the result as follows :
2、 Image capture and synthesis
- geemap.landsat_timeseries()
python The code is as follows :
# Import image data , Annual synthesis
images = geemap.landsat_timeseries(roi=roi,
start_year=1984,
end_year=2020,
start_date='01-01',
end_date='12-31')
# Check the image band
first = images.first()
first.bandNames().getInfo()
# ['Blue', 'Green', 'Red', 'NIR', 'SWIR1', 'SWIR2', 'pixel_qa', 'NBR']
# Add display
Map.addLayer(first, {
'bands':['SWIR2', 'SWIR1', 'Green'], 'min':0, 'max':3000}, 'first image')
give the result as follows :
3、NDWI Calculation and water surface extraction
normalizedDifference()
ee.Image.pixelArea()
- ee.Image.reduceRegion()
python The code is as follows :
def ndwi_cac(image):
ndwi_image = image.normalizedDifference(['Green', 'SWIR1']).rename('ndwi')
return ndwi_image.gt(0).selfMask()
# Get water surface
ndwi_water = images.map(ndwi_cac)
Map.addLayer(ndwi_water.first(), {
'palette':'blue'}, 'first water')
# Calculate the water surface area , The unit is according to km2 meter
def cal_area(image):
pixel_area = image.multiply(ee.Image.pixelArea()).divide(1e6)
img_area = pixel_area.reduceRegion(**{
'reducer':ee.Reducer.sum(),
'geometry':roi,
'scale':30,
'maxPixels':1e13
})
return image.set({
'water_area':img_area})
water_areas = ndwi_water.map(cal_area)
water_stats = water_areas.aggregate_array('water_area').getInfo()
water_stats
give the result as follows :
[{‘ndwi’: 35.52171285398048},
{‘ndwi’: 49.82769552462259},
{‘ndwi’: 95.52709095289183},
{‘ndwi’: 88.0812142082916},
{‘ndwi’: 93.93069886911051},
{‘ndwi’: 80.60827039904903},
{‘ndwi’: 136.78296227087307},
{‘ndwi’: 108.33794441999756},
{‘ndwi’: 171.22477916253243},
{‘ndwi’: 127.52933278774321},
{‘ndwi’: 86.3748384304267},
{‘ndwi’: 112.22821871601487},
{‘ndwi’: 101.4823960050295},
{‘ndwi’: 89.49672596974511},
{‘ndwi’: 295.2877416742835},
{‘ndwi’: 80.7449547841241},
{‘ndwi’: 120.11593294853824},
{‘ndwi’: 134.62668476349447},
{‘ndwi’: 149.84151247550966},
{‘ndwi’: 236.29430841558016},
{‘ndwi’: 158.22021181601244},
{‘ndwi’: 70.20089856972656},
{‘ndwi’: 97.93744088662496},
{‘ndwi’: 108.04200576387466},
{‘ndwi’: 107.22519927537127},
{‘ndwi’: 63.4901824073373},
{‘ndwi’: 85.06409974042677},
{‘ndwi’: 74.55227930805393},
{‘ndwi’: 221.75472506976308},
{‘ndwi’: 85.00424085790755},
{‘ndwi’: 60.99660440626263},
{‘ndwi’: 68.4423834487381},
{‘ndwi’: 67.66773335986407},
{‘ndwi’: 84.48483915371168},
{‘ndwi’: 76.99267855924732},
{‘ndwi’: 58.5695615691552},
{‘ndwi’: 87.93523549212745}]
4、 Statistical analysis
python The code is as follows :
# Time series change histogram shows
import matplotlib.pyplot as plt
x = list(range(1984, 2021))
y = [item.get('ndwi') for item in water_stats]
plt.bar(x, y, align='center', alpha=0.5)
plt.ylabel('Area hm2')
plt.title('surface water dynamics in BYH')
plt.show()
3、 ... and 、 comparative analysis
It is proposed to adopt JRC The data directly analyzes the changes of water surface , Its python The code is as follows :
【 To be analyzed ...】
give the result as follows :
Comparison and analysis of the difference between the two calculation results :
- It can be seen that ,
Four 、 Summary and discussion
- The characteristics of long-time series water surface changes in the North Canal basin are analyzed
- Problems to be explored , Water surface changes in different zones can be considered , Spatial and temporal changes of water surface in different administrative regions or upstream and downstream areas of the basin
Reference resources :
- https://geemap.org/notebooks/tn_surface_water/
- https://developers.google.com/earth-engine/apidocs/ee-image-pixelarea?hl=en
边栏推荐
- Mathematical problems (number theory) trial division to judge prime numbers, decompose prime factors, and screen prime numbers
- Paddlepaddle project source code
- 黑马笔记---Set系列集合
- Fabric.js 自由绘制矩形
- Line by line explanation of yolox source code of anchor free series network (7) -- obj in head_ loss、Cls_ Loss and reg_ Calculation and reverse transmission of loss I
- 10 minute quick start UI automation ----- puppeter
- LeetCode 1175. 质数排列(质数判断+组合数学)
- Global and Chinese market of insulin pens 2022-2028: Research Report on technology, participants, trends, market size and share
- Record my pytorch installation process and errors
- Fasttext text text classification
猜你喜欢
Analyzing the hands-on building tutorial in children's programming
Pyechart1.19 national air quality exhibition
摆正元素(带过渡动画)
Steam教育的实际问题解决能力
Johnson–Lindenstrauss Lemma(2)
Fabric.js 居中元素
Acelems Expressway microgrid energy efficiency management platform and intelligent lighting solution intelligent lighting tunnel
Application d'un robot intelligent dans le domaine de l'agroécologie
10 minute quick start UI automation ----- puppeter
Black Horse Notes - - set Series Collection
随机推荐
C # picture display occupancy problem
How to recover deleted data in disk
函数中使用sizeof(arr) / sizeof(arr[0])求数组长度不正确的原因
paddle: ValueError:quality setting only supported for ‘jpeg‘ compression
Mysql重点难题(2)汇总
Fabric.js 居中元素
How to configure PostgreSQL 12.9 to allow remote connections
Go GC garbage collection notes (three color mark)
Pytest learning ----- pytest Interface Association framework encapsulation of interface automation testing
Global and Chinese market of hydrocyclone desander 2022-2028: Research Report on technology, participants, trends, market size and share
Mathematical knowledge (Euler function)
[high speed bus] Introduction to jesd204b
leetcode两数相加go实现
The El cascader echo only selects the questions that are not displayed
go实现leetcode旋转数组
Pytest learning ----- pytest assertion of interface automation testing
Global and Chinese market of insulin pens 2022-2028: Research Report on technology, participants, trends, market size and share
Rhcsa --- work on the third day
Map in JS (including leetcode examples)
Global and Chinese market of cell culture freezers 2022-2028: Research Report on technology, participants, trends, market size and share