You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:将巴西RADAR dBZ图像转换为数值的技术方案

基于巴西气象雷达PNG图像转换为dBZ反射率数值的问题

我正在开展一项基于巴西气象雷达数据的家庭研究,但目前仅拥有冰雹事件的.png格式雷达图像。需要依据图例将图像转换为dBZ反射率数值(反射强度越高,dBZ数值越大)。数据及图例来源于REDEMET网站。

图例

雷达dBZ反射率图例

冰雹事件雷达图像

待转换的冰雹事件雷达PNG图像

当前使用的转换脚本(效果不佳)

当前我将图像转为灰度图后按自定义阈值过滤,但该方法无法准确匹配图例中的dBZ数值,脚本如下:

# 加载依赖包
import cartopy.crs as ccrs
import cartopy.io.img_tiles as cimgt
import matplotlib.pyplot as plt

from PIL import Image
import numpy as np

# 用PIL读取图像
img = Image.open('./BRSG_20230417_135600_0_source.png')

# 其他示例数据地址:https://estatico-redemet.decea.mil.br/radar/2023/05/27/sg/maxcappi/maps/2023-05-27--10:56:27.png

# 转换为灰度图
img_cinza = img.convert('L')

# 转为NumPy数组
arr = np.array(img_cinza)

# Santiago雷达地理范围参数
# extent = [-59.189733162586094, -50.844752805434396, -32.814210356963194, -25.573430009385245]
latt = np.arange(-32.814210356963194, -25.573430009385245, 0.018101950868944873)
lonn = np.arange(-59.189733162586094, -50.844752805434396, 0.020862450892879244)
#lonn = lonn - 360
latt = latt[::-1]

Xi, Yi = np.meshgrid(lonn,latt)

# 创建包含纬度、经度和数据的三维数组
dd = np.zeros([3,latt.shape[0],lonn.shape[0]])
# dd = np.zeros([3,400,400])

dd[0,:,:] = arr[:,:]
dd[1,:,:] = Yi[:,:]
dd[2,:,:] = Xi[:,:]

# 将0值替换为NaN
dd[0,:,:][dd[0,:,:]==0] = np.nan

# 仅保留灰度值低于80的区域(认为对应高反射率雷暴区)
dd[0,:,:][dd[0,:,:] >= 80] = np.nan

# 初步绘图
plt.imshow(dd[0,:,:])

# 用Cartopy绘制带地理信息的图
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())

ax.contourf(dd[2,:,:], dd[1,:,:], dd[0,:,:], extent = [-59, -45, -35, -22.0], transform=ccrs.PlateCarree())    

# 添加Natural Earth的省级边界图层
states_provinces = cfeature.NaturalEarthFeature(
    category='cultural',
    name='admin_1_states_provinces_lines',
    scale='50m',
    facecolor='none')
    
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(states_provinces, edgecolor='gray')

ax.coastlines(resolution='10m', color='black', linewidth=0.8)
ax.add_feature(cartopy.feature.BORDERS, edgecolor='black', linewidth=0.5)
gl = ax.gridlines(crs=ccrs.PlateCarree(), color='gray', alpha=1.0, linestyle='--', linewidth=0.25, xlocs=np.arange(-180, 180, 5), ylocs=np.arange(-90, 90, 5), draw_labels=True)
gl.top_labels = False
gl.right_labels = False

内容的提问来源于stack exchange,提问作者Lucas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 14:13:18