ECMWF ERA数据下载——Python+官网API

版权声明:本文为博主原创文章,未经允许不得转载 https://blog.csdn.net/weixin_42924891/article/details/85225062

利用Python批量下载ERA数据

一、注册账号
[官网]https://www.ecmwf.int/
二、登录后获取下载KEY
[获取网址]https://api.ecmwf.int/v1/key/
在这里插入图片描述
将大括号中内容(包括括号)复制保存为TXT文件,并重命名为.ecmwfapirc.,注意前后都有点,保存在 C:\Users<USERNAME>.ecmwfapirc.,(WINDOWS系统),username指当前电脑登录账户,比如我的是administrator
在这里插入图片描述
三、下载 ECMWF web-API client version in python
[下载地址]https://confluence.ecmwf.int//display/WEBAPI/Web-API+Downloads
在这里插入图片描述
下载后,可以解压为文件夹,定位到下载文件夹,调出命令行,直接输入pip install ecmwf-api-client即可
python下载ERA数据
官网可查到下载案例,例如:

#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
server.retrieve({
    "class": "ei",
    "dataset": "interim",
    "date": "2018-05-01/to/2018-05-31",
    "expver": "1",
    "grid": "0.75/0.75",
    "levtype": "sfc",
    "param": "168.128",
    "step": "3",
    "stream": "oper",
    "time": "00:00:00",
    "type": "fc",
    "target": "output",#文件名,可以是绝对路径,e.g:"D:/data/out.nc",注意如果是nc,format必须指定,否则文件名为nc但格式仍然是gribformat:"netcdf",#默认grib格式,可以修改为nc
})

也可以在手动下载界面中,选择好时间及需要数据,可以点击View The MARS Request,出现代码块,可以直接保存为.py文件,Python运行下载。由于是在选择格网及范围之前,这种方法默认0.75*0.75,范围全球,也可以在代码块中进行修改,相关参数参考官网说明[]https://confluence.ecmwf.int/display/CKB/ERA5+data+documentation#ERA5datadocumentation-Parameterlistings
至此,可以手动修改参数下载以月为单位,每一天的数据,加入循环语句,可以实现批量下载,后续记录。

参考文章:
https://blog.csdn.net/bluelilyfly/article/details/80154920
https://blog.csdn.net/zhanglinqi_007/article/details/79056682

猜你喜欢

转载自blog.csdn.net/weixin_42924891/article/details/85225062
今日推荐