NOAA陆地实时降水数据的python读取

about the data:Daily Precipitation Analysis

download gridded data:Daily Precipitation Analysis

下载 real time data,文件格式 .RT

读取文件说明:PRCP_CU_GAUGE_V1.0GLB_0.50deg_README

  • 文档文件:存放在 /docu 子目录中,可能包含数据集的详细说明、使用指南等文档。
  • 回顾版本数据文件:位于 /v1.0 子目录,存放 1979 - 2005 年的回顾版本数据。
  • 实时版本数据文件:在 / RT 子目录,包含 2006 年至今的实时版本数据。
  • EOD 时间文件:PRCP_CU_GAUGE_V1.0GLB_0.50deg_EOD.lnx 是二进制数据文件,用于记录 EOD 时间;PRCP_CU_GAUGE_V1.0GLB_0.50deg_EOD.lnx.ctl 是 GrADS 控制文件,用于辅助读取和处理该二进制文件。

可用于读取的代码:PRCP_CU_GAUGE_V1.0GLB_0.50deg_F77_read_sample.f

依照 .f 文件,使用python读取:

import numpy as np

# 定义网格维度
nx = 720
ny = 360

# 打开二进制文件
file_path = 'PRCP_CU_GAUGE_V1.0GLB_0.50deg.lnx.20240101.RT'
try:
    with open(file_path, 'rb') as file:
        # 读取降水数据
        rain = np.fromfile(file, dtype='<f4', count=nx * ny).reshape((ny, nx))
        # 读取站点数量数据
        stnm = np.fromfile(file, dtype='<f4', count=nx * ny).reshape((ny, nx))

    # 测试
    # Python 索引从 0 开始,Fortran 从 1 开始
    i = 499
    for j in range(200, 300):
        print(f"{j + 1} rain = {rain[j, i]} stnm = {stnm[j, i]}")

except FileNotFoundError:
    print(f"文件 {file_path} 未找到。")
except Exception as e:
    print(f"读取文件时出现错误: {e}")

测试:(坐标应参考辅助文件,此处为简易方式)

lon = np.linspace(0,360,720)
lat = np.linspace(-90,90,360)
LON,LAT = np.meshgrid(lon,lat)

fig = plt.figure(figsize=(10,5),dpi=300,facecolor='white')
ax = plt.subplot(1,1,1,projection=proj)
contour_map(ax, img_extent, 5)       
ax.set_title('data',loc='left')
pic1 =ax.contourf(LON-180,LAT,rain,cmap=plt.get_cmap('RdYlBu_r'),extend = 'both')
cbar= plt.colorbar(pic1)
plt.tick_params(labelsize=15)

补充材料:

to present 蒸发降水数据网址:

ERA5 hourly data on single levels from 1940 to present (Evaporation,Precipitation)

Global Precipitation Climatology Project (GPCP) Monthly Analysis Product: NOAA Physical Sciences Laboratory Global Precipitation Climatology Project (GPCP) Monthly Analysis Product

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值