ERA5数据python批量下载程序
入门教程见链接:
ERA5数据python下载教程(Windows用户)
https://www.jianshu.com/writer#/notebooks/41463838/notes/57922523
例子为批量下载ERA5数据2007-2015年总降雨量的日数据,根据日历动态调整每月天数
import cdsapi
import calendar
c = cdsapi.Client()
for year in range(2007, 2016):
for j in range(1,13):
monthRange = calendar.monthrange(year,j)
for k in range(1, monthRange[1]+1):
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type': 'reanalysis',
'variable': 'total_precipitation',
'year':str(year),
'month':("%02d" % j),
'day':[
("%02d" % k)
],
'time': [
'00:00', '01:00', '02:00',
'03:00', '04:00', '05:00',
'06:00', '07:00', '08:00',
'09:00', '10:00', '11:00',
'12:00', '13:00', '14:00',
'15:00', '16:00', '17:00',
'18:00', '19:00', '20:00',
'21:00', '22:00', '23:00',
],
'format': 'netcdf',
},
'rain'+str(year)+("%02d" % j)+("%02d" % k)+'.nc')