Mac下ecmwf数据的下载

首先安装python3

brew install [email protected]

接着安装pip

curl https://bootstrap.pypa.io/get-pip.py | python3

安装conda 参考:https://www.jianshu.com/p/62f155eb6ac5,但我不是,我是

brew install anaconda  

之后安装cdsapi

pip3 install cdsapi 

接着注册ecmwf账号 https://apps.ecmwf.int/registration/ ,按照要求会把所有要求的内容写入 $HOME/.ecmwfapirc 文件。

接着注册https://cds.climate.copernicus.eu/ 账号,按要求把 https://cds.climate.copernicus.eu/api-how-to 里的内容复制到$HOME/.cdsapirc 中。这里网页似乎不适配safari,要改用chrome。

到https://cds.climate.copernicus.eu/cdsapp/#!/terms/licence-to-use-copernicus-products 同意要求。

接下来测试下
建立文件e.py

import cdsapi

c = cdsapi.Client()

c.retrieve(
    'reanalysis-era5-single-levels',
    {
        'product_type':'reanalysis',
        'variable':[
            'total_column_ozone','total_column_water_vapour'
        ],
        'year':'2019',
        'month':'01',
        'day':'23',
        'time':[
            '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'
        ],
        'format':'netcdf'
    },
    'download.nc')

执行一下

python3 e.py

你可能感兴趣的:(Mac下ecmwf数据的下载)