利用python批量下载ERA的数据

终于开始用python了,只学了两天的python小白上线下载数据(被逼的)。

其实这个有一些很好的教程,我直接粘贴好了。批量下载的教程

其中的一些参数官网的解释很清楚的,可以先试着下载一个月的数据,再获取它的request提供参考

最后是我的一些代码,以及注释

这是下载era-40里面的2mt数据,并且只下载纬度80N以北的数据,注意看参数。格网为0.75

from ecmwfapi import ECMWFDataServer
    
server = ECMWFDataServer()
polynya_boundary = "90/-180/80/180"
day_month_dic = {1:31,2:28,3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30,12:31}

for year in range(1959, 1979):
    for month in range(1, 13):
        date_varied = "{}-{:0>2d}-01/to/{}-{:0>2d}-{}".format(year, month, year, month, day_month_dic[month])
        
        server.retrieve({
            'stream'    : "oper", 
            'levtype'   : "sfc",
            'param'     : "167.128",
            'dataset'   : "era40",
            'step'      : "0",
            'grid'      : "0.75/0.75",
            'time'      : "00/06/12/18",
            'date'      : date_varied,
            'type'      : "an",
            'class'     : "E4",
            'area'      : polynya_boundary,
            'format'    : "netcdf",
            'target'    : "F:\\ERAInterim\\2TM\\{0}\\{1}_{2:0>2d}.nc".format(year,year,month)
         })

下面这个是下载ERA-Interim的2tm的数据,注意时间,范围基本一致。

from ecmwfapi import ECMWFDataServer
    
server = ECMWFDataServer()
polynya_boundary = "90/-180/80/180"
day_month_dic = {1:31,2:28,3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30,12:31}

for year in range(2018, 2019):
    for month in range(1, 10):
        date_varied = "{}-{:0>2d}-01/to/{}-{:0>2d}-{}".format(year, month, year, month, day_month_dic[month])
        
        server.retrieve({
            'stream'    : "oper", 
            'levtype'   : "sfc",
            'param'     : "167.128",
            'dataset'   : "interim",
            'step'      : "0",
            'grid'      : "0.75/0.75",
            'time'      : "00/06/12/18",
            'date'      : date_varied,
            'type'      : "an",
            'class'     : "ei",
            'area'      : polynya_boundary,
            'format'    : "netcdf",
            'target'    : "F:\\ERAInterim\\2TM\\{0}\\{1}_{2:0>2d}.nc".format(year,year,month)
         })

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

就是一只白

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值