- 积分
- 168
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-10-10
- 最后登录
- 1970-1-1
|
发表于 2017-12-1 10:44:24
|
显示全部楼层
已经成功了,强烈建议大家多学习官网,脚本细节的修改还是按照官网的来,不能生搬硬套,特别感谢这个平台,在大家身上学到了好多,我们一起学习~下面是我修改后的代码
- #!/usr/bin/env python
- import calendar
- from ecmwfapi import ECMWFDataServer
- server = ECMWFDataServer()
-
- def retrieve_interim():
- """
- A function to demonstrate how to iterate efficiently over several years and months etc
- for a particular interim_request.
- Change the variables below to adapt the iteration to your needs.
- You can use the variable 'target' to organise the requested data in files as you wish.
- In the example below the data are organised in files per month. (eg "interim_daily_201510.grb")
- """
- yearStart = 2003
- yearEnd = 2017
- monthStart = 7
- monthEnd = 7
- for year in list(range(yearStart, yearEnd + 1)):
- for month in list(range(monthStart, monthEnd + 1)):
- startDate = '%04d%02d%02d' % (year, month, 1)
- numberOfDays = calendar.monthrange(year, month)[1]
- lastDate = '%04d%02d%02d' % (year, month, numberOfDays)
- target = "F:/era_down/Jul/interim_daily_%04d%02d.nc" % (year, month)
- requestDates = (startDate + "/TO/" + lastDate)
- interim_request(requestDates, target)
-
- def interim_request(requestDates, target):
- """
- An ERA interim request for analysis pressure level data.
- Change the keywords below to adapt it to your needs.
- (eg to add or to remove levels, parameters, times etc)
- Request cost per day is 112 fields, 14.2326 Mbytes
- """
- server.retrieve({
- 'stream' : "oper",
- 'levtype' : "sfc",
- 'param' : "165.128/166.128",
- 'dataset' : "interim",
- 'step' : "0",
- 'grid' : "0.125/0.125",
- 'time' : "00/06/12/18",
- 'date' : requestDates,
- 'type' : "an",
- 'class' : "ei",
- 'area' : "25/100/-5/130",
- 'format' : "netcdf",
- 'target' : target
- })
- #10m u wind component(165.128),
- #10m v wind component(166.128),
- #2m temperature(167.128).
- if __name__ == '__main__':
- retrieve_interim()
复制代码 |
|