RQL's Blog 菜鸟成长记

ECMWF数据python批量下载语法

2020-05-03
renql

#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
server.retrieve({
    "class": "ei",
    "dataset": "interim",
    "date": "1995-11-01/to/1995-11-30",
    "expver": "1",
    "grid": "0.75/0.75",  
    "levelist": "700/750/775/800/825/850/875/900/925/950/975/1000",
    "levtype": "pl",
    "param": "131.128/132.128",
    "step": "0",
    "stream": "oper",  
    "time": "18:00:00",
    "type": "an",
    "target": "output",
})

各参数说明:https://confluence.ecmwf.int/display/UDOC/Identification+keywords#Identificationkeywords-param

expver: Identifies the experiment version. Each experiment or model run is assigned a unique code (version). Production data is assigned 1 or 2, and experimental data in Operations 11, 12 ,… IFS research experiments run by ECMWF or by Member States have a four character experiment identifier.

param: Specifies the meteorological parameter of a field.

stream: Identifies the forecasting system used to generated the data when the same meteorological types are archived. For example, oper is used for the Operational Atmospheric model and wave for the Wave model. Both models produce Analysis and Forecast data types.

循环下载文件

#!/user/bin/ebv python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()

var_id = [131,132,135,130,129]
var_na = ["uwnd","vwnd","omega","air","hgt"]
times  = ["00:00:00","06:00:00","12:00:00","18:00:00"]

for year in range(2017,2018):
for ivar in range(0,4):
    for it in range(2,3):
        server.retrieve({
            "class"   : "ei",
            "dataset" : "interim",
            "date"    : str(year)+"-01-01/to/"+str(year)+"-12-31",
            "expver"  : "1",
            "grid"    : "1.5/1.5",
            "levelist": "1/2/3/5/7/10/20/30/50/70/100/125/150/175/200/225/250/300/350/400/450/500/550/600/650/700/750/775/800/825/850/875/900/925/950/975/1000",
            "levtype" : "pl",
            "param"   : str(var_id[ivar])+".128",
            "step"    : "0",
            "stream"  : "oper",
            "time"    : times[it],
            "type"    : "an",
            "format"  : "netcdf",
            "target"  : "/home/ERA-interim/pressure/"+var_na[ivar]+"/"+var_na[ivar]+".interim."+str(it)+"."+str(year)+".nc",
        })

上一篇 气旋比较计划

Content