【数据集】2015-2100年全球1km不透水面积(比例)
发布时间
阅读量:
阅读量
【数据集】2015-2100年全球1km不透水面积(比例)
- 数据概述
- 数据下载
- 数据制图
- 参考
数据概述
论文-[全球城市面积变化率(Fractional Changes)在每公里分辨率下从2015年到2100年期间,在共享社会经济 pathways(SSPs)和代表浓度 pathways(RCPs)的八种情景下](https://essd.copernicus.org/articles/15/3623/2023/essd-15-3623-2023.html)

数据源:




数据下载
Figshare: the global patterns of urban land-use shifts at a 1-kilometer resolution under diverse SSP-RCP scenarios until the year 2100 are available on https://figshare.com/articles/dataset/Global_fractional_urban_changes_at_1km_under_diverse_SSP-RCP_scenarios_throughout_2100/20391117/4.

数据制图
以2022年数据为例,导入GIS后,图形如下:

Python绘制全球不透水面积,如下:

相关Python代码如下:
from osgeo import gdal
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import geopandas as gpd
# 设置字体为 Times New Roman
plt.rcParams['font.family'] = 'Times New Roman'
# TIFF 文件路径
ISA2022_tiff_file = "D:/0 DataBase/5 Imperious surface area/ISA2015_2022/gUrban_ISA_1km_2022.tif"
dataset = gdal.Open(ISA2022_tiff_file, gdal.GA_ReadOnly)
# 检查数据集是否成功打开
if dataset is None:
raise Exception("Unable to open file")
# 读取图像数据
band = dataset.GetRasterBand(1) # 获取第一波段
ISA2022_data = band.ReadAsArray()
# 获取仿射变换参数
geo_transform = dataset.GetGeoTransform()
# 提取仿射变换参数
top_left_x = geo_transform[0]
pixel_width = geo_transform[1]
top_left_y = geo_transform[3]
pixel_height = geo_transform[5]
# 计算经纬度范围
height, width = ISA2022_data.shape
lon = np.linspace(top_left_x, top_left_x + pixel_width * width, width)
lat = np.linspace(top_left_y, top_left_y + pixel_height * height, height)
# 创建渐变色图,设置缺测值为白色
cmap = LinearSegmentedColormap.from_list("ISA(%)", ['white', 'red', 'orange', 'yellow'])
cmap.set_bad(color='white') # 设置 NaN 的颜色为白色
# 使用 Matplotlib 绘制 LAI 图
plt.figure(figsize=(12, 8))
img = plt.imshow(ISA2022_data, extent=(lon.min(), lon.max(), lat.min(), lat.max()), cmap=cmap, vmin=0, vmax=100) # LAI范围(百分数)
# 添加 colorbar
cbar = plt.colorbar(img, fraction=0.046, pad=0.04)
cbar.set_label('Impervious area fraction', fontsize=14)
cbar.ax.tick_params(labelsize=12)
# 加载并绘制 SHP 文件
GBAshp_file_path = "D:/6 Python Codes/GBA_Data_Process/shpFile/GBA/GBA.shp"
Chinashp_file_path = "D:/6 Python Codes/GBA_Data_Process/shpFile/China/中国.shp"
gdf_GBA = gpd.read_file(GBAshp_file_path)
gdf_China = gpd.read_file(Chinashp_file_path)
# 绘制 SHP 文件
gdf_GBA.boundary.plot(ax=plt.gca(), color='black', linewidth=0.5) # 将边界绘制在图上
gdf_China.boundary.plot(ax=plt.gca(), color='black', linewidth=1) # 将边界绘制在图上
# 设置图形范围与 TIFF 图像边界相同
plt.xlim(lon.min(), lon.max())
plt.ylim(lat.min(), lat.max())
plt.xlabel('Longitude (°)', fontsize=16)
plt.ylabel('Latitude (°)', fontsize=16)
plt.title('Global impervious surface area in 2022', fontsize=16)
# 设置坐标轴刻度值字体大小
plt.tick_params(axis='both', labelsize=14)
# 自定义坐标轴刻度值,后面加上°
def format_ticks(x, pos):
return f'{x:.2f}°'
# 应用自定义格式化函数
plt.gca().xaxis.set_major_formatter(plt.FuncFormatter(format_ticks))
plt.gca().yaxis.set_major_formatter(plt.FuncFormatter(format_ticks))
# 导出图形
output_file_path = "D:/6 Python Codes/GBA_Data_Process/ISA_2022.png" # 修改为所需的输出路径
plt.savefig(output_file_path, dpi=300, bbox_inches='tight')
plt.show()
参考
全部评论 (0)
还没有任何评论哟~
