Created on Fri Jan 1 14:58:08 2021
@author: mae
This program download ERA5 rain water content during 2018.07.04-2017.07.11
using python multi-threaded execution.
notice:
1. This script requires url and key which can be found at web page:
https://cds.climate.copernicus.eu/api-how-to
2. after run the script, era5 data will be format individualy like:
'era5_' + '201807' + d + h + '_rain_water_sfc.grib'
"""
import cdsapi
import os
from multiprocessing import Process
c = cdsapi.Client()
def download(day, h):
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type':'reanalysis',
'format': 'grib',
'variable': 'total_column_rain_water',
'year': '2018',
'month': '07',
'day': day,
'time': h,
},
'era5_' + '201807' + d + h + '_rain_water_sfc.grib')
return 0
if __name__ == '__main__':
# define directory where you want data store in.
os.chdir("/where/data/put/in/")
days=['04', '05', '06','07', '08', '09','10', '11']
times=[
'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']
for day in days:
d = day
pro_list = []
for hour in times:
h = hour
p = Process(target=download, args=(day, h))
p.start()
pro_list.append(p)
for p in pro_list:
p.join()
print("主进程结束!")
del p
————————————————
版权声明:本文为CSDN博主「Mae_Liu」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Mae_Liu/article/details/112061755