爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 13703|回复: 4

[求助] 运用python下载ERA月数据资料

[复制链接]

新浪微博达人勋

发表于 2017-10-25 17:52:05 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
本帖最后由 常山赵子龙 于 2017-11-2 17:15 编辑

之前一直使用了论坛里面的python程序下载了一天一天每一年的数据。
程序如下:原网址为:
http://bbs.06climate.com/forum.php?mod=viewthread&tid=24435

          'date'    : data[idata]+"0101"+"/to/"+data[idata]+"1231",这里是下载时间段
          'time'    : "00/06/12/18",这里是下载时次
          #'origin'  : "all",这里选择的是哪几个个预报中心
          #'type'    : "pf",这里选择的是集合预报(pf)还是控制预报(fc)
          'param'   : "u",这里是下载变量名
          'levelist': "1000/925/850/700/600/500/400/300/250/200/150/100/70/50/30/20/10",这里是下载层次
          'area'    : "90/0/0/180",这里是下载区域范围,按照 90N -180W -90S 180E的范围填写
          'grid'    : "2/2",这是是格点精度
          'format'  :'netcdf',这里是下载格式,不写的话是下载grib文件的
          'target'  : "D:/era_down/u/u.day."+data[idata]+".nc"这里是下载路径和文件名,netcdf文件自然后缀名是nc

但是后来,我登录了一下era的月数据资料发现了一个问题,月数据的资料变成了这样,只能一个一个点,并不能够选取多个。


'date'    : data[idata]+"0101"+"/to/"+data[idata]+"1231",这里是下载时间段
请问各位大神,假如我要下载月的数据,这句话应该怎么去修改呢?不太会python,求指导啊啊

我看官网的python脚本给的是这个:19870101/19870201/19870301/19870401/19870501/19870601/19870701/19870801/19870901/19871001/19871101/19871201



WechatIMG282.jpeg
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-11-4 23:08:21 | 显示全部楼层
本帖最后由 Sebastian 于 2017-11-4 23:14 编辑

对,目前下载月数据已经不能选择全部年份了,ecmwf给出了一个脚本
  1. def retrieve_era20c_mnth():
  2.         """      
  3.         A function to demonstrate how to iterate efficiently over all months,
  4.                    for a list of years of the same decade (eg from 2000 to 2009) for an ERA-20C synoptic monthly means request.
  5.                    You can extend the number of years to adapt the iteration to your needs.
  6.                    You can use the variable 'target' to organise the requested data in files as you wish.
  7.         """
  8.         yearStart = 1900
  9.         yearEnd = 2010
  10.         monthStart = 1
  11.         monthEnd = 12
  12.         requestMonthList = []
  13.         for year in list(range(yearStart, yearEnd + 1)):
  14.                 for month in list(range(monthStart, monthEnd + 1)):
  15.                         requestMonthList.append('%04d-%02d-01' % (year, month))
  16.         requestMonths = "/".join(requestMonthList)
  17.         target_pl = "era20c_from_%s_to_%s_sfc_Var2.nc" % (yearStart, yearEnd)
  18.         era20c_mnth_pl_request(requestMonths, target_pl)

写个年月循环的函数就好了,然后 “date”:“requestMonths” 就可以了。
详细:https://software.ecmwf.int/wiki/ ... etrieval+efficiency
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-11-5 10:29:51 | 显示全部楼层
Sebastian 发表于 2017-11-4 23:08
对,目前下载月数据已经不能选择全部年份了,ecmwf给出了一个脚本
写个年月循环的函数就好了,然后 “date ...

非常感谢你啊啊啊!!!! 我回头试试看!!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-1-13 09:52:32 | 显示全部楼层
非常感谢,自己刚刚也正好要用到下载全部年份的数据,感谢
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-8-14 20:13:12 | 显示全部楼层
非常感谢楼主,在下载中。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表