ERA5数据 python 下载

1、密钥

How to use the CDS API | Copernicus Climate Data Store

密钥存储到C盘用户名下

2、API request

Copernicus Climate Data Store | Copernicus Climate Data Store

3、python:pip install cdsapi

import cdsapi
import calendar

dic = {
    'product_type': 'reanalysis',  # 产品类型
    'format': 'netcdf',  # 数据格式
    'variable': ['specific_humidity','temperature', 'u_component_of_wind', 'v_component_of_wind'],  # 变量名称
    'pressure_level': [
            '10', '50', '100',
            '150', '200', '250',
            '300', '350', '400',
            '450', '500', '550',
            '600', '650', '700',
            '750', '800', '850',
            '900', '950', '975',
            '1000'],
    'year': '',  # 年,设为空
    'month': '',  # 月,设为空
    'day': [],  # 日,设为空
    'time': []  # 小时
}

c = cdsapi.Client()  # 创建用户
i=2020
time = ['00:00', '06:00', '12:00', '18:00']
#按每天四个文件下载
for j in range(1, 13):  
    day_num = calendar.monthrange(i, j)[1]  # 根据年月,获取当月日数
    dic['year'] = str(i)
    dic['month'] = str(j).zfill(2)
    for d in range(1, day_num + 1):
        dic['day'] = str(d).zfill(2)
        for h in range(4):
            dic['time']=time[h]
            filename = 'D:\\Data\\+str(i)+str(j).zfill(2)+str(d).zfill(2)+time[h][0:2].zfill(2)+'.nc'  # 文件存储路径       
            c.retrieve('reanalysis-era5-pressure-levels', dic, filename)  # 下载数据
            print("down "+filename)

参考:

ERA5(欧洲中期天气预报中心)再分析数据集介绍与下载 - 知乎

批量下载ERA5数据(Python+IDM)_import cdsapi-CSDN博客

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值